cURL / Mailing Lists / curl-library / Single Mail

curl-library

questions about the PHP cURL multi interace

From: Terra Frost <terrafrost_at_gmail.com>
Date: Thu, 27 Jul 2006 22:39:39 -0500

I sent this to curl-and-php_at_cool.haxx.se but it was suggested that I instead
send it here, so...

I'm trying to better understand the cURL mutli interface and have a few
questions.

The second parameter of curl_multi_exec (or curl_multi_perform as it's named
in the docs) represents how many socket connections are still open. I tried
to load three URLs - the last of which had sleep(5) in it to test this and
the return value remained 3 until the very end. Should't it reduce down to
1 really fast and then remain 1 for most of the programs duration?

Also, this tutorial (http://curl.haxx.se/libcurl/c/libcurl-tutorial.html)
contains the only refence to curl_multi_select that I've been able to find.
My interpretation of that is that curl_multi_select based on that
description is that it blocks until curl_multi_perform has something to do.
But that doesn't explain the return value. Also, the tutorial mentions
curl_multi_fdset - a function for which I can find no PHP equivalent. Does
PHP's curl_multi_exec make this function unnecessary?

Back to the return value of curl_multi_select. There's a sample of
curl_multi_select being used at php.net (
http://us2.php.net/manual/en/function.curl-multi-exec.php#48813). It checks
to see if curl_multi_select's value is -1. What does that mean?

Looking at the error codes (
http://curl.haxx.se/libcurl/c/libcurl-errors.html) suggests that -1 is
CURLM_CALL_MULTI_PERFORM
but I don't think that means a whole lot sense if it did, curl_multi_select
would also be returning CURLM_OUT_OF_MEMORY (3), etc (which it apparently
does as the addition of debug code reveals). Rather, it seems like maybe
the return value corresponds with the second parameter of curl_multi_exec?
This wouldn't explain the -1, though.

Any insights would be appreciated - thanks!
Received on 2006-07-28