public static void listenerThread(object port) { try { newListener = new TcpListener(IPAddress.Any, (int)port); newListener.Start(); TcpClient client; while (true) { client = newListener.AcceptTcpClient(); if (client == null) { break; } threadPool.addClient(client); } } catch { Console.WriteLine("Listener ending"); } }
public static void listenerThread(object port) //listener thread constantly executes this { try { newListener = new TcpListener(IPAddress.Any, (int)port); //open a tcp Listener newListener.Start(); TcpClient client; while (true) { client = newListener.AcceptTcpClient(); //have listener keep trying to get a new client if (client == null) { break; } threadPool.addClient(client); //if not null, send the client to the threadpool } } catch { Console.WriteLine("Listener ending"); } }