Hello,
I am using Renci.SshNet for SSH.
I am already using this for "sending to" (UploadFile()) and "pulling from" (DownloadFile()) files in the production system with no problems.
I am testing now sending a file to the Test site, and it is "hanging" there indefinitely after the Connect call..
I even tried to set a timeout (OperationTimeout), to no avail.
Here is the code
I am using Renci.SshNet for SSH.
I am already using this for "sending to" (UploadFile()) and "pulling from" (DownloadFile()) files in the production system with no problems.
I am testing now sending a file to the Test site, and it is "hanging" there indefinitely after the Connect call..
I even tried to set a timeout (OperationTimeout), to no avail.
Here is the code
bool uploadFile(String long_filename, String short_filename)
{
bool success = false;
using (var sftp = new SftpClient(server, user, passw))
{
sftp.OperationTimeout = new TimeSpan(0, 0, 30); // 30 seconds
// I see this..
showMessage("Connecting..");
sftp.Connect();
// .. but don't see this..
showMessage("Connected..");
// Move to POLP-To-FDC directory when uploading..
sftp.ChangeDirectory(@"/POLP-To-FDC/");
showMessage("Moved to dir..");
// upload the file
using (var filestream = File.OpenRead(long_filename))
{
sftp.UploadFile(filestream, short_filename, false);
showMessage("Uploaded file..");
success = true;
}
showMessage("isconnecting..");
sftp.Disconnect();
} // end using
return success;
}