cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is there a counterpart of curl_multi_fdset to UNset fd's?

From: Federico Vitali <fede.vitali_at_gmail.com>
Date: Tue, 8 Jul 2014 11:21:03 +0200

Ok perhaps I've understood, I apologize for my request. It the select
function itself that unsets filedescriptors... Is it correct?

2014-07-08 10:50 GMT+02:00 Federico Vitali <fede.vitali_at_gmail.com>:

> Hi Daniel! Thank you so much for your solicit answers!
> Reading your answers I'm probably missing some basic concepts from curl
> or, even worse, from linux programming! So let me explain what I need to
> do.
>
>
>> I don't get why you want that. You handle your descriptors, and you can
>> have libcurl add its descriptors. Why would you remove any?
>
>
> I'm developing a project for video surveillance based on IP cameras. I'm
> using a framework
> heavily based on file descriptors and select for timing and scheduling
> events and actions.
>
> Let's give an example. I have, among others, a unix socket for IPC with
> another process.
> Then I have to make a CGI requests to a bunch of IP cameras, 10 in my
> case, periodically.
>
> So I use select to monitor file descriptors (eg my unix socket), with tv
> set to next timeout to handle. When I need
> to make a bunch of CGI requests like in this example
> http://curl.haxx.se/libcurl/c/multi-app.html
> I set the file descriptors associated with my multi handle via
> curl_multi_fdset. Then, after a number
> of selects, when curl_multi_perform tells me that there are no more
> running requests I would like
> to unset the file descriptors associated with curl handles and continue
> with my endless select
> on my original file descriptors.
> You say that I don't need it, so where am I wrong?
>
> Thank you very much!
>
> Federico
>
>
>
>>
>>
>> I need that because I have to add curl fd's to an already existing set.
>>>
>>
>> The function was designed to offer that. As the docs says
>> "curl_multi_fdset() only adds its own descriptors". So you can set your own
>> descriptors first and then ask libcurl to add its descriptors and you can
>> then select() on the whole set in a single call.
>>
>>
>> And another question: is there a way to get a fd of a specific curl
>>> handle of a multi handle set?
>>>
>>
>> No, but I would be interested in learning why you would want that? When
>> you use the multi API you work on all the transfers at once and several
>> easy handles can even (at times) share one or more file descriptors.
>>
>> --
>>
>> / daniel.haxx.se
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-08