Thursday, February 12, 2015

How to check TcpListener is listening?

In TcpListener class, there is a property called Active but it a proctected one.

Create a sub class from TcpListener, and expose this property by yourself.

Code example:
    public class Listener : TcpListener
        public Listener(int portNumber): base(IPAddress.Any, portNumber) {}
        public bool IsAcitve
            get { return this.Active; }

No comments:

Post a Comment