7.6. FLOW CONTROL 97
Figure 7.10: Evolution in time of the TCP window.
7.6 FLOW CONTROL
Congestion control is the mechanism to prevent saturating routers. Another mechanism, called ﬂow
control, prevents saturating the destination of an information ﬂow and operates as follows in TCP.
The end host of a TCP connection sets aside some buffer space to store the packets it receives until
the application reads them. When it sends a TCP packet, that host indicates the amount of free
buffer space it currently has for that TCP connection. This quantity is called the Receiver Advertised
Window (RAW). The sender of that connection then calculates RAW − OUT where OUT is the
number of bytes that it has sent to the destination but for which it has not received an ACK. That
is, OUT is the number of outstanding bytes in transit from the sender to the receiver. The quantity
RAW − OUT is the number of bytes that the sender can safely send to the receiver without risking
to overﬂow the receiver buffer.
The sender then calculates the minimum of RAW − OUT and its current congestion window
and uses that minimum to determine the packets itcan transmit.This adjustment of theTCP window
combines congestion control and ﬂow control.
The Transport Layer is a set of end-to-end protocols that supervise the delivery of packets.
• The transport layer offers two services: reliable byte stream (with TCP) and unreliable packet
delivery (with UDP) between ports.
• A TCP connection goes through the following phases: Open (with a three-way handshake:
SYN, SYN.ACK, then ACK and start); Data exchange (with data and acks); half-close (with
FIN and FIN.ACK); then a second half-close (with FIN, timed wait, and FIN.ACK).