cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: parallel transfer techniques

From: Richard Atterer <richard_at_2009.atterer.net>
Date: Mon, 15 Jun 2009 16:03:29 +0200

On Mon, Jun 15, 2009 at 09:43:10AM -0400, Mohun Biswas wrote:
> 3. Use the multi API. I'm leaning this way because it seems the most
> "curl-ish" solution. The problem I fear here is that I already have a
> select loop with a lot of file descriptors in play for the incoming
> data.

Reading about your problem, this is the variant that would come to my mind
first. You should use only one select() loop to manage both your and
libcurl's file descriptors.

Basically, libcurl will give you an fd_set to call select() on. If you have
upload work to do, you can add your own fds to that before calling
select(). If your upload buffer is full, a (crude) approach would be to
only call select() on your upload fds, effectively pausing all libcurl
transfers.

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  GnuPG key: 888354F7
  | \/¯|  http://atterer.net  |  08A9 7B7D 3D13 3EF2 3D25  D157 79E6 F6DC 8883 54F7
  ¯ '` ¯
Received on 2009-06-15