コード例 #1
0
        // send message button fucntionality
        private void SendMessageButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SendButton.IsEnabled = false;
                ClientFileManager fileManager = new ClientFileManager();
                //////// Implementing code for sending DLL's to repository before sending the test request.

                fileManager.client_Manager("client1");

                // creating messages to send to Test Harness Server
                Messages msg = makeMessage("nik", endPoint, endPoint);
                string   TestHarnessEndPoint = Comm <MainWindow> .makeEndPoint("http://localhost", 8080);

                msg.toUrl           = TestHarnessEndPoint;
                msg.command         = "TestRequest";
                msg.message_content = ClientMessages.makeTestRequestClient1();
                listBox1.Items.Insert(0, msg);
                if (listBox1.Items.Count > MaxMsgCount)
                {
                    listBox1.Items.RemoveAt(listBox1.Items.Count - 1);
                }
                comm.sndr.PostMessage(msg);
            }
            catch (Exception ex)
            {
                Window temp = new Window();
                temp.Content = ex.Message;
                temp.Height  = 100;
                temp.Width   = 500;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                Console.Write("\n CLIENT");
                Console.Write("\n =====================\n");
                Client client = new Client(); // by calling its constructor, the client starts listening on port 8081
                // And a reciever thread gets ready retrieving messages from Receiver Blocking Queue
                client.initialize();
                ClientFileManager fileManager = new ClientFileManager();
                //////// Implementing code for sending DLL's to repository before sending the test request.
                // before sending test request to Test Harness, client_Manager will upload files to Repository
                fileManager.client_Manager("client");
                // creating messages to send to Test Harness Server
                Messages msg = client.makeMessage("Pranjul", client.endPoint, client.endPoint);
                string   TestHarnessEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080);

                msg.toUrl           = TestHarnessEndPoint;
                msg.command         = "TestRequest";
                msg.message_content = ClientMessages.makeTestRequest();
                " [[ Displaying Requirement 2 and 6 (Test Request) ---->>> XML Body sent as a Request specifies, DLL's to execute  ]]".title('=');
                msg.show();
                Console.WriteLine("----------------------------------------------------------------------------------");
                client.comm.sndr.PostMessage(msg);

                (" [[ Displaying Requirement 9--> requesting files from repository]]").title('=');
                Messages msgToRepo          = client.makeMessage("Client-Logs_Repository", client.endPoint, client.endPoint);
                string   RepositoryEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8082);

                msgToRepo.toUrl   = RepositoryEndPoint;
                msgToRepo.command = "SendAllLogs";
                msgToRepo.show();
                client.comm.sndr.PostMessage(msgToRepo);
                client.receiveFiles();
                Console.ReadKey();
                client.wait();
                Console.Write("\n\n");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception caught {0}", ex.Message);
            }
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            try
            {
                Console.Write("\n CLIENT2");
                Console.Write("\n =====================\n");

                Client2 client2 = new Client2();

                ClientFileManager fileManager = new ClientFileManager();
                //////// Implementing code for sending DLL's to repository before sending the test request.

                fileManager.client_Manager("client2");

                // creating messages to send to Test Harness Server
                Messages msg = client2.makeMessage("Ashu", client2.endPoint, client2.endPoint);
                string   TestHarnessEndPoint = Comm <Client2> .makeEndPoint("http://localhost", 8080);

                msg.toUrl           = TestHarnessEndPoint;
                msg.command         = "TestRequest";
                msg.message_content = ClientMessages.makeTestRequestClient2();
                " [[ Displaying Requirement 2 and 6 (Test Request)---->>> XML Body sent as a part of Request and specifies DLL's to execute  ]]".title('=');
                msg.show();
                Console.WriteLine("----------------------------------------------------------------------------------");
                client2.comm.sndr.PostMessage(msg);

                Console.ReadKey();

                Console.Write("\n  press key to exit: ");
                Console.ReadKey();

                client2.wait();
                Console.Write("\n\n");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception caught {0}", ex.Message);
            }
            Console.ReadKey();
        }