How to detect a Socket Disconnect in C#
问题 I'm working on a client/server relationship that is meant to push data back and forth for an indeterminate amount of time. The problem I'm attempting to overcome is on the client side, being that I cannot manage to find a way to detect a disconnect. I've taken a couple of passes at other peoples solutions, ranging from just catching IO Exceptions, to polling the socket on all three SelectModes. I've also tried using a combination of a poll, with a check on the 'Available' field of the socket.