예제 #1
0
        static void Main(string[] args)
        {
            thread = new Thread(new ThreadStart(() => ThreadRun()));
            thread.IsBackground = true;
            thread.Start();

            TcpListenerSocket tcpListenerSocket = new TcpListenerSocket(12000);

            tcpListenerSocket.Start();
            Console.WriteLine($"tcpListenerSocket.Start().");

            Console.WriteLine($"Press any key to stop server.");
            Console.ReadLine();
            tcpListenerSocket.Stop();
            //Console.ReadLine();
        }
예제 #2
0
        protected override void OnStop()
        {
            // TODO: 在此处添加代码以执行停止服务所需的关闭操作。

            tcpListenerSocket.Stop();
        }