TCP · the byte stream and its windows

TCP does not send “packets”: it numbers the bytes of the application and slides a window over them. Every band shares the same byte axis; step through and watch the variables of the sender and the receiver.

Sender TCP (A): state variables

Receiver TCP (B): state variables

Sequence diagram (one row per tick; segments take half a tick)
Segments exchanged so far
Scenario parameters

Model used in class: time in ticks, one segment per host and tick, half a tick of propagation, a single retransmission timer, cumulative ACKs, fast retransmit on the third duplicate ACK, no window probe (the sender waits for the window update). The connection is assumed open; A's segments carry AN=2048 and W=512. With congestion control: cwnd in MSS, slow start adds 1 per acknowledged segment up to ssthresh, congestion avoidance counts N + c/N, fast recovery on the third duplicate ACK (ssthresh = cwnd/2, cwnd = ssthresh + 3) and back to slow start with cwnd = 1 when the timer expires.

About this visualization

Step-by-step simulation of a TCP transfer seen as a byte stream. Five bands share the same axis of sequence numbers: the file of the sending application in MSS-sized pieces, the sender TCP with the acknowledged, sent-but-unacknowledged and usable zones and its sliding window, the segments and ACKs in flight, the receive buffer with the data received in sequence, the data stored out of order and the free space, and what the receiving application has already read. Every step shows and explains Kurose's variables (SendBase, NextSeqNum, LastByteSent, LastByteAcked, rwnd, RcvBuffer, LastByteRead, LastByteRcvd), the timer, the duplicate ACKs and, with congestion control, the congestion window, ssthresh, the mode and the number of segments congestion still allows. Below, the sequence diagram in ticks (segments take half a tick) and the table of segments with SN, AN, W and Data. Nine scenarios: a transfer with no incidents, a slow receiving application with a zero window and a window update, a loss recovered by the retransmission timer, three duplicate ACKs and fast retransmit, a lost ACK covered by the next cumulative one, slow start and congestion avoidance, the sender window as the minimum of the congestion and receive windows, fast recovery, and back to slow start after a timeout. The model is the one used in the course exercises: one segment per host and tick, a one-tick delayed ACK, a single timer and TCP Reno. The file size, MSS, buffer, timer, lost segments and ACKs and the reading pace can be changed, and a scenario and step can be linked with the URL fragment (for example, #rapida/24).

Concepts: byte stream and sequence numbers, sliding window, SendBase and NextSeqNum, flow control and receive window, receive buffer, zero window and window update, cumulative, delayed and duplicate ACKs, retransmission timer, fast retransmit, congestion window and ssthresh, slow start, congestion avoidance and fast recovery, sequence diagram.

Formulas:

Network Architecture I, Session 3.3 · Enrique de la Hoz, University of Alcalá · License CC BY-SA 4.0 · Source and catalogue on GitHub · DOI 10.5281/zenodo.23285664