Understanding TCP: Protocol Basics, Three‑Way Handshake, and Why It Is Needed
This article explains the fundamentals of the Transmission Control Protocol, its reliable byte‑stream characteristics, the detailed three‑way handshake process, and why three steps are required to prevent duplicate or stale connections in network communication.
1. What is TCP?
TCP (Transmission Control Protocol) is a connection‑oriented, reliable, byte‑stream transport‑layer protocol.
RFC 793 defines a TCP connection as a set of status information—including sockets, sequence numbers, and window sizes—required for reliability and flow control.
A socket consists of an IP address and a port, the sequence number solves out‑of‑order delivery, and the window size controls flow.
2. Characteristics of TCP
Connection‑oriented: TCP establishes a connection between client and server.
Byte‑stream oriented: Data is transmitted as a continuous stream of bytes.
Reliable: TCP ensures data delivery even over poor networks by tracking sent and acknowledged segments and retransmitting lost packets.
3. TCP Three‑Way Handshake Process
The three‑way handshake is a common interview question and a fundamental concept in computer networking.
Key terms: SYN (Synchronize), ACK (Acknowledge), SEQ (Sequence Number).
Steps:
(1) Server listens on a port, moving from CLOSED to LISTEN state.
(2) Client sends a SYN, entering SYN‑SEND state.
(3) Server replies with SYN‑ACK, entering SYN‑RCVD state.
(4) Client sends ACK, both sides reach ESTABLISHED state.
4. Why Does TCP Need a Three‑Way Handshake?
The three‑way handshake prevents old duplicate connection attempts from causing confusion, ensuring that both parties agree on the initial sequence numbers.
Two‑way handshakes could allow stale requests to be mistaken for new ones, leading to connection chaos.
While more than three steps are possible, three steps provide sufficient reliability with minimal overhead.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.