/// <summary> /// 断开链接 /// </summary> private void CloseSocket() { _tcpReceiver?.CloseReceiver(); _tcpReceiver = null; if (this.clientSocket != null && this.clientSocket.Connected) { this.clientSocket.Close(); } }
/// <summary> /// 断开链接 /// </summary> private void CloseSocket() { _tcpReceiver?.CloseReceiver(); _tcpReceiver = null; if (this.tcpSocket != null && this.tcpSocket.Connected) { this.tcpSocket.Close(); this.tcpSocket = null; } if (null != this.udpRecvThread) { udpRecvThread.Interrupt(); udpRecvThread.Abort(); udpRecvThread = null; } if (this.udpSocket != null && this.udpSocket.Connected) { this.udpSocket.Close(); this.udpSocket = null; } }