Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 销毁方法
 /// </summary>
 public void Dispose()
 {
     IsAlive = false;
     _networkStream.Dispose();
     _client.Close();
     _encryptor?.Dispose();
     _decryptor?.Dispose();
     OnDisposing();
 }