async DL question

Suppose you have URI's for a bunch of files you want to download (eg, between 10 and 100), and they're in a TWebListBox named LBox. They could be images, audio files, text files, whatever, but each under 50kb or so (as opposed to, say, huge video files).

I want to iterate over the list, initiate a Download on LBox.Items and have them all running in parallel, maybe up to some limit, like 5 at a time. When each has completed downloading, attach it to the LBox.Objects slot corresponding to the Item.

How would this be written in WEB Core? The tasking and connectivity seems to be there already, so offhand it seems like it would be simpler. I'm just unclear how to express it in code.

Use multiple TWebHttpRequest instances. Launch download via each of these instances.
Handle result in WebHttpRequest.OnRequestResponse()
Browser will manage asynchronous downloads in parallel and trigger OnRequestResponse with download result when each is ready.

1 Like