In C# how do you know a socket has disconnected?
My C# server needs to know when a player disconnects (TCP), whether it be a clean disconnect or otherwise. I seem to be able to catch most of the clean disconnects because I get a Recieve with a length of zero from this call:
NumberBytesReceived = m_Socket.EndReceive(asyn);
NumberBytesReceived will be zero on a clean disconnect. However there''s times when the player disconnects but I don''t get this 0 byte receive, I get no data received, so i''m hoping there''s some other way to check?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement