cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to limit maximum sockets libcurl uses

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 16 Sep 2011 14:37:43 +0200 (CEST)

On Fri, 16 Sep 2011, Yamin Zhou wrote:

> In libcurl, I set CURLMOPT_MAXCONNECTS as 20 in the multi handle. When the
> server is unreachable, libcurl of course can't establish any connection, but
> for each easy handle added into the multi handle, a new socket is created.

The sockets that are created but can't be used due to the failed connection
get closed again. Only live and working connections will be left alive for
further re-use.

> Is there a way to limit how many socket libcurl uses to try to connect?

CURLMOPT_MAXCONNECTS is the maximum number of connections libcurl will keep
around when you remove handles. When you add handles, libcurl might increase
the amount so that each handle get the sockets/connections they need.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-16