Akka.Interfaced.SlimSocket.Client.TcpConnection.Close C# (CSharp) Method

Close() public method

public Close ( int reason ) : void
reason int
return void
        public void Close(int reason = 0)
        {
            _logger?.TraceFormat("Closed From {0}", _remoteEndPoint);

            if (_state == TcpState.Connected || _state == TcpState.Closing)
            {
                _client.Close();

                _state = TcpState.Closed;

                if (Closed != null)
                    Closed(this, reason);
            }
        }

Usage Example

        public override void Close()
        {
            _logger?.Info("Close.");

            SetState(ChannelStateType.Closed);
            _tcpConnection?.Close();
        }