Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Answered: Rebex.Net.SftpException: The connection was closed by the server.

$
0
0

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's Status 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.

Viewing all articles
Browse latest Browse all 3862

Trending Articles