System.Net.Sockets.SocketExtensions.IsConnected C# (CSharp) Méthode

IsConnected() public static méthode

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
Résultat bool
        public static bool IsConnected(this Socket iSocket)
        {
            try
            {
                return !(iSocket.Poll(1, SelectMode.SelectRead) && iSocket.Available == 0);
            }
            catch
            {
                return false;
            }
        }
SocketExtensions