public void DisconnectClient(int clientID) { if (clients.ContainsKey(clientID)) { if (clients.TryRemove(clientID, out TcpClient disconnectTcpClient)) { if (disconnectTcpClient.Connected) { try { disconnectTcpClient.Close(); } catch (Exception e) { Console.WriteLine("Error disconnecting TCP client " + clientID + ", " + e.Message); } } } networkHandler.ForgetClient(clientID); } }