Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: SFTP file transfer and upload on server

OK, seeing you email.

You create new Session instance on every call to GetSFTP, yet you connect it on the first call only (see makeConnection parameter).
Either reuse Session instance across runs (preferred) or connect on every call.

Anyway, this is general programming issue, so it's out of scope of this forum.
martin

Re: SFTP file transfer and upload on server

What error?
jignesh94268

Re: SFTP file transfer and upload on server

I am able to connect with server and getting file also...i am getting error when i am trying to download files from two different folder ...is there any way i can download file from folder and sub folder ....


using (Session session = new Session())
{
session.DisableVersionCheck = true;

// Will continuously report progress of synchronization
session.FileTransferred += FileTransferred;

GetSFTP(sessionOptions.HostName, sessionOptions.UserName, sessionOptions.Password, sessionOptions.PortNumber, sessionOptions.SshHostKeyFingerprint,
"/response/test/", "C:\\test\\", true);

GetSFTP(sessionOptions.HostName, sessionOptions.UserName, sessionOptions.Password, sessionOptions.PortNumber, sessionOptions.SshHostKeyFingerprint,
"/response/test/query-only/", "C:\\test\\", false);

//SynchronizationResult synchronizationResult;
//synchronizationResult = session.SynchronizeDirectories(SynchronizationMode.Remote, @"c:\submission\", "/000045846/submission/test/", false, false, SynchronizationCriteria.Time, null);

// Throw on any error
//synchronizationResult.Check();

session.SessionLogPath = "C:\\Log\\Log.txt";

}
martin

Re: SFTP file transfer and upload on server

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.
jignesh94268

SFTP file transfer and upload on server

Hello,

I am trying to write a code in C# to download files from remote server and uploading the file on to remote server.. when i try to do that using code its showing me error of" server time out".. i am not able to connect with the server, can anyone help me with this please,

Thanks,