cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Keepalive

From: Tim McClarren <timm_at_doppelganger.com>
Date: Tue, 18 Mar 2008 09:05:19 -0700

>>I am using libcurl for transport inside my application. I use a multihandle
>>associated with a single background thread to handle network activity.
>>easyhandles are added and removed from this multihandle to service requests.
>>
>>I have restructured the code a bit to attempt to reuse easy handles so that
>>keepalive will work.
>
> With recent libcurls there's no reason at all to twiddle around, as the
> connection cache is then kept by the multi handle so you can kill and re-use
> easy handles all you want and the re-using of connections should still work
> fine!

"kill and re-use" means "destroy old ones and create new ones"?
"re-use" sounds like "reinitialize an existing one".

> libcurl doesn't explicitly keep them open. It just leaves them open and
> expects them to remain so unless the server closes them.
>
>>Is the behavior of how libcurl decides a particular easyhandle is "reusable"
>>documented somewhere?
>
> No. But there's nothing in that an application author in general should need
> to consider or even bother about.

Fair enough. Does just the host and port part of the URL need to match,
and nothing else? Is there anything beyond the transport endpoints that
libcurl looks at inside the easy handle to decide which open socket it
might try to use, if any? I suppose I could answer these questions
myself by looking at the source, so thanks for bearing with me.

>>It seems as though the local end of the connection is closing, and not the
>>server side.
>
> Enable CURLOPT_VERBOSE and libcurl will tell you when it closes connections.

Great! I'll give that a try and let you know what I discover. Thanks
very much!
Received on 2008-03-18