0

I create 1,000 downloads using BackgroundDownloader.CreateDownload, then I queue up 100 of them by doing DownloadOperation.Start. If I watch the traffic in fiddler, only 5 of them at actually send out at once. When one finishes, another is sent out.

Is there a way to have more sent out concurrently?

Josh Close
  • 22,935
  • 13
  • 92
  • 140

2 Answers2

1

Yes, there is a limit of 5 downloads at a time within Windows.Networking.BackgroundTransfer.

You can extend it to up to 6 downloads at a time if you mark all your downloads as High Priority, i.e.:

var download = backgroundDownloader.CreateDownload(...);
download.Priority = BackgroundTransferPriority.High;
Task<DownloadOperation> task = download.StartAsync(...).AsTask();
kiewic
  • 15,852
  • 13
  • 78
  • 101
  • There is no way to change that? Getting 1 more really doesn't help me. Also, how do you know for sure there is a hard limit at 5? – Josh Close May 22 '15 at 20:39
  • There is no way to change it, why do you want to have more than 5-6 concurrent downloads? – kiewic May 23 '15 at 13:40
  • It's faster. The the same files downloading on iOS and Android see significantly faster overall download time when the number of concurrent downloads is increased. Right now the WinRT version of the app is many times slower than the other 2 platforms. – Josh Close Jun 02 '15 at 05:35
0

This could be a limitation of the server you are downloading from, not necessarily the code you are writing. With .htaccess rules the admin of the server could do something like this in order to limit concurrent connections: MaxClients < number-of-connections>

rii
  • 1,578
  • 1
  • 17
  • 22
  • This seems unlikely. The files are hosted on Amazon. – Josh Close May 22 '15 at 04:20
  • You are correct, some research indicates amazon does not cap that. – rii May 22 '15 at 04:33
  • Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files. Reference: https://msdn.microsoft.com/en-us/library/windows/apps/hh701024.aspx – rii May 22 '15 at 04:36
  • They are all different files and urls. – Josh Close May 22 '15 at 04:52
  • Hmm, well I know most browsers limit concurrent connections to 5 or so, but if you are having concurrency issues outside the browser then I am not sure where the cap is being imposed. – rii May 22 '15 at 05:12