curl-library
RE: Easy w/callback supports 1 simultaneous connection
Date: Wed, 26 Oct 2011 17:02:06 -0700
>
> It appears that an easy handle is entangled with request-specific CURLOPT_WRITEDATA callback info, used to receive data for that single request, as well as entangled with the request-specific CURLINFO_RESPONSE_CODE (curl_easy_getinfo), used to get the HTTP response code. The handle therefore cannot be modified for the life of the request, which shrinks support to effectively 1 connection at a time.
>
> If this is true, I feel that when using the easy interface (no multi) in this manner, it becomes wasteful to use the default persistent connection cache of size 5, since under my usage constraints only 1 can be used at a time, and therefore I should always set CURLOPT_MAXCONNECTS to 1.
>
> Can I get verification on this line of reasoning?
> -------------------------------------------------------------------
As far as I understand the operation there will be at most one single persistent connection per easy handle if you always hit the same IP address for the reasons you outlined above. Only in a situation when you connect to different servers through the same handle (one after another) will the previous connections be left open and only if libcurl determines they can be safely reused.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-27