B4J Question Limit max concurrent requests in HTTPUtils?

Kevin

Well-Known Member
Licensed User
Longtime User
I wrote an app in B4J that retrieves a list of folders and files on a FlashAir WiFi SD card and downloads them. For the most part everything is working fine, but I noticed that if I sent a high number of download requests (these are all through http urls) back to back (say, over 90) that the program would just stall out and eventually I would start getting timeouts. The end result was that nothing would get downloaded other than maybe a few files.

I chalked this up to the FlashAir being overwhelmed by too many consecutive or concurrent requests so I limited the number of files that a user could select at a time. Worked fine for me. But someone else with the same FlashAir card and a more powerful computer is having this problem with just 30 or so files to download.

Is there a way I can limit the max number of concurrent requests in the core HTTPUtils library? I know I could try to track this myself and send more requests as results come back but I was wondering if there may be an easier way.
 

Daestrum

Expert
Licensed User
Longtime User
Could you not create a list of files to download, start the first one, then as each completes, submit the next one until the list is empty.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
That is the solution I will likely need to use, but I figured if there were a way to set a limit directly that it would be a "one-line" fix. :D
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
If it doesn't help then use a list and download the files one after another.

Good to know the 5 concurrent request limit. It turned out to be a problem related to my submitting the download jobs as I was going through a list in a nested For...Next loop. I think it was just too much to handle at once. I now go through the loops first and send the requests afterwards and this has solved it.

Thanks!
 
Upvote 0
Top