Networking
networkingnetworkingCore ConceptIntermediate
TCP (Transmission Control Protocol)
Master TCP 3-way handshakes, reliable ordered packet delivery, sliding window flow control, congestion management, and termination.
Verified: 2026-09-30
Platforms:
webnodelinux
#networking#tcp#transport#handshake#reliability
What is TCP?
TCP (Transmission Control Protocol) is a connection-oriented transport layer protocol that provides reliable, ordered, and error-checked delivery of data streams between applications over an IP network.
The TCP 3-Way Handshake (Connection Establishment)
Before any application data can be sent, the client and server must establish a synchronized connection:
Client (Browser) Server (Web Host)
│ │
│ 1. SYN (Sequence Number = X) │
├────────────────────────────────────────────────────>│
│ │
│ 2. SYN-ACK (Seq = Y, Acknowledgment = X + 1) │
│<────────────────────────────────────────────────────┤
│ │
│ 3. ACK (Seq = X + 1, Acknowledgment = Y + 1) │
├────────────────────────────────────────────────────>│
│ │
│ [ Connection Established: Ready to Send HTTP Data ] │Core TCP Reliability Features
- Guaranteed Delivery (Retransmission): The receiver sends acknowledgments (ACKs) for received packets. If an ACK isn't received before a timeout, TCP automatically retransmits the missing packet.
- Ordered Sequencing: Packets arriving out of order due to differing internet network routes are reassembled into the exact sequence before being delivered to the application layer.
- Flow Control (Sliding Window): Prevents a fast sender from overwhelming a slow receiver by continuously advertising available buffer space.
- Congestion Control: Algorithms (e.g. CUBIC, BBR) dynamically detect network congestion and throttle data transfer rates to prevent network collapse.
4-Way Handshake (Connection Teardown)
When closing a TCP connection:
- Client $\rightarrow$ Server:
FIN(Finished sending data) - Server $\rightarrow$ Client:
ACK - Server $\rightarrow$ Client:
FIN - Client $\rightarrow$ Server:
ACK(Connection closed afterTIME_WAIT)