Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            HproseTcpListenerServer tcpserver = new HproseTcpListenerServer("tcp4://127.0.0.1:4321/");

            tcpserver.Filter = new MyServerFilter();
            tcpserver.Add("Inc", typeof(Program));
            tcpserver.Start();
            Console.ReadKey();
            tcpserver.Stop();
        }
Ejemplo n.º 2
0
        private void StopTcpButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(sender is Button button))
            {
                return;
            }


            button.IsEnabled = false;
            TcpServer.Stop();
            ListBoxServerMsg.Items.Insert(0, "Tcp服务关闭成功:" + DateTime.Now.ToString());
            StarTcptButton.IsEnabled = true;
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            HproseTcpListenerServer tcpserver = new HproseTcpListenerServer("tcp4://127.0.0.1:4321/");

            tcpserver.Add("Hello", typeof(Program));
            tcpserver.Start();
            HproseHttpListenerServer httpserver = new HproseHttpListenerServer("http://localhost:8888/");

            httpserver.Add("Hello", typeof(Program));
            httpserver.Start();
            Console.ReadKey();
            tcpserver.Stop();
            httpserver.Stop();
        }
Ejemplo n.º 4
0
 public static void Stop()
 {
     try
     {
         if (tcpserver != null && tcpserver.IsStarted)
         {
             tcpserver.Stop();
         }
         writeLog("服务已停止");
     }
     catch (Exception ex)
     {
         writeLog(string.Format("服务停止异常,信息:{0}", ex.Message));
     }
 }