public void RunMe() { if (Thread.CurrentThread == thread1) { Console.WriteLine("Ceci est le thread un"); HelloServer obj = (HelloServer)Activator.GetObject(typeof(HelloServer), "tcp://localhost:8089/SayHello"); for (int i = 0; i < 100; i++) { Console.WriteLine(obj.CountMe() + " - partir du thread 1 "); Thread.Sleep(0); } } else if (Thread.CurrentThread == thread2) { // TcpChannel chan = new TcpChannel(); //ChannelServices.RegisterChannel(chan, true); Console.WriteLine("Ceci est le thread deux"); HelloServer obj = (HelloServer)Activator.GetObject(typeof(HelloServer), "tcp://localhost:8089/SayHello"); for (int i = 0; i < 100; i++) { Console.WriteLine(obj.CountMe() + " - partir du thread 2 "); Thread.Sleep(0); } } }
public void RunMe() { if (Thread.CurrentThread == thread1) { Console.WriteLine("Ceci est le thread un"); HelloServer obj = (HelloServer)Activator.GetObject(typeof(HelloServer), "tcp://localhost:8089/SayHello"); for (int i = 0; i < 100; i++) { Console.WriteLine(obj.CountMe() + " depuis le thread 1 "); Thread.Sleep(0); } } else if (Thread.CurrentThread == thread2) { Console.WriteLine("Ceci est le thread deux"); HelloServer obj = (HelloServer)Activator.GetObject(typeof(HelloServer), "tcp://localhost:8089/SayHello"); for (int i = 0; i < 100; i++) { Console.WriteLine(obj.CountMe() + " depuis le thread 2 "); Thread.Sleep(0); } } }