public void Close() { if (!isUse) { return; } if (player != null) { player.Logout(); return; } Console.WriteLine("[断开连接]" + GetAddr()); socket.Shutdown(SocketShutdown.Both); socket.Close(); isUse = false; }
/// <summary> /// Close the conn. /// </summary> public void Close() { if (isUse == false) { return; } if (player != null) { player.Logout(); return; } Console.WriteLine("[Conn.Close] Disconnect with " + GetAddress()); socket.Shutdown(SocketShutdown.Both); socket.Close(); isUse = false; }