public Thread Start() { SynchronousSocketClient client = new SynchronousSocketClient(); client.EnableDataGenerator = true; while (true) { Thread t = new Thread(new ThreadStart(client.StartClient)); t.Start(); //t.Join(); return t; } }
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(); }