COMPUTER NETWORKS/Student Engineering Notebook
Page 09·notes
TRANSPORT LAYER, TCP FLOW & CONGESTION CONTROL—~26 MIN READ

TCP Handshake, Flow Control & Congestion Control

“SYN/ACK sequence tracking, advertised window, cwnd and ssthresh dynamics.”

1.TCP Connection Management: 3-Way Handshake & Teardown

TCP is a connection-oriented, reliable, byte-stream transport protocol. Before application data flows, a 3-way handshake establishes sequence numbers and buffer parameters:

1. Step 1 (Client -> Server): Client sends SYN segment (SYN=1, ACK=0) with initial sequence number seq = x. Consumes 1 sequence number.

2. Step 2 (Server -> Client): Server responds with SYN+ACK segment (SYN=1, ACK=1) with its own initial sequence number seq = y and acknowledgment ack = x + 1. Consumes 1 sequence number.

3. Step 3 (Client -> Server): Client sends ACK segment (SYN=0, ACK=1) with seq = x + 1 and ack = y + 1. May carry payload.

Connection Teardown (Modified 4-Way Handshake): Either end can initiate termination by sending a FIN segment. The receiving side sends ACK (half-close), finishes transmitting its remaining data, and sends its own FIN segment. The initiator acknowledges with ACK and enters the TIME_WAIT state (2 * MSL = Maximum Segment Lifetime, typically 2 minutes) to ensure the final ACK arrives.

2.TCP Congestion Control Architecture: Tahoe vs Reno

TCP regulates its sending rate dynamically using two state variables: cwnd (Congestion Window, maintained by sender) and rwnd (Receiver Advertised Window, sent in TCP header).

Actual Transmission Window W = min(cwnd, rwnd).

The three main phases of TCP congestion control are:

1. Slow Start: cwnd starts at 1 MSS (Maximum Segment Size). For EVERY ACK received, cwnd increases by 1 MSS. Thus, over each RTT, cwnd DOUBLES exponentially: 1 -> 2 -> 4 -> 8 -> 16... until cwnd >= ssthresh (Slow Start Threshold).

2. Congestion Avoidance: Once cwnd reaches ssthresh, cwnd increases LINEARLY by 1 MSS per RTT (Additive Increase: cwnd = cwnd + 1/cwnd per ACK).

3. Multiplicative Decrease on Packet Loss:

Case A — Loss detected by Timeout: Severe congestion! Set ssthresh = max(cwnd / 2, 2 MSS). Set cwnd = 1 MSS. Re-enter Slow Start.

Case B — Loss detected by 3 Duplicate ACKs (Fast Retransmit): Mild congestion! Retransmit missing segment immediately without waiting for timeout.

In TCP Tahoe: Set ssthresh = cwnd / 2; reset cwnd = 1 MSS (enters Slow Start).

In TCP Reno (Fast Recovery): Set ssthresh = cwnd / 2; set cwnd = ssthresh + 3 MSS; then continue Congestion Avoidance (linear growth). Avoids slow-start penalty!

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATION2 Marks (High Frequency)

3. GATE Worked Numerical: TCP cwnd Evolution & Threshold Calculation

⚠️ Pitfall Warning:

Check whether loss is due to TIMEOUT or 3 DUPLICATE ACKs, and whether the question specifies TCP Tahoe or TCP Reno!

Problem: A TCP connection has initial ssthresh = 16 MSS. cwnd starts at 1 MSS. A timeout occurs during transmission round 7. Find the value of ssthresh and cwnd in round 8, 9, and 10.

Step 1: Trace cwnd per round from start (Slow Start doubles cwnd every RTT until ssthresh):

Round 1: cwnd = 1 MSS

Round 2: cwnd = 2 MSS

Round 3: cwnd = 4 MSS

Round 4: cwnd = 8 MSS

Round 5: cwnd = 16 MSS (reaches ssthresh = 16! Switches to Congestion Avoidance)

Round 6: cwnd = 17 MSS (additive increase +1)

Round 7: cwnd = 18 MSS -> TIMEOUT OCCURS!

Step 2: On Timeout in Round 7:

New ssthresh = cwnd / 2 = 18 / 2 = 9 MSS.

New cwnd resets to 1 MSS.

Step 3: Continue tracing from Round 8:

Round 8: cwnd = 1 MSS (Slow Start, doubles each RTT)

Round 9: cwnd = 2 MSS

Round 10: cwnd = 4 MSS

Round 11: cwnd = 8 MSS

Round 12: cwnd = 9 MSS (hits new ssthresh = 9, switches to linear increase).

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Computer Networking: A Top-Down Approach (8th Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Knowledge Gate · Computer Networks for GATE↗Instructor: Sanchit Jain · Covers: OSI/TCP-IP layers, sliding window, CRC, subnetting, TCP congestion control

GATE-level numerical drilling and PYQ analysis.

Open YouTube↗
Gate Smashers · Computer Networks Full Course↗Instructor: Varun Singla · Covers: Ethernet, IP addressing, routing algorithms, TCP/UDP, DNS & HTTP

Step-by-step conceptual walkthroughs with worked GATE numericals.

Open YouTube↗
Neso Academy · Computer Networks Series↗Instructor: Neso Academy · Covers: Data link layer, framing, error detection, medium access, TCP/IP

Clear whiteboard lectures for foundational and semester exam coverage.

Open YouTube↗