Files
CS361-Computer-Systems-II/p2-dns/PHASE-2.txt
T

27 lines
1019 B
Plaintext
Raw Normal View History

2026-05-31 14:34:00 -04:00
Answer the following questions to describe your code submission. Please keep
all lines to a maximum of 80 characters wide.
1 - Explain the algorithm that your code uses to convert a domain name from its
DNS (binary) format to the standard dotted notation for humans to read.
(I.e., how do you convert the bytes "01 61 01 62 00" into "a.b"?)
The algorithm we use reads from a pointer to the front of the domain name. The first
byte gives the length of the next label. The code copies that many bytes
as text, appends a period, and moves forward by that label length. It
repeats until it encounters a 0x00 byte using a while loop, which is the null byte and the end of the
domain name.
2 - Consider the following data:
12 34 81 80 00 01 00 01 00 00 00 00 03 6e 6f 74 02 68 69 03 6d 6f
6d 00 00 01 00 01 c0 10 00 01 00 01 00 00 03 84 04 01 02 03 04
What is the domain name in the response? What is the IP address?
The domain name is not.hi.mom
The IP address is 1.2.3.4