From MSDN dox:
WinSock select():
For connection-oriented sockets, readability can also indicate that a
request to close the socket has been received from the peer. If the
virtual circuit was closed gracefully, and all data was received, then a
recv will return immediately with zero bytes read.
..NET Socket.Select():
Readability can also indicate whether the remote Socket has shut down
the connection; in that case a call to Receive will return immediately,
with zero bytes returned.
Now for the question:
It's possible to send an empty message (socket.Send(new byte[]{}).
How on earth would a receving socket distinguish between this and a
remote shutdown?
/Per