cURL / Mailing Lists / curl-users / Single Mail


Re: CURLE_COULDNT_CONNECT after 120 requests

From: Daniel Stenberg <>
Date: Fri, 30 Apr 2010 10:33:05 +0200 (CEST)

On Fri, 30 Apr 2010, sandeep m wrote:

> I am working on a code which requires data to be sent for each URL. I used
> following code to send the data. But after 120-130 requests CURL is throwing
> CURL_SOCKET_BAD in connect::singleipconnect(..). It is failing at
> verifyconnect(). It starts working again after 140 if i add delay for CURL
> errors.

As you're using libcurl, you'd be much better off on the curl-library list
which is dedicated for libcurl users and hackers. Please take follow-ups to
that list instead.

You forgot to mention which libcurl version on what operating system.

My first hunch and gut reaction is that this is somehow related to number of
open file handles/sockets but it seems a bit low with only 120-130 requests
for that to happen...

> curl_easy_setopt(curl, CURLOPT_LOCALPORTFUNCTION, getRandomPort);

This is not an option we have in any official libcurl. It seems silly too,
since the local port already is randomly set by the TCP stack.

Also, these local options you use imply binding the socket on the source end
which possibly contribute to your problem.

List admin:
Received on 2010-04-30