Exemple #1
0
            public void Dispose()
            {
                RawReceiveStream?.Dispose();
                SendStream?.Dispose();
                ReceiveStream?.Dispose();

                _webSocket?.Dispose();
            }
        public void Dispose()
        {
            SendStream?.Dispose();
            SendStream = null;

            ReceiveStream?.Dispose();
            ReceiveStream = null;

            _socket?.Dispose();
            _socket = null;
        }
Exemple #3
0
        public void Dispose()
        {
            try
            {
                SendStream?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                SendStream = null;
            }

            try
            {
                ReceiveStream?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                ReceiveStream = null;
            }

            try
            {
                _socket?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                _socket = null;
            }
        }
Exemple #4
0
        public void Dispose()
        {
            var oneStreamIsUsed = SendStream != null && ReceiveStream != null && ReferenceEquals(SendStream, ReceiveStream);

            try
            {
                SendStream?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                SendStream = null;
            }

            try
            {
                if (!oneStreamIsUsed)
                {
                    ReceiveStream?.Dispose();
                }
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                ReceiveStream = null;
            }

            try
            {
                _sslStream?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                _sslStream = null;
            }

            try
            {
                _socket?.Dispose();
            }
            catch (ObjectDisposedException)
            {
            }
            catch (NullReferenceException)
            {
            }
            finally
            {
                _socket = null;
            }
        }