Пример #1
0
        public void adfsdl()
        {
            IPAddress   ipAddress   = IPAddress.Any;
            TcpListener tcpListener = new TcpListener(ipAddress, 13000);

            tcpListener.Start();

            bool done = false;

            while (!done)
            {
                TcpClient tcpClient = tcpListener.AcceptTcpClient();
                MyClient  newClient = new MyClient(tcpClient);
                Thread    t         = new Thread(new ThreadStart(newClient.Communicate));
                t.Start();
            }
        }
Пример #2
0
        private void TcpServerListen()
        {
            IPAddress ipAddress = IPAddress.Any;

            _tcpListener = new TcpListener(ipAddress, 13000);
            _tcpListener.Start();

            while (_tcpListening)
            {
                TcpClient tcpClient = _tcpListener.AcceptTcpClient();

                if (_threadCount > toplimit)
                {
                    // tell Client it's been over 2000
                    continue;
                }
                MyClient newClient = new MyClient(tcpClient, this);
                Thread   t         = new Thread(new ThreadStart(newClient.Communicate));
                t.IsBackground = true;
                t.Start();
                _list.Add(newClient);
            }
        }