Пример #1
0
        private static void StopProtocol(IServer Server)
        {
            try
            {
                Server.Stop();

                Console.WriteLine(@"服务器已关闭。");
            }
            finally
            {
                Server.Dispose();
            }
        }
Пример #2
0
        public void Dispose()
        {
            _logger = null;

            if (_server is null)
            {
                return;
            }

            _server.OnClientConnection -= _server_OnClientConnection;
            _server.OnException        -= _server_OnException;
            _server.Dispose();
            _server = null;
        }