Send Datagram packet to root server
I'm new here. I want to build a java program to get the IP of the given website without using gethostbyname(). I want build a dns resolver using java programs that work as dig command in linux. That is i want get the ip of the TLD from the given root server and then continuing the process get the IP of the given website.
I have to use datagrampacket and the UDP connection between user and the root server.
I have seen such procedure in C++, building the DNS_HEADER PACKET and do the sendto() function to get the IP address.
I want build the exactly dns packet and then send this to root server and also want the response.
Please help me :
1. How to build DNS_Header packet in java?
2. How to send the this packet to root server?
3. How to extract the response packet to get the IP?
4. Any link or any sample code would be helpful?
Please help me... any sample code would be really helpful.