Topic "SFTP file transfer and upload on server"

Author Message
jignesh94268
[View user's profile]

Joined: 2014-03-24
Posts: 2
Location: Richmond, VA
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,
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.

_________________
Martin Prikryl
jignesh94268
[View user's profile]

Joined: 2014-03-24
Posts: 2
Location: Richmond, VA
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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
What error?
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License