cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: libcurl multi handle persistent connections (Tejas Shah)

From: Tejas Shah <tejas89_at_gmail.com>
Date: Wed, 23 Nov 2011 10:02:22 -0500

> > I am adding 10 easy handles to a multi handle, all with the same server
> url.
> > When I do a multi perform on the multi handle, 10 connections are
> opened. I
> > was under the impression that multi handles had connection pools and
> reused
> > connections when possible. How can I enforce use of one connection for
> all
> > 10 of these easy handles?
>
> If you open then one after the other, after the previous request was
> completed, then it will re-use the same connection. It can't re-use the
> connection simultaneously unless you enable pipelining and use the correct
> set
> of HTTP requests.
>
> Also, you can make the connection not re-usable depending on what options
> you
> set, what your program does and depending on what the server does.
>

I get it. Thanks for helping me understand that.

So I allow these 10 requests to complete on their 10 separate connections,
then I remove and cleanup the easy handles, then init 10 new easy handles
and set their options to talk to the same server. I add these 10 handles to
the same multi handle and do another curl multi perform. Why am I seeing
that this opens 10 new connections instead of reusing the original 10?

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