This looks like the server (or a router along the way) closes the connection after a period of inactivity. There are several solutions to this:
- Use try/catch blocks to detect this issue (use
SftpException
object'sStatus
property to determine whether the connection was closed) and react accordingly (reconnect and retry the operation). - Prevent the server (or a router along the way) from disconnecting the session by calling
Sftp.Settings.KeepAlive
method periodically (see the forum post on KeepAlive for sample code). - Configure the server (or router along the way) not to disconnect SFTP/SSH sessions after a period of inactivity.