Computer networks · core
Network layers, TCP, UDP and the handshake
Networks are described in layers. TCP gives reliable delivery; UDP gives speed. TCP starts with a three-way handshake.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- OSI layers from the bottom: Physical, Data link, Network, Transport, Session, Presentation, Application.
- Data link: frames between devices on one network, MAC addresses, switches. Network: packets across networks, IP addresses, routers. Transport: end-to-end delivery between programs, with ports (TCP, UDP). Application: HTTP, DNS, SMTP.
- TCP/IP has four layers: link, internet, transport and application. Its application layer covers the top three OSI layers.
- TCP: a connection with a handshake, reliable and in-order delivery with acknowledgements and resending, flow and congestion control. The cost is setup time and delay when a packet is lost.
- UDP: no connection, no guarantee of delivery or order, small 8-byte header, low delay. The application decides what to do about loss.
- Use TCP for file download. Use UDP for a video call and for game positions. DNS normally uses UDP.
- Three-way handshake: client SYN (sequence number x), server SYN-ACK (its own y and ack x+1), client ACK (y+1). Then data flows both ways.
- Why three steps: each side must choose a starting sequence number and hear that the other got it. Closing uses FIN and ACK in each direction, because one side may still have data to send.
The red pen
Common traps: mistake → fix
Mistake: UDP is bad because it is unreliable
Fix: it is right for live, time-sensitive data.
Mistake: The handshake order is SYN, ACK, SYN-ACK
Fix: it is SYN, SYN-ACK, ACK.
Mistake: Routers work at layer 2
Fix: routers work at the network layer (3); switches at layer 2.
Mistake: The TCP handshake and the TLS handshake are the same
Fix: TLS runs after TCP.
Easy to hard
Questions interviewers ask, easy to hard
- Name the OSI layers and one protocol for each.
- TCP or UDP for file download, video call, game, DNS?
- Explain the three-way handshake. Why three steps?
- What is the difference between the OSI and TCP/IP models?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.