/// <summary>Disconnects the client and stops all network traffic.</summary> public void Disconnect() { Console.WriteLine($"{tcp?.tcpClient.Client.RemoteEndPoint} has disconnected."); Server.RemoveClient(Id); tcp?.Disconnect(); udp?.Disconnect(); }
public void Disconnect() { if (isConnected) { isConnected = false; tcp?.Disconnect(); udpSend?.Disconnect(); Console.WriteLine("Disconnected from server."); Environment.Exit(-1); } }