This project is read-only.

SftpClient Disconnected event

Jan 31, 2012 at 10:24 AM

After calling  SftpClient.Disconnect(); method,  testing   IsConnected  value i expected the value go from true to false but this seems not occur even waiting a certain time:

                    while (_sftp.IsConnected)
                        Console.Write("\n sftp disconnecting... : ");

                    Console.Write("\n sftp server disconnected! : ");

    _sftp.IsConnected value is keeping True

How  can i test correctly the Disconnected condition with sftpClient,  maybe have i done  something wrong?

Any suggestions?

Thank you.

Jan 31, 2012 at 9:44 PM

The best approach would be to handle an disconnect event but I did not provide such events so far.


If you have source version you can easly add an event and raise it from protected OnDisconnecting method, this is the one that called when client disconnecting.


Hope it helps.




Feb 1, 2012 at 8:18 AM

Yes, just for this reason i think  the public method  IsConnected()  exposed by SftpClient class is not working as well,

maybe a possible bug?   Thanks.

Feb 1, 2012 at 2:10 PM



I'll try to take a look at it as soon as I have some free time.