Cannot get Socket.Poll and Socket.Connected to work as desired
Okay I know there is lots of info out there on this and I promise you I have read it all and tried umpteen different methods to get this working!!

I have a socket server program which runs on a laptop. I then have up to 50 laptops connected wirelessly via the same LAN to the server. The client laptops all connect to the server (using Socket.ConnectAsync) and the server uses async methods as well to send and receive data. The server shows a list of connected client laptops to the user and this list seems to be accurate and picks up whenever a client disconnects and connects. However, the client laptops never seem to detect when connection to the server has been lost under certain circumstances (ie if server program crashes, if server laptop goes in to standby mode etc.) I have got a timer on the client laptops which polls the connection every 5 seconds as follows:

         bool SocketConnected(Socket s)
        {             
            bool part1 = s.Poll(0, SelectMode.SelectWrite);
            
            bool part2 = (s.Available == 0);
            if (!part1 && part2)
            {

                return false;
            }
            else
            {
                return true;
            }
        }


I have tried using all selectmodes (SelectWrite,SelectRead,SelectError) and have tried using different time out values. I have tried checking s.Connected value after these operations and have tried all manners of other methods to determine the connection state and nothing seems to produce reliable results!! I think I can achieve the result I desire by sending dummy information every 5 seconds and checking s.Connected after doing so, however I don't really want to do this as each laptop is already sending lots of data to the server as it is. Any help at all is massively appreciated! Thanks
Cannot get Socket.Poll and Socket.Connected to work as desired
===

Okay I know there is lots of info out there on this and I promise you I have read it all and tried umpteen different methods to get this working!!

I have a socket server program which runs on a laptop. I then have up to 50 laptops connected wirelessly via the same LAN to the server. The client laptops all connect to the server (using Socket.ConnectAsync) and the server uses async methods as well to send and receive data. The server shows a list of connected client laptops to the user and this list seems to be accurate and picks up whenever a client disconnects and connects. However, the client laptops never seem to detect when connection to the server has been lost under certain circumstances (ie if server program crashes, if server laptop goes in to standby mode etc.) I have got a timer on the client laptops which polls the connection every 5 seconds as follows:

         bool SocketConnected(Socket s)
        {             
            bool part1 = s.Poll(0, SelectMode.SelectWrite);
            
            bool part2 = (s.Available == 0);
            if (!part1 && part2)
            {

                return false;
            }
            else
            {
                return true;
            }
        }


I have tried using all selectmodes (SelectWrite,SelectRead,SelectError) and have tried using different time out values. I have tried checking s.Connected value after these operations and have tried all manners of other methods to determine the connection state and nothing seems to produce reliable results!! I think I can achieve the result I desire by sending dummy information every 5 seconds and checking s.Connected after doing so, however I don't really want to do this as each laptop is already sending lots of data to the server as it is. Any help at all is massively appreciated! Thanks