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(); } }
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); } }