This project is read-only.


Why 2 jobs don't downloaded in parallel


Hi all, I'm using SharpBITS to download 2 files and i want them to be downloaded in parallel.
my code.
first I'm initializing the BitsManager:

_bitsManager = new BitsManager();
            _bitsManager.OnJobTransferred += bitsJob_OnJobTransferred;
            _bitsManager.OnJobError += bitsJob_OnJobError;
            _bitsManager.OnJobModified += bitsJob_OnJobModified;
Then I create 2 new jobs.

var bitsJob = _bitsManager.CreateJob("NAME1", SharpBits.Base.JobType.Download);
bitsJob.AddFile(UrlOne, destOne);
_JobId1 = bitsJob.JobId.ToString();
var bitsJob2 = _bitsManager.CreateJob("NAME2", SharpBits.Base.JobType.Download);
bitsJob2 .AddFile(UrlTwo, destTwo);
_JobId2 = bitsJob2 .JobId.ToString();
bitsJob2 .Resume();

OK now i look on the dest folder.
i can see 2 temp file. one of them is 0 KB and one is full (140000KB)

when i check progress of both of them every 1 sec i can see that full one is downloaded and the second one is in progress 0 all the time till the first one is downloaded.

var jobId = new Guid(_JobId1 );
var bitsJob = _bitsManager.Jobs[jobId];
var jobProgress = bitsJob.Progress;

Can someone help me?
why the 2 jobs don't downloaded in parallel?
Closed Jan 7 at 3:09 PM by xidar


amir8985 wrote May 18, 2016 at 12:54 PM

Update: i found that i'm wrong and it really download the files in parallel.
however the time slice between switching downloads is ~5 min

someone know how i can change this time slice?

wrote Jan 7 at 3:09 PM

wrote Jan 7 at 3:09 PM