TCP vs UDP and the three-way handshake
40 min · Intermediate
TCP and UDP are the two main transport-layer protocols. TCP gives a reliable, ordered byte stream and pays for it with setup and waiting; UDP just sends independent messages, fast and with no guarantees.
Topics in this lesson
- Connection-oriented vs connectionless
- Three-way handshake and four-way termination
- Reliability: sequence numbers, ACKs and retransmission
- Flow control vs congestion control
- When UDP fits: video calls, DNS, games
Interview questions this lesson answers
- What does "connection-oriented" mean?
- What is a datagram?
- What is a socket?
- What fields does a UDP header have?
- What are the main fields in a TCP header?
- What is the difference between TCP and UDP?
- Explain the three-way handshake.
- Why is the handshake three steps and not two?
- How does TCP make delivery reliable?
- What is the difference between flow control and congestion control?
Sign in free to continue this lesson
Create a free account to read every lesson, practise with the exercises and keep track of your progress.