System Design
2. Networking FundamentalsAnimated
TCP
Reliable, ordered byte stream with a handshake.
The idea
TCP numbers bytes, acknowledges them, retransmits lost ones and controls speed so it does not overwhelm the network or receiver.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- current message
- earlier
- failure or attack
The client asks to open a connection and proposes a starting sequence number.
- step:
- 1/5
- from:
- Client
- to:
- Server
1/5
Time runs downward. Solid arrows are requests, dashed arrows are replies.
Step by step
- 1Three-way handshake opens the connection
- 2Data is sent in numbered segments
- 3Receiver acknowledges
- 4Lost segments are resent and the connection is closed
Where it is used
Web, email, databases.
Watch out for
Reliability adds latency, and one lost packet stalls everything behind it.