TCP Handshake in 60 Seconds — Why Three Messages?
AI Images and video in this clip are AI-generated and are not real footage. Facts were checked against the sources below before publishing.
Transcript
- Why does TCP trade three messages before sending any data?
- Like a phone call: 'Hello?' 'I hear you. You?' 'Yep, I hear you.'
- First, a SYN: 'Can we talk? Here's my starting number.'
- The server answers with a SYN-ACK: 'Got your number. Here's mine.'
- Last, an ACK: 'Got yours too.' Now data can flow.
- Why not just two? The server answers, so we're connected?
- Ghosts — old, delayed requests. With two, the server connects to a ghost.
- UDP just throws data. It starts at once, but delivery isn't guaranteed.
- The third message is for the server: 'Yes, it's really me.'
- SYN, SYN-ACK, ACK. Three lines to confirm each other's numbers.
- Every new connection costs a round trip. So we reuse them: keep-alive, pools.