Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 13th, 2005, 6:23 PM   #1
Kazy
Newbie
 
Join Date: Sep 2005
Posts: 21
Rep Power: 0 Kazy is on a distinguished road
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!
Kazy is offline   Reply With Quote
Old Dec 13th, 2005, 6:30 PM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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
nnxion is offline   Reply With Quote
Old Dec 13th, 2005, 6:59 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Dec 13th, 2005, 10:17 PM   #4
para
Programmer
 
Join Date: Dec 2005
Posts: 65
Rep Power: 3 para is on a distinguished road
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.
para is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:33 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC