![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2005
Posts: 21
Rep Power: 0
![]() |
DNS Client
I'm trying to produce a simple (although its definately not very simple to code) DNS client that will resolve a domain name. My problem is, I get back data in binary. I've converted the binary bits into hex so I can at least figure out what I got back, now I'm trying to figure out how to change either the binary bits or the hex I created into something I can print regular values to the screen. I'm not sure if anyone is familiar with the RFC for DNS (http://www.ietf.org/rfc/rfc1035.txt), but does anyone know how I can convert binary/hex to something printf would be able to print out? My question may not be so clear, if so I'd be glad to give more info. Thanks!
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Instead of coding it all your self, you can use the sockets given to you by your OS.
See http://beej.us/guide/bgnet/output/ht...calls.html#dns for more. information
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You can convert binary to textually-encoded hex very simply. Hex is just a representation of binary values, nothing distinct in content/value, and not all those values print well when used directly.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Dec 2005
Posts: 65
Rep Power: 3
![]() |
I've done this myself, request a normal/reverse resolution from a list of DNS servers. It's not too difficult, but it can take a while to get it working mainly because I found the documentation not so straight forward. I used a packet sniffer called Ethereal, which used in conjunction the RFC, and I was able to easily decipher what bits meant what and how to decode it.
I hope that helps. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|