BackgroundDownloader only downloading 5 at once

假装没事ソ 提交于 2019-12-13 04:31:57

问题


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?


回答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();



回答2:


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>



来源:https://stackoverflow.com/questions/30388196/backgrounddownloader-only-downloading-5-at-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!