Skip to content

Syllabus · CS Computer Science and Information Technology

All topics in this subject
C programming foundations7
Arrays and pointers9
Recursion6
Probability and statistics foundations9
Database systems foundations15
Linear algebra foundations6
Computer networks foundations9
Calculus foundations6
Theory of computation foundations9
Compiler design foundations9
Linked lists, stacks and queues5
Trees, BSTs and heaps4
Graph foundations3
Algorithms foundations15
Discrete mathematics foundations18
Digital logic foundations22
Computer organization foundations12
Operating systems foundations15

Transport connections and congestion

Lesson 154 of 1798 minFree

Scope and assumptions

Connect transport multiplexing, TCP reliability, receiver flow control and network congestion control. Numerical congestion examples use an explicitly simplified Reno-style teaching model; they are not claims that every deployed TCP implementation grows identically. Bytes and segments must never be silently interchanged. MSS means maximum TCP data bytes per segment, excluding TCP/IP headers.

1. UDP, TCP and sockets

UDP preserves datagram boundaries and adds ports, length and checksum in an8-byte header. It does not inherently establish a connection, retransmit loss, guarantee order or provide congestion/flow control. Applications may implement additional mechanisms above it. The UDP length includes its header and data. Its checksum uses a pseudo-header as well as UDP content; in IPv4 a zero checksum field can indicate no checksum, while general IPv6 rules differ. A successful local send does not prove remote delivery.

TCP provides an ordered reliable byte stream between endpoints, with full-duplex independent sequence spaces. It does not preserve application write boundaries: two writes may be read together, and one write may require several reads. Applications need their own framing, such as lengths or delimiters. TCP reliability does not guarantee bounded delivery time or that a disconnected peer's application processed the bytes.

A socket is an operating-system communication endpoint abstraction. A typical TCP server creates a socket, binds a local address/port, listens and accepts connections. Accept returns a connected socket while the listening socket remains available for others. A client connects to the server endpoint and generally uses an ephemeral local port. An established TCP connection is identified by source IP, source port, destination IP and destination port within the TCP protocol. Multiple connections can share the same server port when their endpoint tuples differ. Typical UDP use binds as needed and uses sendto/recvfrom; connecting a UDP socket selects a default peer locally without creating a TCP-style handshake.

2. TCP setup, numbering and closure

The ordinary three-way handshake synchronizes initial sequence numbers in both directions. If client ISN100 and server ISN700, the client sends SYN seq100; server sends SYN+ACK seq700 ack101; client sends ACK seq101 ack701. SYN consumes one sequence number even with no data. The client’s first data byte is101, the server’s701. ACK numbers indicate the next byte expected, cumulatively acknowledging all earlier contiguous bytes.

Suppose client sends300 bytes starting seq101. Bytes101…400 are covered and the next expected byte is401. If a later segment501…600 arrives while401…500 is missing, the cumulative ACK remains401, although optional SACK can describe additional received ranges. TCP numbers bytes rather than segments. Retransmitting the same bytes retains their sequence positions; it does not allocate fresh numbers.

A FIN also consumes one sequence number and closes one sending direction. The other direction can remain open, allowing half-close. FINs and ACKs may be combined, so “exactly four packets to close” is not universal. RST aborts a connection rather than performing orderly FIN closure. TIME-WAIT helps handle delayed duplicates and retransmission of the final acknowledgment in ordinary active-close cases; it does not mean the connection is still delivering new application data.

3. Flow control and available send allowance

The receiver advertises a receive window rwnd reflecting buffer availability. The sender also maintains congestion window cwnd reflecting network constraints. Ignoring recovery-specific adjustments, total permitted outstanding data is bounded by min(rwnd,cwnd). The additional allowance is max(0,min(rwnd,cwnd)−bytes_in_flight), not the whole window again. ACKs and window updates change these values. A zero advertised window pauses ordinary new-data sending; probing avoids permanent deadlock if a reopening update was lost.

Worked example: rwnd12000 bytes, cwnd8000 and5000 bytes outstanding. The current additional allowance is3000 bytes. If MSS1000, that is three full segments. If rwnd falls to6000, allowance becomes1000, even though cwnd remains8000. rwnd protects the receiver; cwnd responds to congestion. A large receiver buffer does not authorize unlimited traffic.

4. Loss detection and timeout estimation

TCP uses retransmission timers and acknowledgment evidence. Duplicate ACKs can suggest that later bytes arrived beyond a gap; under the classic fast-retransmit rule, three duplicate ACKs trigger retransmission without waiting for the timer. Reordering can also produce duplicate ACKs, so they are evidence rather than proof of loss. Retransmission timeout backs off after expiry. A too-short timer causes unnecessary retransmissions; a too-long timer delays recovery.

For the standard estimator after initialization, RTTVAR=(1−beta)×RTTVAR+beta×|SRTT−R| and SRTT=(1−alpha)×SRTT+alpha×R, using the OLD SRTT in the deviation update, with alpha1/8 and beta1/4. RTO=SRTT+max(G,4×RTTVAR), followed by applicable minimum bounds. Example old SRTT100 ms, RTTVAR20 ms and sample140 ms: new RTTVAR25 ms, new SRTT105 ms, raw RTO205 ms if clock granularity G≤100 ms. RFC6298’s recommended lower bound then raises this to1 second; a question using a different explicit teaching floor must say so. Ambiguous RTT samples from retransmitted data are avoided in the basic Karn approach unless timestamps disambiguate them.

