cURL / Mailing Lists / curl-library / Single Mail


RE: CURLE_OPERATION_TIMEDOUT using curl_multi_socket_action

From: Daniel Stenberg <>
Date: Fri, 15 Mar 2013 09:11:25 +0100 (CET)

On Wed, 13 Mar 2013, Paras S wrote:

> Find the sample program attached which illustrates the problem I am facing.
> I am using Mozilla's NSPR:

I don't know nor use NSPR so I can't comment on all subtle details here. But
really, you're using epoll in the example so that is what you should rather
focus more on using correctly here.

Let's try to straighten out everything from the ground up, as this source code
is very VERY far from a proper use of libcurl. It is kind of amazing that it
works to any degree at all!

  1 - your code doesn't use CURLMOPT_TIMERFUNCTION[1] which in the case of
      the socket_action API is just wrong unless you have a very specfic idea
      on how to survive without it and knowledge about why.

  2 - why use a thread pool at all in this case? the multi API handles
      parallell connections in a single thread. You only make things harder for
      yourself by mixing threads into the game like this.

  3 - your socket_callback doesn't _do_ anything??? You are supposed to "catch"
      the socket in there and subscribe to notifications from your event
      library on that sockets (and that specific "action").

  4 - you're using an event-based API so call libcurl when events trigger!

NSPR is not an event library/API, epoll is though.

Perhaps things would be easier if you'd explain more what exactly you want to
accomplish and we can possibly help you get there...

[1] =

List admin:
Received on 2013-03-15