title: Calling BackgroundWorker.RunWorkerAsync() multiple times with different parameters
body: <p>I am trying to set up file uploading to a server.</p>
  
  <p>I would like to divide the file into 'n' chunks of 'y' size each and then upload 'x' chunks at a time to the server using threads. 
  When one of the 'x' chunks is completed then another chunk should start uploading until there are no more chunks left to upload.</p>
  
  <p>I have been looking at BackgroundWorker and have the following implementation idea:</p>
  
  <p>1) The following method to assign to Worker.DoWork</p>
  
  <pre><code>private void ChunkUploaderDoWork(object sender, DoWorkEventArgs e) {
      //get arguments list form e.arguments and prepare next upload
      //The arguments list contains information such as next chunk number and chunk size etc..
      //Calculate file stream offset based on chunk size and upload the next y bytes.
  }
  </code></pre>
  
  <p>2) I can then call </p>
  
  <pre><code>BackgroundWorker worker = new BackgroundWorker();
  worker.DoWork += (obj, e) =&gt; WorkerDoWork();
  worker.ProgressChanged += new ProgressChangedEventHandler (Worker_ProgressChanged);
  worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler (Worker_RunWorkerCompleted);
  worker.RunWorkerAsync(argumentsList);
  </code></pre>
  
  <p>With backgroundWorker, I can have it report progress as well and can also be notified about completion in order to start uploading the next chunk, so those are a couple of reasons why I would like to use it. The problem is that I am not sure if I should call worker.RunWorkerAsync() in the following manner (in case that I am uploading 4 chunks at a time):</p>
  
  <pre><code>worker.RunWorkerAsync(argumentsListForChunk1);
  worker.RunWorkerAsync(argumentsListForChunk2);
  worker.RunWorkerAsync(argumentsListForChunk3);
  worker.RunWorkerAsync(argumentsListForChunk4);
  </code></pre>
  
  <p>And then when any of the worker completes and gives me a worker completed call back, then I can do this:</p>
  
  <pre><code>void Worker_RunWorkerCompleted(object sender, ProgressChangedEventArgs e)
  {
      //Check if we have any outstanding chunks and upload next chunk if available.
      //for example if we had chunk 5 next in line, then I could call RunWorkerAsync as follows:
      worker.RunWorkerAsync(argumentsListForChunk5);
  }
  </code></pre>
  
  <p>I am relatively new to c# and would like to know if this is a good way to get things done.</p>
  
  <p>My requirements, in a nutshell, are</p>
  
  <ol>
  <li>Use threads to upload file chunks</li>
  <li>Limit the number of threads</li>
  <li>Keep a check for completed threads so that we can start uploading the next file chunk</li>
  <li>Keep track of thread progress.</li>
  </ol>
  
  <p>Any help will be appreciated :)</p>
  
  <p>Edit::
  The comments form @o_weisman and @HansPassant made me realize that the question was missing the following relevant information.
  <em>I am trying to upload to a server that I control. The server limits connection speed and thus opening multiple connections for uploading file chunks will result in an over all speed boost.</em></p>
  
  <p>Thanks!</p>