TCP 3Way Handshake Process (original) (raw)

Last Updated : 13 Oct, 2025

The TCP 3-Way Handshake is a process used by the Transmission Control Protocol (TCP) to establish a reliable connection between a client and a server before data transfer. It ensures that both sides are synchronized and ready to communicate.

TCP Segment Structure

A TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as shown:

TCP Segment

The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there are no options, a header is 20 bytes else it can be of upmost 60 bytes. Header fields:

1. **Source Port / Destination Port (16 bits each): Identify sending and receiving applications.
2. **Sequence Number (32 bits): Position of the first byte in this segment, used for ordering.
3. **Acknowledgement Number (32 bits): Next byte expected by the receiver (confirms data received).
4. **Header Length (HLEN): Size of the header (5–15 words, i.e., 20–60 bytes).

5. **Control Flags (1 bit each):

6. Window Size: Receiver’s buffer size (for flow control).
7. C
hecksum: Error detection (mandatory).
8. **Urgent Pointer: Position of urgent data (if URG flag is set).

TCP 3-way Handshake Process

Communication over the internet follows the TCP/IP model. Applications like web browsers use the Application Layer, and their data is passed to the Transport Layer, where TCP and UDP work.

TCP 3 Way Handshaking

TCP ensures reliability using Positive Acknowledgement with Retransmission (PAR):

TCP 3 Way Handshake