cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: parallel transfer techniques

From: Mohun Biswas <m_biswas_at_mailinator.com>
Date: Tue, 16 Jun 2009 14:30:02 -0400

Nick Gerner wrote:
> I would caution that having everything in one loop does make for
> somewhat complicated logic as you need to have one logic path for some
> sockets (subprocesses) and another path for other sockets (curl).
> That can lead to bugs. But so can having separate threads :)
>
> Let me know if you need more encouragement or code samples.

Thank you Nick, Richard, and Daniel. I'm working on this now and may
come back with the occasional question. In fact I have one now :-),
though it's as much a select as a curl question.

My current call to select uses only the "readfds" parameter, since I do
only reads of the incoming data. Since the uploads I want to do via the
multi interface are all writes, it seems to me that I can easily
partition my fd sets. I.e. I should be able to take the fdset returned
by curl_multi_fdset(), pass that as "writefds" to select, and only call
curl_multi_perform() if it has any bits set (assuming it gets FD_ZERO'ed
before each select call). Does this make sense?

Also, is there an idiom for checking whether an fd_set has any bits set,
other than looping up to maxfd and using FD_SET on each? No problem
doing it but it seems a bit inelegant. I was looking for a macro like
FD_ISEMPTY but haven't found one.

Thanks,
MB
Received on 2009-06-16