public GSocketListener(int port, GSocketListener.ClientArrivedHandler handler)
        {
            _port = port;

            ClientArrived += handler;

            _tcpListener = new TcpListener(_port);
            _tcpListener.Start();

            _acceptorThread = new GThread(new ThreadStart(_acceptorloop), "Acceptor Loop", true);
            _acceptorThread.Start();
        }
        public BaseListener(IPAddress address, int port, BaseListener.ClientArrivedHandler handler)
        {
            _port = port;

            ClientArrived += handler;

            _tcpListener = new TcpListener(address, _port);
            _tcpListener.Start();

            _acceptorThread = new GThread(new ThreadStart(_acceptorloop), "Acceptor Loop", true);
            _acceptorThread.Start();
        }
        public BaseListener(int port, BaseListener.ClientArrivedHandler handler = null)
        {
            _port = port;

            if(handler != null)
                ClientArrived += handler;

            _tcpListener = new TcpListener(_port);
            _tcpListener.Start();

            _acceptorThread = new GThread(new ThreadStart(_acceptorloop), "Acceptor Loop", true);
            _acceptorThread.Start();
        }
Exemple #4
0
        public void Init(Stream inStream, Stream outStream, int maxPackSize = 2048)
        {
            _inStream = inStream;
            _outStream = outStream;

            _isActive = true;
            MaxPackSize = maxPackSize;

            _readerThread = new GThread(new System.Threading.ThreadStart(_readerloop),
                "Reader-Tread for " + this.ToString(), true);
            _readerThread.Thread.IsBackground = true;
            _readerThread.Start();
        }