cURL / Mailing Lists / curl-library / Single Mail


Re: curl_multi_socket_action, http pipelining

From: George Kola <>
Date: Sun, 17 Aug 2008 17:47:33 -0700

*>> I)First question is about step 3. Documentation (http:// *
*>> says there should be *
*>> no reason to use curl_multi_socket_all. If I am not to use it, what *
*>> should I use in step 3 (curl_multi_perform ?) *

>You don't need to call curl_multi_socket_all, anytime you think you
>need to call it must be considered a bug somewhere. Adding the easy
?handle should generate a socket and/or timeout callback, so you can
>add the socket to your event backend. When the socket becomes
>readable or writable, you call curl_multi_socket_action on it. You
>don't manually have to "start" the transfer. At least I never did.

        I find that when I add an easy handle to multi handle, only the
timeout callback (set with CURLMOPT_TIMERFUNCTION) is called with a timeout
of 0 and the socket callback is not called. Is this normal ?

I am using this
static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp) ;
as the timeout call back prototype. (copied from ghiper.c example)

         I now have my code set a flag if timeout_ms==0 and after adding an
handle to multi handle, I check this flag and call curl_multi_socket_action
with CURL_SOCKET_TIMEOUT. Is this the correct way ?

        I find that after the first call with CURL_SOCKET_TIMEOUT, the
timeout_ms passes is 299,999 -- this seems a long time (almost 5 minutes).
Am I doing something wrong ?

         I also find that on every further addition of an easy handle,
gets called with a timeout of 0. So, should I keep calling call
curl_multi_socket_action with CURL_SOCKET_TIMEOUT on every addition of an
easy handle to a multi handle.

Received on 2008-08-18