Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 06 · From Scratch · DNS Server · with code: Go · about 13 min to read

Play it as a journeyTutor comes with a plan

DNS 03 and 04: The Question and the Answer

DNS Telegram
DNS Telegram · Open board

The question as a telegram: the name spelled as counted chunks, and the answer’s name replaced by a “ditto”. This lesson builds the question’s chunks and, for the answer, the part that holds the address.

Before you start. DNS 01 and 02: The UDP Socket and the Header built a socket and a parser for the 12-byte header: an ID, a flags word, and four counts, the first of which says how many questions follow. The header says there is a question. This lesson reads it (stage 3) and then answers it with real addresses (stage 4). You also need one idea: a DNS record is one fact the directory holds, such as “this name has this address”.

Lesson 40 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • November 1987: a name is a path through a tree
  • Stage 3: read the question, answer “no such name”
  • Stage 4: something to say, and three kinds of reply
  • What one answer record looks like in bytes

Terms it explains: record, type, class, zone, TTL, `encodeName`, `readName`, `parseQuestion`, `respond`, Mistakes this stage invites.

Review From Scratch