Пример #1
0
        /// <summary>
        /// test the functionality of the client by connecting to the server if available
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.Title = "BasicHttp Client";
            Console.Write("\n  Starting Programmatic Basic Service Client");
            Console.Write("\n ============================================\n");

            string     url    = "http://localhost:4000/IBasicService";
            ProgClient client = new ProgClient();

            while (true)
            {
                try
                {
                    IBasicService svc = client.CreateSendChannel(url);

                    string msg = "This is a test message from client";
                    client.SendMessage(svc, msg);

                    msg = client.GetMessage(svc);
                    Console.Write("\n  Message recieved from Service: {0}\n\n", msg);
                    List <ProjectTree> files = client.GetFilesList(svc, ".", false);
                    //foreach (string file in files)
                    //  Console.WriteLine("{0}\n", file);
                    //client.SetFilesList(svc, files, "server1");
                    break;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception thrown " + ex.Message);
                    Console.WriteLine("Retrying...");
                }
            }
            Console.ReadKey();
        }
Пример #2
0
        /// <summary>
        /// test the functionality of the client by connecting to the server if available
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.Title = "BasicHttp Client";
            Console.Write("\n  Starting Programmatic Basic Service Client");
            Console.Write("\n ============================================\n");

            string url = "http://localhost:4000/IBasicService";
            ProgClient client = new ProgClient();
            while (true)
            {
                try
                {
                    IBasicService svc = client.CreateSendChannel(url);

                    string msg = "This is a test message from client";
                    client.SendMessage(svc, msg);

                    msg = client.GetMessage(svc);
                    Console.Write("\n  Message recieved from Service: {0}\n\n", msg);
                    List<ProjectTree> files = client.GetFilesList(svc, ".", false);
                    //foreach (string file in files)
                    //  Console.WriteLine("{0}\n", file);
                    //client.SetFilesList(svc, files, "server1");
                    break;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception thrown " + ex.Message);
                    Console.WriteLine("Retrying...");
                }
            }
            Console.ReadKey();
        }
Пример #3
0
 /// <summary>
 /// creates a connection to server2 if not already connected by fetching the port number seleted by the user
 /// </summary>
 void getConnection2()
 {
     if (ConnectButton2.IsEnabled)
     {
         server2Port = RemotePortTextBox2.Text;
         endPoint2 = RemoteAddressTextBox2.Text;
         string endpoint = endPoint2 + ":" + server2Port + "/IBasicService";
         try
         {
             if (client == null)
                 client = new ProgClient();
             svcServer2Channel = client.CreateSendChannel(endpoint);
         }
         catch (Exception ex)
         {
             showErrorWindow(ex.Message, server2Port);
         }
     }
 }