This project is read-only.

Exception on Disconnect "An established connection was aborted by the software in your host machine"

Feb 20, 2015 at 3:17 AM
I'm getting a SocketException when calling Disconnect().

I dug through the code and can see what's happening:
In BaseClient.cs we have this:
    public void Disconnect()
    {
        ...

        OnDisconnecting(); // <--- This call actually ends up disposing of the SFTP sesssion
        StopKeepAliveTimer();
        if (Session != null) // <-- This object is not yet null, but the underlying session is disposed of
        {
            ...
            Session.Disconnect(); // <-- This call tries to send a message to the server that the client is causing the disconnect
            ...
        }
    }
It appears that there is a missing "Disconnect" call on the SftpClient.cs class or that the code which informs the remote server of the client disconnect reason needs to be moved to earlier in the code.

Feedback please.

Thanks,
Mike