For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2007 > Re: can't get multi-homed host address using getaddrinfo()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: can't get multi-homed host address using getaddrinfo()
Arthur

2007-07-12, 8:06 am

On Jul 12, 7:29 am, Arthur <wangdas...@gmail.com> wrote:
> On Jul 12, 7:16 am, Rainer Weikusat <rweiku...@mssgmbh.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
> I have changed the var name to avoid the confusion. 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.
>
> Best Regards & Thanks,
>
> Arthur


BTW. Running the same program on Solaris 8, that program can return
the right result (2 IP address).

Arthur

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com