err.. yeah... slight mental slip.. gethostbyname takes a char* which is
the hosname (ip or dns) and it returns a hostent. gethostbyname defaults
to ipv4, and gethostbyname2 allows you to pick. gethostbyname2 takes a
char* and an AF_INET or AF_INET6 argument... if you want ipv4 mapped to
ipv6, then use gethostbyname2 with AF_INET6.
On Thu, 13 Jul 2000, Armando Aguirre Schlick wrote:
> >
> > my understanding (from my Richard Stevens book) is that gethostbyname will
> > return ipv4 mapped ipv6 addresses by setting h_addrtype in hostent to
> > AF_INET6.
>
> What is that book?? gethostbyname(name) don't have an arg of type
> hostent. I guess that I' have to set h_addrtype at the struct returned or
> I'm wrong??
> Where can I find the specifications of the function gethostbyname
> (the last one). The glibc documentation isn't uptodate (glibc-2.1.x).
>
> > gethostbyname doesn't have a second argument; gethostbyname2
> > does.
>
> Sorry, gethostbyname2(name,af). I wrote it fast..
>
> > if you want all the addresses of a host and you want them to be ipv4
> > mapped to ipv6, then you use gethostbyname.
> >
> > what exact info are you looking for, though? one of those two functions
> > should give you all you need.
>
> Thanks so much.
>
|