Introduction ------------ Kaffe is able to perform DNS lookups in two ways, the OS provided resolver or a pure Java version that utilizes dnsjava[1]. By default, Kaffe will use the native resolvers, however, in some configurations, it will cause the whole JVM to block during name lookups. Alternatively, by using dnsjava, there are less dependencies on the underlying OS and the whole process will not block during lookups. Properties ---------- org.kaffe.dns (get only) - Contains the name of the DNS implementation being used. Running kaffe with -Dorg.kaffe.dns=java.net.DNSJavaInetAddressImpl uses dnsjava. Examples -------- The following code will create a class whose main will do a lookup on the first argument and report all the results, along with the DNS implementation in use. >>> BEGIN DNSExample.java import java.net.InetAddress; class DNSExample { public static void main(String args[]) throws Throwable { InetAddress ia[]; int lpc; System.out.println("Start query..."); ia = InetAddress.getAllByName(args[0]); System.out.println("Query done using: " + System.getProperty("org.kaffe.dns")); for( lpc = 0; lpc < ia.length; lpc++ ) { System.out.println(ia[lpc].toString()); } } } <<< END DNSExample.java You can then run the example with a host name that has a mix of IPv4 and IPv6 addresses. rory@yale> java -Dorg.kaffe.dns=java.net.DNSJavaInetAddressImpl DNSExample ns1.ipv6.he.net Start query... Query done using: java.net.DNSJavaInetAddressImpl ns1.ipv6.he.net./64.71.188.2 ns1.ipv6.he.net./3ffe:81d0:ffff::250:4ff:fe3c:aa95 Manifest -------- libraries/javalib/java/net/InetAddress.java - The standard interface to DNS services for IP. libraries/javalib/java/net/Inet4Address.java, Inet6Address.java - IPv4 and IPv6 InetAddress implementations pulled from GNU Classpath[2]. These were modified somewhat since the original versions were buggy. libraries/javalib/java/net/InetAddressImpl.java - The base class for implementation classes. libraries/javalib/java/net/NativeInetAddressImpl.java - The native implementation that uses InetAddressImpl.c. libraries/cilb/net/InetAddressImpl.c - The native DNS implementation that uses getaddrinfo()/getnameinfo() when possible and falls back to gethostbyname()/gethostbyaddr(). libraries/javalib/java/net/DNSJavaInetAddressImpl.java - The pure Java implementation that uses dnsjava[1]. References ---------- [1] A DNS implementation in Java, http://www.xbill.org/dnsjava, Brian Wellington [2] GNU Classpath, http://www.gnu.org/software/classpath/classpath.html History ------- April 15, 2003: Initial version.