cURL / Mailing Lists / curl-library / Single Mail

curl-library

mixing curl_multi_perform and curl_multi_socket

From: Nick Gerner <nick_at_seomoz.org>
Date: Sun, 17 May 2009 16:22:46 -0700

First, and unrelated
http://curl.haxx.se/libcurl/c/curl_multi_socket.html says to look at
http://curl.haxx.se/libcurl/c/curl_multi_socket_action.html but that
gives me a 404.

I had a simple app that I wrote first with curl_multi_perform (since
it's easier/quicker to write than using the socket callbacks). I then
converted it to using curl_multi_socket_action and the
CURLMOPT_SOCKETFUNCTION.

In pseudo code my app looks like this:

while stuff is in flight or there's more work to do from an external queue
  1) add some work to the handle if there's any in the external queue
  2) if we just added call curl_multi_perform in a while loop
  3) poll on relevant handles
  4) call curl_multi_socket_action on the relevant socket

But it seems as if I wasn't getting the socket callback when I had
step 2 (the curl_multi_perform). If I remove it everything works
properly. So I guess I found my fix :)

But is this expected?

--Nick
Received on 2009-05-18