/// <summary>
        /// Is called on the click of the server's Listen button
        /// starts the server at the specified port number
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListenButton1_Click(object sender, RoutedEventArgs e)
        {
            string localPort1 = RemotePortTextBox1.Text;
            string endpoint1 = RemoteAddressTextBox.Text + ":" + localPort1 + "/IBasicService";

            try
            {
                server = new ProgHost();
                server.CreateReceiveChannel(endpoint1);
                listBox1.Items.Insert(0, "Started.. Waiting for a Client");
                ListenButton1.IsEnabled = false;
                StopButton.IsEnabled = true;
            }
            catch (Exception ex)
            {
                Window temp = new Window();
                StringBuilder msg = new StringBuilder(ex.Message);
                msg.Append("\nport = ");
                msg.Append(localPort1.ToString());
                temp.Content = msg.ToString();
                temp.Height = 100;
                temp.Width = 500;
                temp.Show();
            }
        }
Exemple #2
0
        /// <summary>
        /// starts the server and keeps listening for the server
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.Title = "BasicHttp Service Host";
            Console.Write("\n  Starting Programmatic Basic Service");
            Console.Write("\n =====================================\n");

            ProgHost server = null;

            try
            {
                server = new ProgHost();
                server.CreateReceiveChannel("http://localhost:4000/IBasicService");
                Console.Write("\n  Started BasicService - Press key to exit:\n");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.Write("\n\n  {0}\n\n", ex.Message);
                Console.ReadKey();
                return;
            }

            server.close();
        }
Exemple #3
0
        /// <summary>
        /// starts the server and keeps listening for the server
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.Title = "BasicHttp Service Host";
            Console.Write("\n  Starting Programmatic Basic Service");
            Console.Write("\n =====================================\n");

            ProgHost server = null;
            try
            {
                server = new ProgHost();
                server.CreateReceiveChannel("http://localhost:4000/IBasicService");
                Console.Write("\n  Started BasicService - Press key to exit:\n");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.Write("\n\n  {0}\n\n", ex.Message);
                Console.ReadKey();
                return;
            }

            server.close();
        }