static void Main(string[] args) { SynchronousSocketListener listener = new SynchronousSocketListener(); listener.HostName = "127.0.0.1"; Thread threadServer = new Thread(new ThreadStart(listener.StartListening)); threadServer.Start(); threadServer.Join(); }
public void TestMethod138() { List<Thread> list = new List<Thread>(); SynchronousSocketListener listener = new SynchronousSocketListener(); Thread threadServer = new Thread(new ThreadStart(listener.StartListening)); for (int i = 0; i < SZ; i++) { SynchronousSocketClient client = new SynchronousSocketClient(); Thread threadClient1 = new Thread(new ThreadStart(client.StartClient)); threadClient1.Start(); list.Add(threadClient1); } threadServer.Start(); Thread.Sleep(100); foreach (Thread t in list) { t.Join(); } threadServer.Abort(); }