Thanks for sharing your solution.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
// Set up session options
SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Sftp,
HostName = _hostName,
UserName = _userName,
Password = _password,
SshHostKeyFingerprint = _sshHostKey,
using (Session session = new Session())
// Will continuously report progress of synchronization
session.FileTransferred += FileTransferred;
// Attempt to loop through opening the session three times.
int loop = 0;
while (loop < 3)
// Open session. Break out of loop if successful
catch (SessionRemoteException e)
//Increment the loop and wait 5 seconds. If three failed attempts, throw an exception
if (loop >= 3) throw e;
catch (Exception e)
// All other exceptions, pass e up to parent catch