recv的返回0永远表示链接关闭。[/quote][/quote]
If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
recv只有0和-1的返回值,这msdn上不是都有。链接优雅关闭是0,其他一切都是靠last error判断[/quote]
>0都是有数据
recv的返回0永远表示链接关闭。[/quote][/quote]
If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
recv只有0和-1的返回值,这msdn上不是都有。链接优雅关闭是0,其他一切都是靠last error判断