+ ret = m_socket->Read(buffer, nbytes);
+ if ( ret == 0 )
+ {
+ // for connection-oriented (e.g. TCP) sockets we can only read 0
+ // bytes if the other end has been closed, and for connectionless
+ // ones (UDP) this flag doesn't make sense anyhow so we can set it to
+ // true too without doing any harm
+ m_closed = true;
+ break;
+ }