If the amount of data to be transmitted between two devices is small, it is possible for the sending device to transmit all the data immediately, because the receiving device will have sufficient resources to hold the data. However, generally this is not the case and thus a method to control the flow of data must be adopted. The two most common methods are X-on/X-off and the window mechanism.
X-on/X-off
One method used in error control is that of echo checking. In addition to performing (manual) error control it simultaneously performs elementary flow control. If the receiver runs out of buffer storage, it will cease echoing characters back to the terminal screen. Hence the user will automatically stop keying-in further characters. However, normally the lack of echoed characters from the computer is as a result of temporary overloading. In this instance, if the user does not cease to refrain from transmitting new characters, the computer incurs further and unnecessary processing overheads.
Consequently an automatic flow control facility is often invoked to ensure that a terminal does not send any further characters until an overhead condition has been resolved. In order to achieve this, the computer returns a special control character X-OFF to the controlling device within the terminal, instructing it to cease transmission. On receipt of the X-OFF character, the terminal either ignores any further characters entered at the keyboard or stores them in a local buffer. When the overload condition has lapsed the computer is able to accept further characters and consequently it returns a companion control character X-ON to inform the terminal control device that it may restart sending characters.
It should be noted that there are two distinct methods of employing the X-ON/X-OFF protocol - either in the software or in a piece of hardware such as a printer.
The Window Mechanism
If the sender, P, of data blocks may transmit frames continuously to a receiver, S, before obtaining any acknowledgments then it is possible for the destination to run out of buffer storage. Therefore it is usual to introduce an additional regulating action into such schemes. Essentially a limit is set on the number of information frames that can be sent before receiving an acknowledgment. P monitors the number of outstanding (unacknowledged) frames currently held in the retransmission list. If the destination side of the link is unable to pass on the frames sent to it, S terminates returning acknowledgment frames. The retransmission list at P builds up and this in turn can be interpreted as a signal for P to stop transmitting further frames, until acknowledgments commence once more.
In order to implement this scheme a maximum limit is set on the number of frames that can be awaiting acknowledgment and hence outstanding in the retransmission list. This limit is the send window for the link. The limit is normally selected so that, providing the destination is able to pass on or absorb all frames it receives, the send window does not impair the flow of frames across the link.
Factors such as the maximum frame size, available buffer storage and transmission bit rate must be considered.
As each frame is transmitted, the upper window edge and the lower window edge are both incremented by unity. The acceptance of any new message blocks and hence the flow of frames is stopped if the difference between the two edges becomes equal to the send window. Assuming error-free transmission the send window is a fixed windows which moves (slides) over the complete set of frames being transmitted. Thus this technique has become known as "sliding window".
A technique known as piggybacking is occasionally incorporated in the above approach, primarily when full duplex transmission is operating. When a data frame arrives, instead of immediately sending a separate control frame, the receiver refrains itself and waits until the network layer passes it the next packet. The acknowledgment frame is attached to the outgoing data frame and hence the obvious advantages are: