private static void StopProtocol(IServer Server) { try { Server.Stop(); Console.WriteLine(@"服务器已关闭。"); } finally { Server.Dispose(); } }
public void Dispose() { _logger = null; if (_server is null) { return; } _server.OnClientConnection -= _server_OnClientConnection; _server.OnException -= _server_OnException; _server.Dispose(); _server = null; }