Exemplo n.º 1
0
        public TcpServer(int port, ITcpServerListener tcpServerListener)
        {
            if(port < 0)
            {
                throw new ArgumentException("Port must be a positive integer.");
            }

            if(tcpServerListener == null)
            {
                throw new ArgumentNullException("tcpServerListener");
            }

            _port = port;
            _tcpListener = new TcpListener(port);
            _tcpServerListener = tcpServerListener;
            _tcpListener.Start();
            Console.WriteLine("Tcp Server mounted, listening on port {0}", _port);
        }
Exemplo n.º 2
0
 public void RemoveListener(ITcpServerListener l)
 {
     listeners.Remove(l);
 }
Exemplo n.º 3
0
 public void AddListener(ITcpServerListener l)
 {
     listeners.Add(l);
 }
Exemplo n.º 4
0
 //============================================================================
 // addListener
 //============================================================================
 static public void addListener(ITcpServerListener list)
 {
     mListeners.Add(list);
 }