in reply to How to create a DNS message in perl?
How can can i convert it into the hexa value of 2 octets which is '0001'
pack. Specifically, pack('n', 1).
The $QNAME = "www.google.com". How can i convert it into the hexa value '0377777706676F6F676C6503636F6D00'.
Each segment of the domain is passed as a byte indicating the length of the string followed by the string itself. The whole is ended with a NUL byte (pack('C', 0) or "\x00").
0377777706676F6F676C6503636F6D00 03 777777 3 www 06 676F6F676C65 6 google 03 636F6D 3 com 00 0
Update: Fixed with better understanding.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to create a DNS message in perl?
by sanjay nayak (Sexton) on Jul 30, 2008 at 07:42 UTC | |
by ikegami (Patriarch) on Jul 30, 2008 at 09:11 UTC | |
by sanjay nayak (Sexton) on Jul 30, 2008 at 12:28 UTC | |
by ikegami (Patriarch) on Jul 30, 2008 at 20:11 UTC | |
by sanjay nayak (Sexton) on Jul 31, 2008 at 06:40 UTC |