Where is the implementation of "getaddrinfo" called by InetAddress.java
I have been recently studying on why the Browser in the android OS
does not support accessing IPv6 websites through IPv6 URLs and
I think it is due to the native method getaddrinfo
called by android/dalvik/libcore/luni/src/main/java/java/net/
InetAddress.java
which is then called by the Browser application
throws an UnknownHostException
when trying to convert an IPv6 URL to
its addresses.
Begin from line 507, the code of InetAddress.java
is:
try {
InetAddress[] addresses = bytesToInetAddresses(getaddrinfo(host), host);
addressCache.put(host, addresses);
return addresses;
and the native method is declared at line 516 as:
private static native byte[][] getaddrinfo(String name)
throws UnknownHostException;
But I haven't found any hint about where the implementation of this
native method getaddrinfo
is although I found there are two files
named getaddrinfo.c开发者_Python百科
. Does here follow the rules of JNI or NDK? If
so, a statement of System.loadLibary("NameOfTheLibrary")
should be
found but I didn't find it.
getaddrinfo
?
The complete source file of InetAddress.java
can be found at http://ooowjc.wikispaces.com/Attachments
In the Android source tree, libcore/luni/src/main/native/java_net_InetAddress.cpp.
I'd include a link to the file in the android-git repository, but the site seems to be hosed at the moment.
精彩评论