public void Close() { if (!this.IsAlive) { return; } this.IsAlive = false; mSocket.Shutdown(SocketShutdown.Both); mSocket.Close(); if (mSendCipher != null) { mSendCipher.Dispose(); } if (mRecvCipher != null) { mRecvCipher.Dispose(); } mBuffer = null; mSendCipher = null; mRecvCipher = null; this.Terminate(); }
/// <summary> /// 销毁方法 /// </summary> public void Dispose() { IsAlive = false; _networkStream.Dispose(); _client.Close(); _encryptor?.Dispose(); _decryptor?.Dispose(); OnDisposing(); }