private static void GreetTogether() { var threads = new Thread[ThreadCount]; var clients = new IHelloService[ThreadCount]; for (int i = 0; i < ThreadCount; i++) { clients[i] = CreateClient(); var state = new HelloServiceInvoker(i, clients[i]); threads[i] = new Thread(new ThreadStart(state.InvokeService)); } foreach (Thread t in threads) { t.Start(); } foreach (Thread t in threads) { t.Join(); } foreach (IHelloService t in clients) { ((IChannel)t).Close(); } }
private static void GreetOnce() { Console.WriteLine("First message invocation: "); IHelloService client = CreateClient(); ((IChannel)client).Open(); var invoker = new HelloServiceInvoker(0, client); invoker.InvokeService(); }