Dispose() public method

public Dispose ( ) : void
return void
Beispiel #1
0
        private bool closeConnection()
        {
            _readyState = WsState.CLOSED;

            try
            {
                if (!_httpContext.IsNull())
                {
                    _httpContext.Response.Close();
                    _wsStream    = null;
                    _httpContext = null;
                }

                if (!_wsStream.IsNull())
                {
                    _wsStream.Dispose();
                    _wsStream = null;
                }

                if (!_tcpClient.IsNull())
                {
                    _tcpClient.Close();
                    _tcpClient = null;
                }

                return(true);
            }
            catch (Exception ex)
            {
                onError(ex.Message);
                return(false);
            }
        }
Beispiel #2
0
        // As Client
        private void closeResourcesAsClient()
        {
            if (!_wsStream.IsNull())
            {
                _wsStream.Dispose();
                _wsStream = null;
            }

            if (!_tcpClient.IsNull())
            {
                _tcpClient.Close();
                _tcpClient = null;
            }
        }