login about faq

I'm using a sftp to download file from server. I want to download multiple file at a time, so I need to create many sftp instances and must call connect and initialize. I wonder if this would make many connections to the server, and reconnect with same authentication many times, is there another better or faster way to to do this?

asked Aug 25 '13 at 05:34

VirtualV's gravatar image

VirtualV
1222


Each instance of an SFTP object has no knowledge of any other instance. Each instance will have it's own connection and would need to authenticate. I don't think there is a better/faster way.

link

answered Aug 26 '13 at 08:54

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Sync would be a one by one download. Async would establish threads to do simultaneous downloads. With a handful, not really any difference, but with hundreds, thruput would be greatly enhanced.

link

answered Aug 26 '13 at 12:40

cdlvj130's gravatar image

cdlvj130
9691017

The API is thread-safe, meaning that for a given object instance, only one call can be active at a time. Therefore, using multiple threads is possible, but each thread should have its own object instance and therefore its own connection.

If, for example, you have 1000 files to download, you could perhaps create 10 threads, each of which would suffer the initial overhead of connecting and authenticating, but once that is done, each thread can download one file after the other without re-connecting or re-authenticating. In other words, it is (of course) possible to download many files one-after-the-other in a single session. You would use multiple threads, each having it's own session, to achieve simultaneous downloads.

link

answered Aug 27 '13 at 11:06

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×201
×9
×3
×1
×1

Asked: Aug 25 '13 at 05:34

Seen: 1,132 times

Last updated: Aug 27 '13 at 11:06

powered by OSQA