Renci.SshNet.BaseClient.Disconnect C# (CSharp) Method

Disconnect() public method

Disconnects client from the server.
The method was called after the client was disposed.
public Disconnect ( ) : void
return void
        public void Disconnect()
        {
            DiagnosticAbstraction.Log(string.Format("{0} Disconnecting client", DateTime.Now.Ticks));

            CheckDisposed();

            OnDisconnecting();

            // stop sending keep-alive messages before we close the
            // session
            StopKeepAliveTimer();

            // disconnect and dispose the SSH session
            if (Session != null)
            {
                // a new session is created in Connect(), so we should dispose and
                // dereference the current session here
                Session.ErrorOccured -= Session_ErrorOccured;
                Session.HostKeyReceived -= Session_HostKeyReceived;
                Session.Dispose();
                Session = null;
            }

            OnDisconnected();
        }