round robin dns's and ip addresses

Barry Margolin barmar at alum.mit.edu
Sat Aug 13 00:06:45 UTC 2005


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.

-- 
Barry Margolin, barmar at alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***



More information about the bind-users mailing list