Connected: An Internet Encyclopedia When to Send Data

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1122
Prev: When to Send a Window Update
Next: TCP Connection Failures When to Send Data When to Send Data

A TCP MUST include a SWS avoidance algorithm in the sender.

A TCP SHOULD implement the Nagle Algorithm [TCP:9] to coalesce short segments. However, there MUST be a way for an application to disable the Nagle algorithm on an individual connection. In all cases, sending data is also subject to the limitation imposed by the Slow Start algorithm (Section


The Nagle algorithm is generally as follows:

Some applications (e.g., real-time display window updates) require that the Nagle algorithm be turned off, so small data segments can be streamed out at the maximum rate.


The sender's SWS avoidance algorithm is more difficult than the receivers's, because the sender does not know (directly) the receiver's total buffer space RCV.BUFF. An approach which has been found to work well is for the sender to calculate Max(SND.WND), the maximum send window it has seen so far on the connection, and to use this value as an estimate of RCV.BUFF. Unfortunately, this can only be an estimate; the receiver may at any time reduce the size of RCV.BUFF. To avoid a resulting deadlock, it is necessary to have a timeout to force transmission of data, overriding the SWS avoidance algorithm. In practice, this timeout should seldom occur.

The "useable window" [TCP:5] is:

       U = SND.UNA + SND.WND - SND.NXT

i.e., the offered window less the amount of data sent but not acknowledged. If D is the amount of data queued in the sending TCP but not yet sent, then the following set of rules is recommended.

Send data:

  1. if a maximum-sized segment can be sent, i.e, if:

                min(D,U) >= Eff.snd.MSS;

  2. or if the data is pushed and all queued data can be sent now, i.e., if:

               [SND.NXT = SND.UNA and] PUSHED and D <= U

    (the bracketed condition is imposed by the Nagle algorithm);

  3. or if at least a fraction Fs of the maximum window can be sent, i.e., if:

               [SND.NXT = SND.UNA and]
                       min(D.U) >= Fs * Max(SND.WND);

  4. or if data is PUSHed and the override timeout occurs.

Here Fs is a fraction whose recommended value is 1/2. The override timeout should be in the range 0.1 - 1.0 seconds. It may be convenient to combine this timer with the timer used to probe zero windows (Section

Finally, note that the SWS avoidance algorithm just specified is to be used instead of the sender-side algorithm contained in [TCP:5].

Next: TCP Connection Failures

Connected: An Internet Encyclopedia When to Send Data