login about faq

Do you have any examples, comments, features, etc. relating to using a persistent connection to optimize multiple downloads? I'm looking at a situation where I may be downloading a lot of small image thumbnails, maybe 100 or 200 at a time. I guess under HTTP 1.1 persistency is sort of assumed, but it isn't clear to me how that would play out with multiple, say, CkHttp_Download() calls.

asked Oct 24 '12 at 12:46

chilkat's gravatar image

chilkat ♦♦

A Chilkat HTTP object instance will keep a connection open after sending a request - assuming that it can. Of course, if the server closes its side of the connection, then the HTTP object will automatically re-connect on the next method call that requires a connection. The HTTP object will also close the connection if the HTTP response includes a "Connection: Close" header.

Therefore, if the multiple downloads are from the same web site, then the Chilkat HTTP object will probably use the same connection for all of them. There's no difference in the coding in the application. A call to the http.Download method within a loop will automatically establish the connection if needed, or use the existing connection if possible.

To gain even greater throughput, you could design an app that uses multiple HTTP object instance simultaneously. For example, you could create a multi-threaded program with a main controller thread and multiple background threads. The main thread could have a list of download URLs, and it could pass the next URL to a background thread when it is ready for another. You would have to work out the details, but it shouldn't be that difficult.


answered Oct 24 '12 at 13:45

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: Oct 24 '12 at 12:46

Seen: 2,192 times

Last updated: Oct 24 '12 at 13:45

powered by OSQA