Question about getaddrinfo in Inet4AddressImpl.c

Charles Lee littlee at
Tue Oct 25 00:31:44 PDT 2011

Hi guys,

I am reading some native code in the jdk repos. I find that in 
Inet4AddressImpl.c (folder solaris), gethostbyname is used. Meanwhile in 
the Inet6AddressImpl.c. getaddrinfo is used. My question is why inet4 
does not use getaddrinfo? Any concern here?

There are some pros I can see if getaddrinfo is used in the 
1. Code will look more clean and portable :-)
2. __GLIBC__ can be omitted. I have grep the __GLIBC__ in the jdk/src 
directories, only Inet4AddressImpl use it.

Yours Charles

More information about the net-dev mailing list