Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dns in java

827364Dec 29 2010 — edited Dec 29 2010
Hello!
I have to do some project at my networking course, something like nslookup but in java, and i have a little problem.
My project must send queries to a dns server, and receive an answer (different types : A, MX, NS, CNAME etc.). But i have to use recursive call.
I will send query to a server name and it must search for the host or the ip. If it doesn't find any answer, then return a list of server names, i could use (send queries to..). This is my problem. I don't know how to do it.

1. Is it even possible to do this?
2. I only need something i could use to solve my problem, not an entire program, just a few lines (i searched all over the internet, but nothing seemed to solve my problem).
3. First i would like to know how to query a certain server. I did something like this
Name name = ReverseMap.fromAddress(hostIp);
Record rec = Record.newRecord(name,Type.PTR, DClass.IN);
Message query = Message.newQuery(rec);
Message response = new ExtendedResolver().send(query);
but i don't know how to query a certain server (one i can enter by myself).
4. And then, if there is a way to find the dns servers that could answer me (list ip addresses, mail exchange and so on.. for a given host).
5. Sorry if my English is bad, and sorry if i seem stupid.

Thank you in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2011
Added on Dec 29 2010
2 comments
243 views