cURL / Mailing Lists / curl-library / Single Mail


RE: Server IP address

From: Ruben Thijssen <>
Date: Thu, 8 Apr 2010 13:48:42 +0200

Please don't top-post!

> The Primary IP is indeed what I am looking for I think. But I am using the
> .NET edition (c#) of curl and I don't think this information item is
> implemented yet (correct me if I'm wrong).

You better investigate your binding code and see for yourself. In most cases
extending such things are also fairly easy so quite possibly you can make this
option supported here without too much trouble.

> When connecting to an domain, say for example you can create an
> connection with more than 1 IP address (there are more IP addresses linked
> to one domain address).

That's not strictly correct.

The host name resolves to multiple addresses, which means that the DNS server
returns a list of addresses for that single host. libcurl will then walk
through that list of addresses and attempt to connect to them one by one until
one works (which in most cases is the first address it tries).

(Connecting to more than one IP may become reality in a future when/if MPTCP
becomes reality:

> So what I want to know is: Which IP address is Curl using when it is getting
> a list of IP address from one domain address. If I know this I know which IP
> address I have visited when connecting to an domain.

As mentioned, the CURLINFO_PRIMARY_IP option is pretty much made for figuring
out the address in cases such as this and we can't but recommend that you use

List admin:
I have currently trying to implement the PRIMARY_IP info field in the .NET binder.
But I am running into an problem. I am using the following code in the binder to request the CURLINFO_PRIMARY_IP option: 0x1000020 (CURLINFO_STRING + 32)
But the CURLINFO_PRIMARY_IP is always empty. Even if I am trying to print the value out of the curl c lib (so not the binder) I get an empty string. Is this a known issue?
List admin:
Received on 2010-04-08