System.Net.Sockets.SocketExtensions.IsConnected C# (CSharp) Метод

IsConnected() публичный статический Метод

Determines if the connection to the machine on the other side of the socket is still active. Serves the same purpose as TcpClient.Connected and TcpListener.Connected.
public static IsConnected ( this iSocket ) : bool
iSocket this
Результат bool
        public static bool IsConnected(this Socket iSocket)
        {
            try
            {
                return !(iSocket.Poll(1, SelectMode.SelectRead) && iSocket.Available == 0);
            }
            catch
            {
                return false;
            }
        }
SocketExtensions