cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Limiting the number of active connections/transfers.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 5 Apr 2011 00:09:55 +0200 (CEST)

On Mon, 4 Apr 2011, Vladimir Grishchenko wrote:

>> Thus: if you set CURLMOPT_MAXCONNECTS to N and you never add more than N easy
>> handles to the multi handle (simultaneously, in any single given moment),
>> libcurl should not keep more than N connections around.

> Thanks Daniel, exactly the answer I've been looking for.
>
> As for multi vs. easy, there is a chance I might need to use the latter as
> well but not both at the same time. Sounds like for the easy interface, to
> achieve the same effect, I need to make sure that the total # of configured
> CURLOPT_MAXCONNECTS across all alive easy handles should not be more than N?
> For example, having at most 6 active easy handles with CURLOPT_MAXCONNECTS
> set to 2 on each of them will guarantee there is never more than 6 open
> connections at any given time?

For the easy interface, the CURLOPT_MAXCONNECTS number goes for each
individual easy handle.

Since you can only do one connection at a time with the easy interface, the
logic is easier: CURLOPT_MAXCONNECTS sets the maximum amount of connections
that will be kept in the pool (and it will always be at least one).

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