的recv不给我一个-1客户端套接字关闭()
问题描述:
...
client_socket = accept(server_socket, (struct sockaddr *) &client_address, &client_address_len);
...
for (;;) {
if (recv(client_socket, recived_buffer, MAX_MSG_LENGTH, 0) < 0) {
perror("ERROR leyendo el socket");
exit(1)
}
}
,如果我杀了无限客户端服务器lopps ...
任何提示?
答
的recv返回0 - 当对等关闭连接,另一部分将其解释为一个EOF
这样,答案是,阅读手册。 :-) – tristan 2011-04-04 16:06:28
*精美*手册! – 2011-05-11 18:41:28