0 votes
by (120 points)
edited

Hi,

I'm using Rebex Sftp component to perform a long time job on the server. This job should be able to recover after server/network errors. First, I tried to call SftpClient.Connect second time (after failure), this didn't help. Then I tried to disconnects and dispose a broken SftpClient, create new, connect and continue with the new one. Now I could connect to the server successfully, but when I called PutFile I got an exception with the message "Failure; Failure".

What should I do to be able to recover after network falures? Many thanks.

Applies to: Rebex SFTP

1 Answer

0 votes
by (148k points)
edited

Disconnecting or disposing the broken SFTP object and connecting again using a new one (which is exactly what you do) should work fine.

It actually looks like you were able to successfully connect and authenticate and it only failed when PutFile was called. The "failure" message comes from the SFTP server and it is not very helpful, unfortunately. Were you trying to upload the same file as before? It is possible that the server is still not aware that the previous session is over and keeps the file locked not available to be open again. Hopefully it will free the file after several minutes. Are you able to upload to a different filename instead?

by (120 points)
Thanks, that works. It was a server failure...
...