//----< construct a basic message >------------------------------ public CommChannelDemo.Message makeMessage(string author, string fromEndPoint, string toEndPoint) { CommChannelDemo.Message msg = new CommChannelDemo.Message(); msg.author = author; msg.from = fromEndPoint; msg.to = toEndPoint; return(msg); }
//----< use private service method to receive a message >-------- void rcvThreadProc() { while (true) { CommChannelDemo.Message msg = comm.rcvr.GetMessage(); msg.time = DateTime.Now; Console.Write("\n {0} received message:", comm.name); msg.showMsg(); if (msg.body == "quit") { break; } } }
//----< On clicking send the xml message to the test harness >------------------------------ private void button1_Click(object sender, RoutedEventArgs e) { ThreadStart ts = new ThreadStart(() => { Console.Write("\n Client Sending Message to Test Harness"); Console.Write("\n =====================\n"); CommChannelDemo.Message msg = makeMessage(textBox.ToString(), endPoint, endPoint); string remoteEndPoint = Comm <MainWindow> .makeEndPoint("http://localhost", 9090); msg.body = GUIRequest(); msg.to = remoteEndPoint; comm.sndr.PostMessage(msg); }); new Thread(ts).Start(); }
static void Main() { HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); Client client = new Client(); CommChannelDemo.Message msg = client.makeMessage("Sahil Shah", client.endPoint, client.endPoint); CommChannelDemo.Message msg1 = client.makeMessage("Rishi Dabre", client.endPoint, client.endPoint); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080); msg.body = MessageTest.makeTestRequest(); msg.to = remoteEndPoint; msg1.body = MessageTest.makeAnotherTestRequest(); msg1.to = remoteEndPoint; client.comm.sndr.PostMessage(msg); client.comm.sndr.PostMessage(msg1); Console.Write("\n"); Console.Write("\n"); Console.Write(" ================================================================================================\n"); Console.Write("\n CLIENT WINDOW\n"); Console.Write("\n ================================================================================================\n"); Console.Write("\n\n Client Sending Files to Repository for the test request---------------->Requirement #2"); Console.Write("\n =======================================================\n"); Client1 clnt = new Client1(); clnt.channel = CreateServiceChannel("http://*****:*****@"../../../Service/DLL/logfile.txt"); System.Console.WriteLine("{0}", text); hrt.Stop(); Console.Write("\n\n total elapsed time for Entire Execution = {0} micro seconds------>Requirement #12.\n", hrt.ElapsedMicroseconds); ((IChannel)clnt.channel).Close(); }