4-4 Programming Samples Rev. A
/* send data */
send(sock, "EPSON\n", 6, 0);
/* gracefully close */
shutdown(sock, 1);/* SD_SEND */
while (1) {
char buf[64];
int n = recv(sock, buf, 64, 0);
if (n = SOCKET_ERROR || n == 0)
break;
}
shutdown(sock, 2);/* SD_BOTH */
/* close socket */
closesocket(sock);
return 0;
}