cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Best practices for using curl multi api

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 Mar 2012 09:26:31 +0100 (CET)

On Tue, 20 Mar 2012, Joshua Litt wrote:

> curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
>
> rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
>
> When I try to integrate the example code into our codebase, the select
> never succeeds(always returns -1).

Most of the times when people report this, it is because you don't check maxfd
or the return code from curl_multi_fdset() and thus pass in "silly" values to
select(). Like during the perioud when libcurl doesn't have any sockets to
wait on...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-22