private void StopServer(InternalServer server) { server.Connected -= OnConnected; server.Message -= OnMessage; server.Disconnected -= OnDisconnected; server.Dispose(); }
public void Dispose() { if (!IsDisposed) { IsDisposed = true; if (InternalServer != null && InternalServer.Connected) { InternalServer.Disconnect(false); } InternalServer?.Dispose(); InternalServer = null; } }