/// <summary> /// 断开与服务器的连接 /// </summary> private void CloseConnectionWithServer() { //先关闭和数据库的连接 ConnHelper.CloseConnetcion(MysqlConn); if (_clientSocket != null) { //关闭与服务器的连接,并从服务器连接客户端列表中移除 _clientSocket.Close(); _currentServer.RemoveClientFromClientList(this); } if (currentEnteredRoom != null) { //移除该Client的房间 currentEnteredRoom.Close(this); } }