Making a DNS query using Java and choosing a response time

Can someone show me how I can make a DNS query to a specific DNS server and get a response as well as response time?

I intend to use this in a signed applet. Is this allowed in the applet?

+4
source share
3 answers

The standard Java API you can use is:

java.net.InetAddress

Or a more advanced JNDI search API:

DNS provider for the Java name directory interface

Both of the above Java APIs will work in a signed applet if the applets are granted the required policy rights (e.g. java.net.SocketPermission). But when the applet is used on a web page, the user will first be shown a dialog asking for permission to run. To measure the performance of these API calls, you can, of course, use a simple call to java.lang.Systen.currentTimeMillis ()

I do not recommend using dnsjava.org , it was popular, but the project has not been updated since 2004.

+5
source

Just call one of the InetAddress methods or look at the JNDI with the DNS provider.

0
source

You need a Java implementation of DNS, for example dnsjava (see examples.html ). Of course, this cannot be used in an applet, since it violates network restrictions.

-2
source

All Articles