🔗

Understanding TCP 3-Way Handshake Process

Apr 17, 2025

TCP 3-Way Handshake Process

Overview

  • The TCP 3-Way Handshake is a fundamental process to establish a reliable connection between two devices over a TCP/IP network.
  • It involves three steps: SYN (Synchronize), SYN-ACK (Synchronize-Acknowledge), and ACK (Acknowledge).
  • Ensures both parties are synchronized and ready for communication.
  • Key for secure and stable communication.

What is TCP 3-Way Handshake?

  • Used in Transmission Control Protocol (TCP) to establish a connection between a client and a server.
  • Ensures both client and server have synchronized initial sequence numbers.

TCP Segment Structure

  • Consists of data bytes and a header.
  • Header fields:
    • Source Port Address: 16-bit, sender's port.
    • Destination Port Address: 16-bit, receiver's port.
    • Sequence Number: 32-bit, first byte sequence number.
    • Acknowledgement Number: 32-bit, next byte expected.
    • Header Length (HLEN): 4-bit, length of TCP header.
    • Control Flags: 6 1-bit fields controlling various aspects.
      • URG, ACK, PSH, RST, SYN, FIN.
    • Window Size: TCP window size in bytes.
    • Checksum: Error control checksum.
    • Urgent Pointer: Points to urgent data.

TCP 3-way Handshake Process

  1. SYN (Synchronize):
    • Client sends SYN segment to initiate a connection.
    • Indicates sequence number for communication.
  2. SYN + ACK:
    • Server responds with SYN-ACK.
    • Acknowledges receipt and provides its sequence number.
  3. ACK (Acknowledge):
    • Client sends ACK to acknowledge server's segment.
    • Connection established, ready for data transfer.

Importance

  • Provides reliable communication using Positive Acknowledgement with Re-transmission (PAR).
  • Resends data units until acknowledged.
  • Ensures segments are not damaged using checksum.
  • Establishes a reliable TCP connection with three exchanged segments.

Conclusion

  • TCP 3-Way Handshake is crucial for establishing a secure and reliable connection.
  • Ensures synchronization and readiness for data transmission, a key element of TCP/IP networks.