What is TCP/UDP?
TCP and UDP, told as a story about a registered envelope that confirms delivery and a plain one that just flies.
A sure delivery for papers, a fast one for video.Papers and video have different goals, so they need different delivery promises.
Confirming is slow; skipping it risks losing the letter.Registered is slowed by three greetings; plain is fast, but a lost envelope goes unnoticed.
A registered envelope is TCP; a plain one is UDP.Both use the same road — but only registered promises confirmation and order.
TCP promises more, so it has more header fields than UDP, plus a connection setup.Both have ports, but only TCP has sequencing, handshake, and a kept-open connection.
Neither TCP nor UDP is the one right answer.Registered suits papers and payments; plain suits video and games.
TCP is the registered envelope that confirms and keeps order; UDP is the plain one that goes fast, with no confirmation.
TCP is a connection-oriented protocol: it establishes a connection via a 3-way handshake, then guarantees reliability through sequence numbers, ACKs, and retransmission. UDP skips connection setup entirely, keeping its header light and fast — used where a little loss is acceptable, like real-time streaming or DNS queries.
When grown-ups say it
- TCP
- The registered envelope that confirms and keeps order. Slower than UDP, in exchange for reliability.
- UDP
- The plain envelope that just goes fast. Lighter and faster than TCP, but can lose an envelope.
- 3-way handshake
- The three greetings exchanged before anything is sent. UDP sends right away, with no such step.
- Port number
- The exact room number inside the house. The dedicated hole that says exactly who gets the envelope. → the dedicated mailbox hole
- Error/flow/congestion control
- The three devices that keep a registered delivery safe to the end. The fine-grained machinery TCP uses. → the three safety devices
- Checksum
- The confirming stamp on the envelope's outside. A quick check for whether the contents got damaged.
- DNS
- The neighborhood address book. A classic example of a fast UDP question-and-answer. → the neighborhood address book
- Socket
- A dedicated hole made from an address plus a room number. Whichever envelope you use, it all goes through this hole. → the dedicated mailbox hole