XON/XOFF
From Wikipedia, the free encyclopedia
XON/XOFF is software data flow communications protocol for controlling the flow of data between computers and other devices. X stands for transmitter. This is frequently referred to as "software flow control".
Typically the receiver will send an XOFF character when it can't take any more data (e.g. it may need time to process something), and when it can once again take more data, will send an XON character to the transmitter.
The software must be written to respond to these characters, and to both insert them into and extract them from the original data stream.
[edit] The Protocol for Terminals
The XON/XOFF protocol is controlled by the recipient of the data being transferred. The recipient sends an XOFF character to the sender of the data if it is unable to continue to receive data. The sender then suspends the transmission of data. When the receiver can accept data again, it sends the XON character to the sender, and the transmission of data is resumed.
Assuming that receive pacing is enabled at a terminal (this is not the terminal's default setting), the terminal will send an XOFF character if any one of the following occur:
The terminal is placed in local mode. (Remote mode is necessary to communicate to the computer; refer to the manual that came with the terminal for an explanation of local and remote modes.)
The terminal's buffer (a temporary data storage area) fills up because data is being received faster than the terminal is able to display it.
The terminal user presses [CTRL]-S. (Pressing [Stop] on HP239x terminals also sends the XOFF character to the computer. Note that this key is a toggle switch; the second time it is pressed, it sends an XON character to the computer, the third time, an XOFF character, and so forth.)
After a terminal sends an XOFF character, the DTC waits indefinitely for an XON character. The terminal user can press [CTRL]-Q to send an XON character.
The ASCII Code for XON is Hex 11 (DC1) and for XOFF Hex 13 (DC3).
[edit] The Protocol for Printers
A printer will send an XOFF character if any one of the following occur:
- The printer is placed off-line.
- The printer runs out of paper.
- The paper in the printer jams.
- The printer's buffer fills up because data is being received faster than the printer is able to process it.
When printers (using printer type files 21, 22, or 26) send an XOFF character to the computer, an internal timer (called the XOFF timer) starts. If the timer expires before the printer sends an XON character, a message is sent to the system console. The message informs the operator that intervention is needed to get the printer to function again. After a printer using printer type file 18 sends an XOFF character to the computer, the computer waits indefinitely for the XON character, but no message is sent to the system console.
[edit] Protocol Assumptions
Use of the XON/XOFF protocol assumes the following:
- Full-duplex communication lines are used.
- The attached devices are capable of using the XON/XOFF protocol.
- The attached devices are capable of transmitting and receiving simultaneously.
These requirements are met if supported devices and cables are used.