host lookup on specific nameserver

T

Thilo Rusche

Hi,

is there a way to perform a host lookup using a specific DNS server
instead of the default nameserver of the local machine in Java, short
of implementing the DNS protocol? For example, if the local machine is
configured to use /etc/hosts, 10.254.1.1 and 10.254.2.2, is there any
API call that allows me to query a different server? As far as I am
aware, the java.net package does not support this, and I could not
find any third party API for this either. Any pointers would be
appreciated.

Thanks!
Thilo
 
J

Joseph Millar

is there a way to perform a host lookup using a specific DNS server
instead of the default nameserver of the local machine in Java, short
of implementing the DNS protocol? For example, if the local machine is
configured to use /etc/hosts, 10.254.1.1 and 10.254.2.2, is there any
API call that allows me to query a different server? As far as I am
aware, the java.net package does not support this, and I could not
find any third party API for this either. Any pointers would be
appreciated.

I know of no way to do this in Java directly. There may be
some 3rd party class out there that do it, or you can use
various tools like nslookup using Runtime.exec().

--Joe
 
J

Joseph Millar

Yes. The hard part is doing it WITHOUT knowing a hard coded DNS
server.
[snip!]

Very cool, didn't know about this. Guess I need to find out
more about JNDI.

--Joe
 
T

Thilo Rusche

Roedy Green said:
Yes. The hard part is doing it WITHOUT knowing a hard coded DNS
server.

Here is how you do it:

Thanks, just what I was looking for. I wasn't familiar with the
javax.naming package yet.

Cheers,
Thilo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top