cURL / Mailing Lists / curl-library / Single Mail


curl_multi_socket_action, http pipelining

From: George Kola <>
Date: Sat, 16 Aug 2008 17:39:42 -0700

 I am writing a program that monitors something and reports the status to a
web server. I am using Linux (RedHat Enterprise 4.5) and libcurl-7.18-2

Since, I wanted to do the monitoring and status reporting in parallel, I
decided to use curl_multi_socket action.
Since a large number of events may be reported, I opted to use HTTP
PIPELINING ( using CURLMOPT_PIPELINING ) (status message is url-encoded and
hence it would be a HTTP GET which can be pipelined)

 I have a set of questions.

This is the framework

1. Create a multihandle and do proper setup including setting
                 b. CURLMOPT_TIMERFUNCTION
                 c. CURLMOPT_PIPELINING

2. On an event, (if no free easy handle is available), create an easy
handle, set it up and add it the multihandle

3. call curl_multi_socket_all -- to start the transfers

        I)First question is about step 3. Documentation ( 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 ?)

        II) curl_multi_socket_all is returning CURLM_CALL_MULTI_PERFORM and
I have to call it twice (on every invocation). The docs say that modern
libcurl do not return CURLM_CALL_MULTI_PERFORM -- am I doing something
wrong ?

        III)On a successful status reporting, I remove the easy handle from
multi handle and store it and re-use it. My question is for re-using an easy
handle, am I required to first remove it from multi, set a different url and
then add it back to multi handle ? (is there a faster way ? -- maybe just
setting the url in the easy handle, will it work ?_

           I am using EPOLL on Linux 2.6.9. I would prefer to use edge
triggerred and set EPOLLIN|EPOLLOUT|EPOLLET once and be done for the
socket. Will that work ? (experimenting with it seems to work)
            I find that curl makes a lot of socket callbacks (first passing
CURL_POLL_OUT and then passing CURL_POLL_IN and the process repeats multiple
times for the same fd).I would like not to make too many epoll calls.

Received on 2008-08-17