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