cURL / Mailing Lists / curl-library / Single Mail


Re: Option to specify the type of IP address for TCP connect

From: Bin Wang <>
Date: Fri, 3 Aug 2012 14:07:11 -0700

Hi Daniel,

Thank you for the reply.

Let me ask my question in a different way. Do you think if the following is
a bug?

(1) Create a multi handle: m1
(2) Create an easy handle: e1, with the option CURL_IPRESOLVE_V4
(3) Added the easy handle e1 to the multi handle m1 and perform the transfer
(4) Create an easy handle: e2 with the same URL as e1 and the
(5) Added the easy handle e2 to the multi handle m1 and perform the transfer

At step (3), the transfer is done over IPv4 address. I would expect, at
step (5), the transfer is done over IPv6 address. But it is actually done
again over IPv4 address. The reason is that the DNS cache has been
populated with the IPv4 address from step (3), the libcurl does not lookup
again even though CURL_IPRESOLVE_V6 is specified in step (5).


On Wed, Aug 1, 2012 at 2:09 PM, Daniel Stenberg <> wrote:

> On Mon, 30 Jul 2012, Bin Wang wrote:
> When establishing a TCP connection, libcurl tries all the IP addresses,
>> including both IPv4 and IP6 ones, until a TCP connection is successfully
>> established or all the IP addresses are failed. libcurl already provides
>> the option for specifying the type of IP address to resolve the destination
>> host name. I was wondering if it makes sense to provide another option to
>> specify the type of IP address used for TCP connect.
> Isn't the specified type (as in which IP version) already used for both
> resolve and connect ?
> Then when a destination host name is resolved to "whatever" IP address, I
>> have the flexibility to connect using one type of the address or both
>> types, and I am able to do thing like giving different connect timeout to
>> different type of IP address.
> You can do this already. You can easily figure out the IP address (and
> "type") and then time-out whenever you please. Or what am I missing?
> --
> /
> ------------------------------**------------------------------**-------
> List admin:**listinfo/curl-library<>
> Etiquette:**etiquette.html<>

List admin:
Received on 2012-08-03