5. Slow start and congestion avoidance

In ideal slow start, each ACK for new data increases cwnd so an ACK-per-segment round approximately doubles the window:1,2,4,8 MSS. The name does not mean linear growth. At the slow-start threshold ssthresh, the sender transitions to congestion avoidance; in the ideal classic model the growth is roughly1 MSS per RTT, an additive increase. Delayed ACKs, byte-counting rules, application limitation and modern algorithms change the exact pattern. State initial cwnd and threshold; do not assume all real TCP starts at1 MSS.

Worked round model: start cwnd1 MSS, ssthresh8 MSS; round-start windows1,2,4,8,9,10 if each round is fully acknowledged and growth switches at8. The first four rounds send1+2+4+8=15 segments under these artificial round boundaries. If an event occurs midround, use the question's event rules rather than extrapolating the table.

For classic loss handling, ssthresh is based on flight size, commonly max(FlightSize/2,2 MSS), not automatically half the configured receive window. On retransmission timeout the classic congestion window reduces to1 MSS and slow start resumes. In Reno fast recovery after three duplicate ACKs, ssthresh is reduced, cwnd is temporarily inflated to account for data believed to have left the network, and the missing segment is retransmitted. After recovery, congestion avoidance proceeds around ssthresh. A simplified question may say “halve cwnd on triple duplicates”; label that as its model. Tahoe, Reno, NewReno and modern controls must not be treated as identical.

6. Rate checks and pitfalls

Ignoring headers and losses, a stable byte window B and feedback RTT T yield window-limited throughput about B/T, capped by path bottleneck capacity. For B64000 bytes and RTT0.04 s, the rate is1.6 MB/s=12.8 Mb/s. If the bottleneck is10 Mb/s, it caps throughput at10 Mb/s before overhead. Bandwidth-delay product at10 Mb/s and40 ms is400000 bits=50000 bytes. Neither formula proves application goodput under loss.

Before solving, identify direction, sequence-number meaning, payload bytes, flight size and the controlling window. Distinguish duplicate ACKs from duplicate data. Ports identify transport endpoints, while IP routes packets between hosts/interfaces. TCP checksum is not cryptographic authentication. UDP’s lower protocol overhead does not imply guaranteed lower latency under every application workload.

Original practice: six single-correct MCQs

These original teaching questions are not previous-year questions. Choose exactly one answer.

P01. A TCP SYN uses sequence900 with no data. What is the first subsequent data byte number?

A. 900 B. 901 C. 902 D. 0

Answer: B

A: SYN consumes one sequence position.

B: The next byte is901.

C: Only one position was consumed.

D: Sequence numbers do not reset after SYN.

P02. TCP sends250 bytes beginning at sequence1001. With all received in order, which cumulative ACK follows?

A. 1250 B. 1251 C. 1002 D. 250

Answer: B

A: 1250 is the last byte, not next expected.

B: The next expected byte is1001+250=1251.

C: ACK advancement counts bytes, not one segment.

D: ACK is an absolute sequence-space position, not a byte count alone.

P03. rwnd=9000, cwnd=6000 and flight size=4000 bytes. What is the ordinary additional send allowance?

A. 2000 bytes B. 4000 bytes C. 6000 bytes D. 9000 bytes

Answer: A

A: min(9000,6000)−4000=2000.

B: 4000 is already outstanding.

C: 6000 is the total limit, not remaining allowance.

D: The smaller congestion window also constrains sending.

P04. Which TCP application assumption is unsafe?

A. Received bytes are ordered within the stream B. A connection supports both directions C. One send call always corresponds to exactly one receive call D. Ports help identify endpoints

Answer: C

A: Ordered delivery is a TCP stream property.

B: TCP is full duplex.

C: TCP preserves bytes, not application call boundaries.

D: Ports participate in endpoint identification.

P05. In the stated ideal round model, cwnd starts1 MSS with ssthresh4 MSS. What are the first five round-start windows?

A. 1,2,4,8,16 B. 1,2,3,4,5 C. 1,2,4,5,6 D. 4,4,4,4,4

Answer: C

A: This ignores the threshold transition.

B: This incorrectly makes initial slow start linear.

C: Double until4, then add1 each RTT in this model.

D: The initial window was specified as1.

P06. Which socket statement is correct for a typical TCP server?

A. accept replaces TCP with UDP B. All clients must use different server listening ports C. accept returns a connected socket while the listening socket remains D. UDP connect performs a TCP three-way handshake

Answer: C

A: accept does not change transport protocol.

B: Different client tuples can share a server port.

C: The listening endpoint continues accepting other connections.

D: UDP connect does not perform the TCP handshake.

Sources and scope

Aligned to the 2026 course. This lesson covers the stated slice, not the entire Computer Networks syllabus. All numerical examples and questions are original. No claim of 2027 completeness.

Sign in to keep your progress. Sign in