TcpListener.Active 属性

定义

获取一个值,该值指示 TcpListener 是否正主动侦听客户端连接。Gets a value that indicates whether TcpListener is actively listening for client connections.

protected:
 property bool Active { bool get(); };
protected bool Active { get; }
member this.Active : bool
Protected ReadOnly Property Active As Boolean

属性值

Boolean

如果 TcpListener 正主动侦听,则为 true;否则为 falsetrue if TcpListener is actively listening; otherwise, false.

注解

派生自的类 TcpListener 可以使用此属性来确定 Socket 当前是否正在侦听传入的连接尝试。Classes deriving from TcpListener can use this property to determine if the Socket is currently listening for incoming connection attempts. Active属性可用于避免冗余 Start 尝试。The Active property can be used to avoid redundant Start attempts.

适用于

另请参阅