//----< run client demo >---------------------------------------- static void Main(string[] args) { Console.Write("\n Client "); Console.Write("\n =====================\n"); Client client = new Client(); Message msg = client.makeMessage("Karthik", client.endPoint, client.endPoint); msg = client.makeMessage("Karthik", client.endPoint, client.endPoint); msg.body = MessageTest.makeTestRequest(); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8088); msg = msg.copy(); msg.to = remoteEndPoint; string author = EncryptMessage(msg.author); string body = EncryptMessage(msg.body); msg.body = body; msg.author = author; client.comm.sndr.PostMessage(msg); Console.Write("\n press key to exit: "); Console.ReadKey(); msg.to = client.endPoint; msg.body = "quit"; // client.comm.sndr.PostMessage(msg); client.wait(); Console.Write("\n\n"); }
//----< run client demo >---------------------------------------- static void Main(string[] args) { Console.Title = "Client 1 Console"; Console.Write("\n Testing Client Demo"); Console.Write("\n =====================\n"); Client clnt = new Client(); clnt.comm.sndr.channel = Sender.CreateServiceChannel("http://localhost:8082/StreamService"); HiResTimer hrt = new HiResTimer(); hrt.Start(); clnt.comm.sndr.uploadFile("TestDriver.dll"); clnt.comm.sndr.uploadFile("TestedCode.dll"); hrt.Stop(); Console.WriteLine("\n**********************************************************************"); Console.WriteLine("\nDemonstrating requirement 12 latency"); Console.Write( "\n\n total elapsed time for uploading = {0} microsec.\n", hrt.ElapsedMicroseconds ); Message msg = clnt.makeMessage("Brahma", clnt.endPoint, clnt.endPoint); msg.type = "TestRequest"; msg = clnt.makeMessage("Brahma", clnt.endPoint, clnt.endPoint); msg.body = MessageTest.makeTestRequest(); Console.WriteLine("\n**********************************************************************"); Console.WriteLine("\n Demonstrating requirement 2 : XML messages"); msg.showMsg(); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080); msg = msg.copy(); msg.to = remoteEndPoint; clnt.comm.sndr.PostMessage(msg); string repository = Comm <Client> .makeEndPoint("http://localhost", 8082); msg = clnt.makeMessage("Brahma", clnt.endPoint, repository); msg.type = "testlogs"; msg.body = "brahma"; clnt.comm.sndr.PostMessage(msg); Console.Write("\n press key to exit: "); Console.ReadKey(); msg.body = "quit"; clnt.comm.sndr.PostMessage(msg); msg.showMsg(); Console.Write("\n\n Press key to terminate client"); Console.ReadKey(); Console.Write("\n\n"); clnt.wait(); ((IChannel)clnt.comm.sndr).Close(); Console.Write("\n\n"); }