Return Value
If no error occurs, Receive returns the number of bytes received. If the connection is closed, it returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling GetLastError.
SOCKET_ERROR 就是 -1 ,所以似乎应该改成这样:
if( len = Receive(buffer,BUFFER_SIZE) <= 0 )
break ;