round robin dns's and ip addresses
Danny Mayer
mayer at gis.net
Sat Aug 13 21:54:42 UTC 2005
Barry Margolin wrote:
> In article <ddinf6$2370$1 at sf1.isc.org>,
> "yawnmoth" <terra1024 at yahoo.com> wrote:
>
>
>>If a particular domain is using a round robin DNS and has 2+ IP
>>addresses associated with it, is there any way I could get a list of
>>all the IP addresses associated with the domain? gethostbyname will
>>return one IP address, but I'd like all of them...
>
>
> gethostbyname() should return all of them. The hostent.h_addr_list is
> a NULL-terminated array containing all the addresses. If you're using
> hostent.h_addr, that's a macro that just refers to the first element of
> the array, for backward compatibility with the original design of
> gethostbyname(), which only returned one address.
>
You mean IPv4 addresses. It won't return IPv6 addresses. For that you
need to use getaddrinfo() which returns both.
Danny
More information about the bind-users
mailing list