void start() { writeTitle("START"); FunDebug.Log("Client count is {0}.\n", kClientMax); Client.ConnectedCallback += onConnected; Client.StoppedCallback += onStopped; for (int i = 1; i <= kClientMax; ++i) { Client client = new Client(i); list.Add(client); } foreach (Client c in list) { c.Connect(TransportProtocol.kTcp, FunEncoding.kJson); Thread.Sleep(10); } while (!didAllConnect()) { Thread.Sleep(500); } foreach (Client c in list) { c.Stop(); Thread.Sleep(10); } while (!didAllStop()) { Thread.Sleep(500); } Thread.Sleep(500); FunapiMono.Stop(); writeTitle("FINISHED"); Process.GetCurrentProcess().Kill(); }
void start() { writeTitle("START"); FunDebug.Log("Client count is {0}.\n", kClientMax); int testCount = 0; while (testCount < kTestCount) { ++testCount; for (int i = 1; i <= kClientMax; ++i) { Thread t = new Thread(new ThreadStart(onTest)); t.IsBackground = true; threads_.Add(t); t.Start(); } foreach (Thread t in threads_) { t.Join(); } threads_.Clear(); Thread.Sleep(1000); writeTitle("Test Set '" + testCount + "' has been finished."); } FunapiMono.Stop(); writeTitle("FINISHED"); Process.GetCurrentProcess().Kill(); }