Robert February 2016

Simultaneous Downloads

I am trying to build an mobile app (iOS and Windows) that downloads a list of audio files from remote server.

Is there any criteria one needs to consider before using different threads for downloading the files concurrently. (Basically i need to download 7 files concurrently.)

I found in case of iOS there is a parameter

"NSOperationQueueDefaultMaxConcurrentOperationCount" which decides the count of concurrent operations allowed. Is there any other parameter that i need to consider while developing for iOS/Windows

Kindly guide me , i am newbie to mobile development.

Regards Robert

Answers


Pete February 2016

Interestingly here it states that NSOperationQueueDefaultMaxConcurrentOperationCount that the maximum number of download operations is managed by the kernel at runtime, so that this value can change dynamically through application usage. I imagine should a download not be possible however, an exception would be thrown, to which you could handle.

On WindowsPhone 8 the maximum limit is 6 active requests at one time from here.

For WindowsPhone 8.1 / UWP you could use the BackgroundDownloader, and let that manage things for you. There is a reported limit of only 5 simultaneous downloads occuring from here.

Despite platform specifics that may limit / open up the simultaneous download connections, I would create your own DownloadManager class that allowed you to keep adding download tasks to, regardless of the current download queue. This manager class would then be able to handle the entire download process for you, including error handling and tracking on specific downloads / kicking off new downloads / notifications of downloads completed / failed.

Within it you could also set your own limits for the amount of simultaneous connections, and base the starting values on what ever values you wanted per platform, of course within OS restrictions.

To be on the safe side, you probably never want to use the maximum number of concurrent downloads available, and use a few less, so

Post Status

Asked in February 2016
Viewed 3,065 times
Voted 5
Answered 1 times

Search




Leave an answer