   .NET socket mystery
  Hi,I have a socket server I've been creating... kind of learning as I go.All seemed great until i moved it over to my Linux box ( with mono ), and when i lost connection... BEHOLD! It didn't detect a disconnect! I've tried everything in my code to detect this, and searched the object up and down... but still no luck.Does anyone know why if I cut my net connection, or if I disconnect/reconnect fast enough over and over, it doesn't detect the disconnection? Does anyone know of a cure?Here is a watered down version of my loop:If I add polling, or check some properties... nothing seems to indicate that i've disconnected... but I have!if (clientListMut.WaitOne()){  for (int i = clientList.Count - 1; i >= 0; i--)  {    if ( !clientList.alive || !clientList.socket.Connected )    { // The socket has died. Lets remove that client. // Create a temporary reference so we can access it right after removing it from the array. NetworkClient tmpObj = clientList; clientList.RemoveAt(i); System.Console.WriteLine("Connection Disconnected: " + tmpObj.remoteEndPoint.ToString()); if (userOnDisconnect != null) {   userOnDisconnect(tmpObj); } tmpObj.destroy();    }    else if ( clientList.socket.Poll(1, SelectMode.SelectRead) )    { clientList.read();    }  }  clientListMut.ReleaseMutex();}
  If somebody can help me come to an exact solution ( ha, big request i know! ) I'll gladly send over $20 via paypal.   ;  Hi.NET Only updates the isConnected property after a send/receive , thus the only way you can detect a disconnect is to use the following code before you try to send/receive on the connection :/* pvConnection is a Socket Object */if(pvConnection.Poll(10000,System.Net.Sockets.SelectMode.SelectRead)){   if(pvConnection.Available==0)   {//The socket is disconnected/gone -> Reconnect or do whatever ....   }}Hope this helpsThanksLe Roi   ;  Thanks! Your suprisingly simple explanation has shed some light on my problem. I seem to have corrected it...Can you post or PM me your paypal account id and I will send you $20?   ;  HiNo need for payment , your thanks was enough ;) in any case I also struggled with this before finding the solution , so the least I can do is share it.ThanksLe Roi   