Question

I have a weird problem. I'm using pscp.exe from within a C# program (with process.start) to upload files to an SFTP server. Now I have set up a new server with the same program, where I upload to the same SFTP server as before, but It runs incredibly slow in the new server.

The weird thing is that when I try uploading the files manually via FileZilla, the upload goes as fast as expected, but not when using the program.

Can anyone explain this? Am I missing something obvious like a windows setting or something?

Was it helpful?

Solution 2

I ended up rewriting the SFTP transfer to use the .Net wrapper for WinSCP in stead. The solution was fast, and the file transfer also. Here's a link to the documentation.

OTHER TIPS

SSH supports what we call pipelining - sending multiple SSH packets without waiting response to each packet. OpenSSH supports this functionality, while Putty doesn't (at least didn't until recently). That's what you observe. Another reason is choice of algorithms. If AES is negotiated, it's faster than DES and 3DES used by default by older applications.

Uploading files using WinSCP is like 10 times faster.

To do that from command line, first you got to add the winscp.com file to your %PATH%. It's not a top-level domain, but an executable .com file, which is located in your WinSCP installation directory.

Then just issue a simple command and your file will be uploaded much faster putty ever could:

WinSCP.com /command "open sftp://username:password@example.com:22" "put your_large_file.zip /var/www/somedirectory/" "exit"

And make sure your check the synchronize folders feature, which is basically what rsync does, so you won't ever want to use pscp.exe again.

WinSCP.com /command "help synchronize"

Filezilla can use multiple concurrent connections and reuse open connections. I believe PSCP is a relatively simple application.

A library like SFTP.NET will probably yield better results than running a child pscp process.

It would also help to use the ZipPackage to compress the files when sending them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top