skip to content

TCP

Handshake, byte sequencing with sliding windows, and congestion control turn lossy IP packets into an ordered stream. Interviewers lean on it because slow or stalled connections trace back here.

on this pageshow

questions

page 2 of 2

In a TCP SYN flood from spoofed source addresses, what server state fills up, why do those entries linger, and why do legitimate clients fail to connect?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Each SYN leaves a half-open connection in SYN-RECEIVED, held in a limited per-port backlog. Spoofed sources never answer, so entries wait out the server's SYN-ACK retries; with the backlog full, new SYNs are ignored or evict others, and real clients' connects stall.

open as a page

Why does a long-lived TCP connection through a stateful firewall hang and fail on the first request after an idle period, and should you fix it with TCP keepalive or an application heartbeat?

level: seniorimportance: should knowfreq 30%

basics

~20 s

The firewall's idle timer expired and it deleted the connection's state without telling either endpoint, so later segments are dropped or reset. Send traffic more often than that timer: TCP keepalive with a short idle time, or an application heartbeat.

open as a page

After a TCP sender retransmits a segment and an ACK covering it arrives, why must it not take an RTT sample from that ACK, and what keeps the timeout sane instead?

level: seniorimportance: should knowfreq 24%

basics

~20 s

The ACK cannot say which copy it acknowledges, so the RTT is ambiguous; Karn's algorithm discards such samples. The RTO, doubled on each timeout, is kept until new data is acknowledged without retransmission. The timestamp option removes the ambiguity.

open as a page

Why does losing the last segment of a TCP response often stall it for a whole RTO, while a mid-stream loss recovers in about one round trip?

level: seniorimportance: should knowfreq 28%

basics

~20 s

Fast retransmit needs later segments to produce duplicate ACKs; a tail loss has too few behind it, so only the RTO, normally at least 1 s (RFC 6298), recovers it. RACK-TLP (RFC 8985) instead probes after about 2 x SRTT.

open as a page

Over a site-to-site tunnel, TCP handshakes and small requests succeed but large downloads stall; why does clamping the MSS in passing SYNs fix it?

level: seniorimportance: should knowfreq 28%

basics

~20 s

Endpoints derive MSS from their own 1500-byte links, but tunnel encapsulation shrinks the path MTU, so full-sized segments are dropped and, with ICMP feedback filtered, never shrink. Rewriting passing SYNs' MSS to fit the tunnel stops oversized segments being built.

open as a page

What problem does TCP selective acknowledgment (SACK) solve that cumulative ACKs cannot, and why must a sender still keep data a SACK block reported?

level: seniorimportance: should knowfreq 24%

basics

~20 s

Cumulative ACKs report only the contiguous prefix, so several losses in one window surface about one per round trip. SACK blocks describe data held beyond the gap but are advisory, so data is freed only once the cumulative ACK passes.

open as a page

A TCP client opens short-lived connections to one server IP and port and closes each one first; what caps its sustained new-connection rate, and how do you compute it?

level: seniorimportance: should knowfreq 35%

basics

~20 s

Toward one server socket only the client port varies, and the client, closing first, holds each port in TIME-WAIT for 2×MSL. Ceiling: usable ports divided by that time — 16,384 ports over RFC 9293's 240 s is about 68 per second.

open as a page

When a TCP server shows thousands of connections stuck in CLOSE-WAIT while the clients calling it show thousands in TIME-WAIT, what does each pile mean, and which one is a bug?

level: seniorimportance: should knowfreq 42%

basics

~20 s

CLOSE-WAIT piles up where the peer has closed but the local application never calls close: almost always a connection leak. TIME-WAIT piles up on the active closer under high connection churn: normal, and it clears itself after 2×MSL.

open as a page

What happens in TCP when two endpoints send each other a SYN at the same time, and how many segments does that simultaneous open take?

level: middleimportance: nice to knowfreq 12%

basics

~20 s

Each side, in SYN-SENT, receives a SYN without an ACK, moves to SYN-RECEIVED and sends a SYN-ACK repeating its own ISN. Each SYN-ACK moves its receiver to ESTABLISHED: four segments, one connection. RFC 9293 requires every TCP to support it.

open as a page

What is silly window syndrome in TCP, and how do the sender and the receiver each avoid it?

level: middleimportance: nice to knowfreq 14%

basics

~20 s

Silly window syndrome is a stable TCP pattern of tiny window openings filled by tiny segments. RFC 9293 requires both sides to avoid it: receivers withhold small window increases, senders wait for a worthwhile amount to send.

open as a page

How does a UDP socket differ from a TCP socket in the socket API, and what does calling connect() on a UDP socket actually do?

level: middleimportance: nice to knowfreq 22%

basics

~20 s

A UDP socket never listens or accepts: one bound socket trades datagrams with any peer, sendto naming the destination and recvfrom returning one whole datagram and its sender. connect() on UDP sends nothing; it sets a default peer and filters locally.

open as a page

Why does a TCP Reno flow take minutes to regain its window on a 1 Gbps, 100 ms path after one loss, and how does CUBIC's growth change that?

level: seniorimportance: nice to knowfreq 18%

basics

~20 s

A 1 Gbps, 100 ms path needs about 8,333 full-sized packets in flight; after halving, Reno adds one segment per round trip, so it needs about 4,167 round trips, roughly 7 minutes. CUBIC cuts less and regrows along a time-based cubic curve.

open as a page

When a TCP path's round-trip time suddenly jumps from 80 ms to about 2 seconds, why does the sender retransmit data that was never lost, and how can it tell afterwards?

level: seniorimportance: nice to knowfreq 15%

basics

~20 s

An RTO built from 80 ms samples sits at the 1 s floor, so a 2 s delay fires it while the originals are merely late. An ACK echoing the original's TSval, or a D-SACK for the duplicate, exposes the spurious timeout.

open as a page

Why are TCP's window scale, SACK-permitted and timestamps options confined to SYN segments, and what breaks if a middlebox strips one from the SYN-ACK?

level: seniorimportance: nice to knowfreq 18%

basics

~20 s

These options change how the whole connection behaves, so they are offered in the SYN before data flows. Window scale and timestamps apply only if both SYN and SYN-ACK carry them; stripping one from the SYN-ACK leaves the two ends disagreeing.

open as a page

A TCP bulk transfer across per-packet load-balanced parallel links shows frequent fast retransmits although the path drops almost nothing: what in TCP's acknowledgment behaviour explains this?

level: seniorimportance: nice to knowfreq 18%

basics

~20 s

A TCP receiver sends an immediate duplicate ACK for each segment arriving above a gap, and a reordered segment leaves the same gap as a lost one. Overtaken by three or more segments, it triggers fast retransmit of data that was only late.

open as a page

In TCP, what is TIME-WAIT assassination as described in RFC 1337, and why does it undermine the protection TIME-WAIT is meant to give?

level: seniorimportance: nice to knowfreq 12%

basics

~20 s

An old duplicate segment reaches an endpoint in TIME-WAIT; its ACK reaches a peer with no record of the connection, which answers RST, and the reset ends TIME-WAIT early, exposing a reopened connection to stale segments.

open as a page

showing 31–46 of 46