I'm using getaddrinfo("test.domain.com", NULL, &hint, &info) to
get IP addresses.

Below is /etc/hosts:
...
10.200.28.120 test.domain.com
172.0.20.120 test.domain.com
...

The problem is getaddrinfo always return only one IP address 10.200.28.120. From the man page, I think I should get an address linked list that mean I can get both.

Please see my demo code below:
int main()
{
struct addrinfo hints;
struct addrinfo *info;
int s;
memset((char*) &hints, '\0', sizeof(hints));
hints.ai_family = AF_INET; // just IPv4 for now
hints.ai_socktype = SOCK_STREAM; // just TCP
s = getaddrinfo("test.domain.com", NULL, &hints, &info);
if (s != 0) { printf ("error\n"); }
printf ("ok\n");
return 0;

}

I have checked info->ai_next with gdb, it's always NULL. Is there
anything wrong in my demo code? My platform it RHEL 4.0.

BTW: This demo code can get the right result on Solaris.

Thanks

Arthur