Please modify IsConnected property of SFTP object
Please modify IsConnected property of SFTP object which with check internally and reply that Server is Connected or Not. As you suggested that in your document , i need to write code sftp.Getfies(".") and Check it. It is very redundant code where i have property isConncted.
We already provide Sftp.GetConnectionState method which mostly does what your suggested IsConnected property would do.
-
AdminLukas Pokorny (Admin, Rebex) commented
To do this, we would have to make IsConnected property actually send something to the server and receive reply - this is the only reliable way to make sure the connection is still active and usable. Even though, this would still not guarantee that GetFiles would succeed - the connection could be lost between the IsConnected call and GetFiles call, which means you still have to try/catch SftpException when calling GetFiles.
In any case, we already have Sftp.GetConnectionState method which mostly does what your suggested IsConnected property would do.