cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem with libcurl in multithreaded environnement and a slow connection˛

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 10 Jan 2007 13:29:54 +0100 (CET)

On Wed, 10 Jan 2007, satriani.joe_at_free.fr wrote:

>> What does that mean? That the POST data is already being sent when it
>> returns with this error set? It seems very strange if so.
>
> The POST data isn't sent at all. result of curl_easy_perform() is
> CURLE_COULDNT_CONNECT.

If libcurl fails with this, then it failed to connect to the server. That
should only happen if the server is dead or extremely slow/overloaded. libcurl
has a 300 seconds timeout for that (unless you shorten it with options).

> Next attempt with a same curl handle and a FRESH_CONNECT of 0 has a better
> chance to succeed, but not with good probabilities.

FRESH_CONNECT has no impact whatsoever on the connect operation. On the
contrary, you just make the situation harder for you.

I would advice you to snoop on the TCP packets to see exactly what's happening
on network level before you start pointing fingers on libcurl.

> I remark that on slow connections when handles are used for a longer time
> than ethernet, multithreading maybe involves the use of lock or mutex on a
> certain ressource, or do i have to use curl_multi instead ?

libcurl has no mutexes but sure if you do SSL openssl/gnutls will use such.
Multithreading has no impact at all to normal libcurl operations.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-01-10