Skip to main content
InterviewHubPRO
Section Overview
Q2

Question 2 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

4%
Networking & Protocols (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

How does the TCP 3-Way Handshake establish a connection?

junior LevelCode Examplenetworking-protocolsBasic

In Simple Words: Before exchanging data, TCP establishes a reliable connection:

  1. SYN (Synchronize): Client chooses an Initial Sequence Number ($ISN_C$) and sends SYN packet to server.
  2. SYN-ACK: Server acknowledges ($ACK = ISN_C + 1$), chooses its own sequence number ($ISN_S$), and sends SYN-ACK.
  3. ACK: Client acknowledges ($ACK = ISN_S + 1$). Connection state is now ESTABLISHED; data transfer can begin!
text
TCP 3-Way Handshake:
[Client] ─── SYN (Seq=X) ────────────► [Server]
[Client] ◄── SYN-ACK (Seq=Y, Ack=X+1) ─ [Server]
[Client] ─── ACK (Seq=X+1, Ack=Y+1) ──► [Server]
[Connection Established!]