cURL / Mailing Lists / curl-library / Single Mail


Re: libcURL multi interface - Restrict to One TCP connection

From: Ray Satiro via curl-library <>
Date: Fri, 30 Jan 2015 01:42:11 -0500

On 1/29/2015 11:29 PM, RaJ M wrote:
> I am using curl_multi_wait() + curl_multi_perform() to perform
> continuous HTTP transfers. (All transfers to a single HOST:PORT) That
> creates multiple TCP connections. (as it should/can)
> Does libcURL multi interface allow user to configure it to restrict to
> strictly use only one TCP connection across easy handles being added ?
> If it does, are there any example programs ?

Check out CURLMOPT_MAX_HOST_CONNECTIONS [1]. Enable it on the multi
handle via curl_multi_setopt. There may be some caveats if
CURLMOPT_PIPELINING is enabled as well. It was discussed last year [2]
but I'm not sure of the status.

> If it doesn't, is it inappropriate to just set options via
> curl_easy_setopt (including CONNECT_ONLY) and get the libcURL socket
> using CURLINFO_LASTSOCKET and do own send(), recv() instead of
> curl_easy_perform to avoid blocking call ?

Don't reinvent the wheel ok :)


List admin:
Received on 2015-01-30