static void Main(string[] args) { Console.WriteLine(" The intent of the write client is to stress the database with write operations."); Console.WriteLine(" Write operations - Insert, Delete, Edit name, Edit Description and Add Children."); Console.WriteLine("\n If log option is enabled, messsages are logged to this console window as they are sent."); Console.WriteLine(" If log is enabled result of response is displayed as responses are received from server."); Console.WriteLine(" If log option is disabled, only latency time for each operation is disaplyed on the console window."); Client clnt = new Client(); clnt.processCommandLine(args); bool log_message = clnt.processCommandLineForWriteLog(args); if (log_message) { Console.WriteLine(" (Log option is Enabled for this client)"); } else { Console.WriteLine(" (Log option is Disabled for this client)"); } string localPort = Util.urlPort(clnt.localUrl); string localAddr = Util.urlAddress(clnt.localUrl); Receiver rcvr = new Receiver(localPort, localAddr); string win_title = "Write Client - " + localPort; Console.Title = win_title; Sender sndr = new Sender(clnt.localUrl); // Sender needs localUrl for start message Action client_receive_action = clnt.define_receive_action(rcvr, sndr, log_message, localPort); if (rcvr.StartService()) { rcvr.doService(client_receive_action); } Message msg = new Message(); msg.fromUrl = clnt.localUrl; msg.toUrl = clnt.remoteUrl; Console.WriteLine("\n\n Starting CommService Write client"); Console.Write(" ============================="); Console.Write("\n Write client local url is {0}", msg.fromUrl); Console.Write("\n Attempting to connect to server on {0}\n", msg.toUrl); if (!sndr.Connect(msg.toUrl)) { Console.Write("\n Could not connect to server in {0} attempts, closing application.", sndr.MaxConnectAttempts); sndr.shutdown(); rcvr.shutDown(); return; } Console.WriteLine("\n *****************************\n Going to read messages present in XML file - Write_Client_XML.xml and send them sequentially to server.\n *****************************"); clnt.send_messages(sndr, msg, "./../../../../SavedXMLFiles/Write_Client_XML.xml", log_message); Thread.Sleep(100); msg.content = "done"; sndr.sendMessage(msg); Util.waitForUser(); // shut down this client's Receiver and Sender by sending close messages rcvr.shutDown(); sndr.shutdown(); Console.Write("\n\n"); }
static void Main(string[] args) { Console.WriteLine(" The intent of the demo client is to demonstarte that all the operations of Project-2 can be executed remotely."); Console.WriteLine(" All the request messages stored in /SavedXMLFiles/Demo_Client_XML.xml are sent to server sequentially."); Console.WriteLine(" The Demo_Client_XML.xml file consists of Write operations, Read operations and Persist operations."); Console.WriteLine(" Write operations - Insert, Delete, Edit Name, Edit Description and Add Children"); Console.WriteLine(" Read operations - Get Value, Get Children, Get Keys with string pattern in metadata"); Console.WriteLine(" PErsist operations - Persist database, Load Database"); Console.WriteLine("\n The DB contents are displayed on the server only in case of demo client to show the successful operations on DB."); Console.WriteLine(" These are displayed to show to user that operations are successfully performed on the database."); Console.WriteLine("\n ******************\n To launch the readers and writers enter any key on the TestExecutive window."); Console.WriteLine(" You can verify all types of operations done and displayed on server window, before launching readers and writers."); Console.Write("\n Starting CommService for demo client"); Console.Write("\n ================================\n"); Thread.Sleep(1000); bool log_message = true; Client clnt = new Client(); clnt.processCommandLine(args); Receiver rcvr = new Receiver(Util.urlPort(clnt.localUrl), Util.urlAddress(clnt.localUrl)); string win_title = "Demo Client - " + Util.urlPort(clnt.localUrl); Console.Title = win_title; Action client_receive_action = clnt.define_receive_action(rcvr, log_message); if (rcvr.StartService()) { rcvr.doService(client_receive_action); } Sender sndr = new Sender(clnt.localUrl); // Sender needs localUrl for start message Message msg = new Message(); msg.fromUrl = clnt.localUrl; msg.toUrl = clnt.remoteUrl; Console.Write("\n Demo client local url is {0}", msg.fromUrl); Console.Write("\n Attempting to connect to server on {0}\n", msg.toUrl); if (!sndr.Connect(msg.toUrl)) { Console.Write("\n could not connect in {0} attempts", sndr.MaxConnectAttempts); sndr.shutdown(); rcvr.shutDown(); return; } clnt.send_messages(sndr, msg, "./../../../../SavedXMLFiles/Demo_Client_XML.xml", log_message); Thread.Sleep(100); msg.content = "done"; sndr.sendMessage(msg); // Wait for user to press a key to quit. Ensures that client has gotten all server replies. Util.waitForUser(); // shut down this client's Receiver and Sender by sending close messages rcvr.shutDown(); sndr.shutdown(); Console.Write("\n\n"); }
static void Main(string[] args) { Console.WriteLine(" The intent of the read client is to stress the database with read operations.\n Read operations - Get DBElement with key, Get children of DBElement, Get keys of DBElements with particular pattern."); Console.WriteLine("\n If partial log option is enabled, only a partial part of the response messsage is logged to this console window.(latency and part of result)\n If Partial log option is not enabled, entire result is displayed on the GUI."); Console.WriteLine(" For all requests, latency time for each message is displayed on this window and WPF GUI."); Console.WriteLine(" Once all request messages are received, average latency times are updated in WPF GUI."); Client clnt = new Client(); clnt.processCommandLine(args); bool log_message = true; if (clnt.processCommandLineForPartialLog(args)) { log_message = false; } if (!log_message) { Console.WriteLine(" (Partial log option is enabled for this client)"); } else { Console.WriteLine(" (Partial log option is not enabled for this client.)"); } Console.Write("\n Starting CommService Read client"); Console.Write("\n =============================\n"); string localPort = Util.urlPort(clnt.localUrl); string localAddr = Util.urlAddress(clnt.localUrl); Receiver rcvr = new Receiver(localPort, localAddr); string win_title = "Read Client - " + localPort; Console.Title = win_title; Sender sndr = new Sender(clnt.localUrl); // Sender needs localUrl for start message Action client_receive_action = clnt.define_receive_action(rcvr, log_message, sndr, localPort); if (rcvr.StartService()) { rcvr.doService(client_receive_action); } Message msg = new Message(); msg.fromUrl = clnt.localUrl; msg.toUrl = clnt.remoteUrl; Console.Write("\n sender's url is {0}", msg.fromUrl); Console.Write("\n attempting to connect to {0}\n", msg.toUrl); if (!sndr.Connect(msg.toUrl)) { Console.Write("\n could not connect in {0} attempts", sndr.MaxConnectAttempts); sndr.shutdown(); rcvr.shutDown(); return; } Console.WriteLine("\n *****************************\n Going to read messages present in XML file - Read_Client_XML.xml and send them sequentially to server.\n *****************************"); clnt.send_messages(sndr, msg, "./../../../../SavedXMLFiles/Read_Client_XML.xml", log_message); Thread.Sleep(100); msg.content = "done"; sndr.sendMessage(msg); Util.waitForUser(); rcvr.shutDown(); sndr.shutdown(); Console.Write("\n\n"); }