How can I find out the local DNS server?
1 posts in topic
Flat View  Flat View

Posted By:   Chris_Wilkes
Posted On:   Tuesday, September 10, 2002 02:33 PM

I wrote some quick wrappers to JNDI calls for simple DNS queries like getting MX records. Its available here http://ladro.com/java/DNS.html

However I have to hard code my DNS server into one of the .java files as I can't figure out how to get that information dynamically. I believe java has to know this information as there are InetAddress methods to query for forward and reverse lookups, which require you to know the DNS server.

Any clues on where to find this info?

Re: How can I find out the local DNS server?

Posted By:   Jorgen_Nordqvist  
Posted On:   Tuesday, September 17, 2002 08:20 PM

There is no official way in Java to find out the IP or name of your default DNS server.

Some of your options may have to be to dive into the lower parts of the operating system using JNI, or to use an app like DNSjava which is a pure Java set of classes to add a local DNS server to your application.


About | Sitemap | Contact