private void DrawSocketTcp(SocketTcpRoutine socketTcpRoutine) { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField(socketTcpRoutine.Name, socketTcpRoutine.Connected ? "Connected" : "Disconnected"); EditorGUILayout.LabelField("Network Type", socketTcpRoutine.NetworkType.ToString()); EditorGUILayout.LabelField("Local Address", socketTcpRoutine.Connected ? TextUtil.Format("{0}:{1}", socketTcpRoutine.LocalIPAddress.ToString(), socketTcpRoutine.LocalPort.ToString()) : "Unavailable"); EditorGUILayout.LabelField("Remote Address", socketTcpRoutine.Connected ? TextUtil.Format("{0}:{1}", socketTcpRoutine.RemoteIPAddress.ToString(), socketTcpRoutine.RemotePort.ToString()) : "Unavailable"); EditorGUILayout.LabelField("Send Packet", TextUtil.Format("{0} / {1}", socketTcpRoutine.SendPacketCount.ToString(), socketTcpRoutine.SentPacketCount.ToString())); EditorGUILayout.LabelField("Receive Packet", TextUtil.Format("{0} / {1}", socketTcpRoutine.ReceivePacketCount.ToString(), socketTcpRoutine.ReceivedPacketCount.ToString())); EditorGUI.BeginDisabledGroup(!socketTcpRoutine.Connected); { if (GUILayout.Button("Disconnect")) { socketTcpRoutine.Close(); } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); }
/// <summary> /// 连断开主Socket /// </summary> public void CloseMainSocket() { m_MainSocket.Close(); }