Fact-checked by Grok 2 weeks ago

Software flow control

Software flow control, also known as XON/XOFF flow control, is a method used in data communications to regulate the transmission rate between a sender and by embedding special control characters within the itself, allowing the to signal when to pause or resume data flow without requiring additional signals. This technique operates in-band, meaning the control signals are transmitted over the same channel as the primary data, typically in asynchronous serial links such as RS-232. The initiates flow control by sending an XOFF character (ASCII code 19, equivalent to Control-S or DC3) to the sender when its input buffer approaches capacity, prompting the sender to halt transmission temporarily. Once the has processed enough data to free up buffer space, it sends an XON character (ASCII code 17, equivalent to Control-Q or DC1) to instruct the sender to resume. This mechanism ensures that the receiver is not overwhelmed, preventing due to . In contrast to hardware flow control, which relies on dedicated control lines like Request to Send (RTS) and Clear to Send (CTS) for signaling, software flow control is simpler and more cost-effective as it does not necessitate extra wiring or circuitry. However, it carries limitations, including vulnerability to interference in streams where XON or XOFF characters may appear naturally, potentially causing unintended pauses, and it introduces slight due to the processing of these inline characters. Software flow control finds primary application in legacy environments, terminal emulation software, and certain network protocols, such as the Telnet remote flow control option, where it enables efficient data handling in resource-constrained or software-driven systems. Its adoption dates back to early computing eras, integrated into standards for teletype and terminal operations to manage punch tape and printer outputs.

Fundamentals

Definition and Purpose

Software flow control, also known as XON/XOFF flow control, is an technique used in serial communications to regulate data transmission rates between a sender and receiver. It operates by embedding specific control characters directly within the data stream over point-to-point links, such as (also referred to as EIA-232), to instruct the transmitter to pause (via XOFF) or resume (via XON) sending data. This method is inherently software-based, relying on the devices' protocols to detect and act upon these characters without additional hardware intervention. The core purpose of software flow control is to prevent in the receiving device by enabling it to dynamically a faster transmitter, thereby preserving in asynchronous serial environments where processing speeds or buffer sizes may mismatch. In scenarios involving character-oriented data transmissions, such as text-based protocols, it ensures reliable delivery by pausing transmission when the receiver's approaches capacity and resuming once space is available, avoiding that could occur from unchecked high-speed input. This approach is particularly valuable in legacy or resource-constrained systems lacking dedicated control lines. As a subset of broader flow control strategies, software flow control is distinguished by its character-oriented nature, where it interprets and responds to embedded signals in the primary data channel, making it suitable for asynchronous links but incompatible with streams that might interpret control characters as . Unlike hardware-based alternatives, it achieves flow regulation solely through software processing over the existing transmit and receive lines, promoting simplicity in cabling while depending on mutual protocol agreement between communicating devices.

Historical Development

Software flow control emerged in the alongside the development of early computer terminals and teletypewriters, driven by the need to manage data transmission in resource-limited environments. The ASR-33, introduced in 1963 by , played a pivotal role in its origins by utilizing ASCII control characters DC1 (Device Control 1, also known as XON or Ctrl-Q) and DC3 (Device Control 3, also known as XOFF or Ctrl-S) to control auxiliary devices such as the automatic tape reader. In this context, DC1 initiated tape reading operations, while DC3 halted them, preventing mechanical overload and data garbling during paper tape and terminal interactions. This mechanism evolved into a de facto standard for software-based transmission regulation in early computer systems, particularly as serial interfaces proliferated before the full adoption of hardware flow control protocols. The ASCII standard (ANSI X3.4-1963), published that same year, formalized DC1 and DC3 as generic device control characters without prescribing specific flow control semantics, but their practical application in teletype operations filled this gap for simple, in-band signaling in hardware-constrained setups. By the 1970s, with the widespread implementation of RS-232 serial standards (initially defined in 1960 and revised in 1969), software flow control persisted as a lightweight alternative, especially in minicomputers and terminals where additional wiring for hardware signals was impractical. Although lacking a dedicated formal standard from bodies like ITU or IEEE, software flow control became ubiquitous in operating systems and communications by the 1980s, integrated into drivers for pausing and resuming output to manage buffer overflows. Key events included the shift from mechanical teletypes like the Model 33 to electronic terminals in the late and , which retained XON/XOFF compatibility for . Its prominence waned after the with the rise of dedicated hardware flow control in high-speed networks, yet it endures in software emulations and legacy serial applications.

Technical Details

Representation in Data Streams

Software flow control employs specific control characters embedded within the data stream to manage transmission pacing. The primary characters are XON, which signals the resumption of data transmission, and XOFF, which instructs a pause in transmission. XON corresponds to ASCII control code DC1 (decimal 17, hexadecimal 0x11, equivalent to Ctrl+Q), while XOFF is ASCII DC3 (decimal 19, hexadecimal 0x13, equivalent to Ctrl+S). These characters are transmitted in-band, meaning they are sent directly as part of the serial data stream over the standard transmit (TX) and receive (RX) lines, without requiring dedicated hardware signals or additional wiring beyond the basic RS-232 interface. This approach integrates flow control seamlessly into the primary communication channel, leveraging the existing ASCII framework for compatibility with character-oriented protocols. The encoding of XON and XOFF typically adheres to 7-bit ASCII standards, though 8-bit extensions are common in modern implementations to support extended character sets. In scenarios involving transmission, where arbitrary byte values may coincide with XON or XOFF codes, these characters must be escaped to prevent unintended flow triggers. Common escaping techniques include prefixing the offending byte with a designated (such as DLE, hexadecimal 0x10) or doubling the byte itself, allowing the receiver to distinguish data from signals. While XON/XOFF represents the for software flow control due to its widespread adoption and compatibility, some systems employ variants such as ETX (End of Text, ASCII code 3) paired with for acknowledgment-based pausing, or entirely custom control codes tailored to specific protocols. These alternatives are less common and typically limited to legacy or specialized environments where standard ASCII controls are insufficient.

Operational Mechanism

In software flow control, the continuously monitors the occupancy of its incoming to prevent . When the reaches a high —typically around 80% of its capacity—the generates and transmits an back to over the , instructing it to pause . The continues to accept and incoming during this period, gradually reducing the level until it falls below a low , at which point the sends an to signal readiness for resumed . Upon interpreting the XOFF character, the sender immediately halts further data transmission after completing the current byte in progress, transitioning into a "stopped" state where it locally buffers any pending outgoing data to avoid loss. The sender remains in this state until it receives an XON character, at which point it resumes transmission and returns to the "transmitting" state. To manage potential signal loss, some implementations incorporate timeouts, ensuring the protocol does not indefinitely. A typical operational sequence occurs in a terminal-to-printer , where the printer, upon nearing capacity while receiving print data from , transmits an XOFF to . The host then pauses its output stream, allowing the printer to and clear its ; once sufficient is available, the printer sends an XON, prompting to continue sending data. For enhanced reliability in edge cases, robust implementations may have the receiver periodically transmit XON characters while in a ready state to counteract potential loss of prior signals. The protocol operates without formal acknowledgments for these control characters, relying on an assumption of an error-free channel to maintain synchronization between sender and receiver.

Comparative Analysis

With Hardware Flow Control

Hardware flow control in serial communications, particularly under the (EIA-232) standard, relies on dedicated signals transmitted via additional pins to regulate flow between devices. The primary mechanism involves the Request to Send (RTS) signal, asserted by the (DTE) to indicate transmission readiness, and the Clear to Send (CTS) signal, asserted by the (DCE) to confirm reception capability. Alternative signals like (DTR) and Data Set Ready (DSR) may also be used in some configurations. These signals operate independently of the channel, using voltage levels of +3V to +15V for assertion and -3V to -15V for negation. Software flow control differs fundamentally from this hardware approach by operating in-band over the data lines, requiring only two wires (transmit and receive) at minimum, whereas hardware methods demand at least four wires for the control signals. This in-band nature makes software flow control more cost-effective and simpler to implement without extra , but it exposes the to interference where data bytes might mimic control characters like XOFF, potentially disrupting flow erroneously. Hardware flow control avoids such issues through its segregated signaling, providing greater from data content. A primary advantage of software flow control in comparison to is its compatibility with minimal cabling setups, enabling reliable operation over modems or lines without necessitating hardware modifications or additional pins. This makes it ideal for resource-constrained or legacy environments where simplicity trumps performance. However, software flow control exhibits notable drawbacks relative to hardware methods, including a potential of up to 15 characters for control and , elevated CPU overhead for continuous , and susceptibility to errors such as triggering false halts via misinterpreted XOFF characters. In contrast, hardware flow control delivers instantaneous response through direct signal assertion, minimizing delays and enhancing reliability, especially for where control characters could occur naturally. It also reduces the risk of buffer overruns in high-throughput scenarios. Use case distinctions further highlight these trade-offs: software flow control suits low-speed legacy systems with baud rates below 9600, where cabling simplicity outweighs minor delays, while hardware flow control is preferred for modern UART-based applications supporting speeds up to 115200 or higher, prioritizing low and robustness in performance-critical setups.

With Higher-Layer Flow Control

Higher-layer flow control, as implemented in transport protocols like , operates at the end-to-end level across networks to regulate data transmission rates based on receiver capabilities. In , this is achieved through a sliding window mechanism where the receiver advertises its available buffer space (the window size) in (ACK) packets, allowing the sender to adjust its transmission rate dynamically and prevent . This approach ensures reliable delivery over multi-hop paths by integrating flow control with error detection and retransmission, contrasting with the more localized scope of software flow control. Key differences between software flow control and higher-layer methods like lie in their architectural layers and operational scopes. Software flow control functions at the , providing point-to-point, character-oriented regulation typically via in-band signals like XON/XOFF for serial connections, without support for or multi-hop traversal. In contrast, operates at the , employing packet-based sliding windows for end-to-end control across potentially congested networks, and incorporates congestion avoidance algorithms such as Reno, which uses additive increase and multiplicative decrease based on , or Cubic, which employs a for more aggressive window growth in high-bandwidth-delay product environments. These higher-layer mechanisms address network-wide variability, including round-trip time (RTT) estimations, whereas software flow control remains confined to direct links without inherent or path adaptation. Software flow control offers advantages in immediacy and simplicity for serial links, enabling rapid, low-overhead pausing and resumption of data streams without dedicated hardware signals, making it suitable for resource-constrained, point-to-point setups. However, TCP's higher-layer approach provides greater for modern networks through its ability to handle variable delays and integrate congestion control, though this introduces complexity from RTT calculations and . On the downside, software flow control is limited to near-unidirectional control and lacks built-in error recovery, potentially leading to if control characters are misinterpreted in binary streams, while TCP combines flow control with reliability features like selective retransmissions and adapts to diverse network conditions. In terms of , software flow control is often layered beneath higher-layer protocols in scenarios like serial-over-IP tunneling, where RFC 2217 extends to negotiate and manage serial port parameters, including XON/XOFF signaling, over connections for remote access. Despite this compatibility in legacy integrations, has largely superseded software flow control for contemporary networked applications due to its robust end-to-end guarantees and support for internet-scale communication.

Applications

In Legacy Systems

Software flow control, particularly through the XON/XOFF protocol, played a crucial role in managing data transmission in legacy systems reliant on serial communications, such as RS-232 interfaces, where hardware limitations necessitated in-band signaling to prevent buffer overflows. In RS-232 terminals like the VT100, XON/XOFF ensured orderly processing of characters and commands by requiring minimal software support on the host side, allowing the terminal to pause and resume output as needed during interactive sessions. Similarly, dot-matrix printers connected via RS-232 used software flow control to pause text output when internal buffers filled, maintaining reliable printing on slower mechanical devices without dedicated hardware handshaking lines. Acoustic modems adhering to the Hayes command set, common in dial-up connections during the 1980s and 1990s, incorporated XON/XOFF through commands like AT&K4 to enable software flow control, facilitating stable data exchange over variable telephone lines. In protocols like , introduced in 1979 for Unix-to-Unix file transfers, software flow control via XON/XOFF was integrated to handle serial line constraints, with default characters set to manage flow in packet-based error-correcting modes. Early Systems (BBS), which relied on dial-up modems for remote access, similarly employed XON/XOFF to regulate character streams during file downloads and message navigation, ensuring compatibility with asynchronous serial connections. Manual pausing in text editors and console applications, such as using Ctrl+S (XOFF) to stop scrolling output, became a standard feature in legacy environments, originating from teletypewriter conventions to halt display when users needed to review content. Specific devices exemplified these applications: Teletype terminals, including the Model 33 ASR, adopted XOFF (DC3) and XON (DC1) codes for software flow control to synchronize slow mechanical printing with faster host transmissions. Early personal computers, such as the IBM PC with its serial ports under , supported XON/XOFF in serial communications software like for interactions and peripheral control, allowing direct hardware access without advanced buffering. Minicomputers like the PDP-11 utilized XON/XOFF for console I/O, where the RT-11 operating system enabled recognition of Ctrl/Q (XON) and Ctrl/S (XOFF) characters to manage terminal interactions on serial lines. This reliance on software flow control persists in modern terminal emulators and simulators, such as and SIMH's PDP-11 emulator, which default to XON/XOFF support for with 1970s-1990s behaviors, enabling accurate reproduction of legacy protocols in contemporary environments.

In Modern Contexts

In contemporary software environments, terminal emulators continue to leverage software flow control to manage s over connections, including those tunneled via SSH or emulated as COM ports. , a widely used SSH and client, supports XON/XOFF by configuring the flow control option to send and receive these characters within the , preventing overflows during interactions. Similarly, Tera Term enables XON/XOFF in its port setup menu, allowing users to select it alongside baud rate and parity settings for reliable communication with devices. On systems, tools like minicom and facilitate software flow control; minicom activates it through the configuration menu (Ctrl-A followed by O, then selecting software flow control), while screen relies on underlying stty commands to enable XON/XOFF for sessions, supporting SSH-tunneled access without dependencies. These implementations ensure with COM ports provided by USB-to-serial drivers, maintaining in software-defined environments. In embedded systems and applications, software flow control remains essential for handling low-bandwidth sensor data streams on resource-constrained devices. The microcontroller's UART peripheral, as implemented in the ESP-IDF framework, provides built-in support for XON/XOFF through configurable functions that detect and transmit these characters to pause or resume transmission, preventing buffer overruns in sensor networks. USB-to-serial adapters using chips, common in IoT prototyping, incorporate XON/XOFF in their drivers to manage flow without additional hardware lines, enabling seamless integration with microcontrollers for data from low-speed sensors like temperature or humidity monitors. For Arduino-based projects, while the core library lacks native XON/XOFF, developers implement it via custom code to monitor buffers and insert control characters, supporting reliable in bandwidth-limited IoT setups. Beyond core tools, software flow control appears in specialized debugging and communication scenarios. In GDB remote debugging over serial links, flow control settings, including XON/XOFF, are configured via the host's serial parameters to ensure stable packet transmission between the debugger and target device. Software-defined radios (SDRs) utilize it for control streams over serial interfaces, where XON/XOFF helps regulate command flows to radio hardware without overwhelming buffers during spectrum analysis or tuning operations. Recent trends indicate a resurgence of software flow control in hobbyist and retro computing projects, driven by the emulation of vintage hardware via modern USB-serial interfaces. Enthusiasts interfacing with 1980s-era terminals or consoles often enable XON/XOFF to replicate original behaviors, addressing modern driver limitations that previously hindered compatibility. Silicon Labs UART drivers in 2020s firmware offer partial XON/XOFF support, requiring application-level handling of buffer monitoring and character insertion, which facilitates its use in embedded hobbyist designs like custom retro emulators. This revival underscores software flow control's adaptability in niche, low-overhead applications where hardware alternatives are impractical.

References

  1. [1]
    RFC 1372: Telnet Remote Flow Control Option
    Software flow control uses one or two specific characters sent along the same path as normal input data. Most commonly, XOFF (control-S) and XON (control-Q) ...
  2. [2]
    [PDF] Serial Ports
    Feb 17, 2016 · ◇ Software flow control – message at a time. • “XON” – ($11) OK, I'm ready to receive the next message. • “XOFF” – ($13) Wait; I can't ...<|control11|><|separator|>
  3. [3]
    [PDF] AN0059.0: UART Flow Control - Silicon Labs
    UART software flow control (XON/XOFF) is partially supported by the driver, the application should monitor the received data during the data transmission, and ...
  4. [4]
  5. [5]
  6. [6]
    RS232 Software Handshaking: XON/XOFF EXT/ACK
    The "X" in the name means "transmitter," so XON and XOFF are commands for switching a transmitter on or off, respectively. When X-ON is received at the ...
  7. [7]
    [PDF] EIA 232 Info - Digi
    ○ Software flow control uses special START (XON) and STOP (XOFF) characters embedded in the data stream to gate flow. In other words, the receiving device ...
  8. [8]
    [PDF] RS-232 Frequently Asked Questions - Texas Instruments
    The Xon/Xoff operates by sending the control characters along the data line. Command Xon starts the transmission and Xoff stops it.
  9. [9]
    What is Xon / Xoff Software Flow Control? - Brainboxes
    ### Summary of XON/XOFF Software Flow Control
  10. [10]
    ASR-33 Teletype - CHM Revolution - Computer History Museum
    At a cost to computer makers of roughly $700, the ASR-33 was a popular input and output device for minicomputers. It was originally designed as a low cost ...Missing: software flow control XON XOFF origins
  11. [11]
    [PDF] TELETVPE® - Bitsavers.org
    Bulletin 3l0B is a technical manual that provides general and specific information about the 33 Receive-Only (RO), Keyboard Send-Receive (KSR), and.
  12. [12]
    World Power Systems:Texts:Annotated history of character codes
    ASCII-1963, formally known as ASA (later USASA, later still ANSI) standard X3.4-1963, is part of a series of standards; others specify how codes such as ASCII ...
  13. [13]
    termios(3) - Linux manual page - man7.org
    IXON Enable XON/XOFF flow control on output. IXANY (XSI) Typing any character will restart stopped output. (The default is to allow just the START character ...<|control11|><|separator|>
  14. [14]
  15. [15]
    RS232 Handshaking and Flow Control - Xon \ Xoff - Windmill Software
    RS232 handshaking, or flow control, stops data when either the PC or instrument is not ready. Xon/Xoff is a software protocol using ASCII characters 17 and 19.Missing: codes | Show results with:codes
  16. [16]
    Flow Control - PCCOM
    Flow control uses hardware (DTR/DSR) or software (XON/XOFF) to control data transmission, using special characters as start/stop signals.Missing: definition | Show results with:definition<|control11|><|separator|>
  17. [17]
    RS232 flow control and handshaking - Lammert Bies
    RS232 flow control uses software (XON/XOFF) or hardware (RTS/CTS) to control data flow, stopping when the receiver needs to pause.Missing: codes | Show results with:codes
  18. [18]
    Understanding RS232: Comprehensive Guide to Cables & Connectors
    Software handshaking, often referred to as Xon/Xoff flow control, uses specific ASCII characters to control the pause and resume of data transmission. While ...
  19. [19]
    How to send xon/xoff in case of binary data? - uart - Stack Overflow
    Oct 22, 2013 · In case of software data flow control, we use xon and xoff (0x11 and 0x13) standard characters to pause and resume transmission. But if we ...What does XON/XOFF flow control actually do? - Stack OverflowRs232 software flow control - Stack OverflowMore results from stackoverflow.com
  20. [20]
    [PDF] AN232B-09 Using the Modem Emulation Mode in FTDI's VCP Driver
    Both the XOn/XOff characters and the escape character are definable. The standard ones will be: XOn - 0x11. XOff - 0x13. EscChar - 0x10. Transmitter.
  21. [21]
    Text-Terminal-HOWTO: Flow Control (Handshaking)
    Flow control must both be set at the terminal and at the computer. There are 2 types of flow control: hardware and software (Xon/Xoff or DC1/DC3). Hardware flow ...
  22. [22]
    Notes on Flow Control for High Speed Networks - Dip Singh
    Aug 5, 2025 · When the receiver's buffer occupancy hits a high watermark threshold, it sends an XOFF signal, instructing the sender to immediately stop ...
  23. [23]
    Fundamentals of RS-232 Serial Communications - Analog Devices
    Mar 29, 2001 · The EIA-232 levels are defined as ±5V into 5kΩ. With a new low-dropout output stage, Maxim introduced RS-232 transceivers with internal charge ...
  24. [24]
    The RS232 Standard - CAMI Research
    Tutorial discussion of the RS232 (EIA232) standard with signal names, definitions, and examples.Missing: variants codes
  25. [25]
    RFC 793 - Transmission Control Protocol - IETF Datatracker
    TCP recovers from internet communication system errors. Flow Control: TCP provides a means for the receiver to govern the amount of data sent by the sender.
  26. [26]
    Flow Control vs. Congestion Control in TCP - Baeldung
    Mar 18, 2024 · Introduction to Sliding Window Protocol. One of the popular flow control mechanisms in TCP is the sliding window protocol. It's a byte-oriented ...
  27. [27]
    Flow Control - GeeksforGeeks
    Oct 14, 2025 · It is a technique that ensures proper management of data flow between a sender and receiver, especially when both operate at different speeds or ...
  28. [28]
    TCP Congestion Control Algorithms: Reno, New Reno, BIC, CUBIC
    Jan 31, 2024 · The New Reno TCP congestion manage algorithm is an enhancement to the unique Reno algorithm and addresses certain obstacles discovered in Reno.
  29. [29]
    RFC 9438: CUBIC for Fast and Long-Distance Networks
    CUBIC is a standard TCP congestion control algorithm that uses a cubic function instead of a linear congestion window increase function to improve scalability ...Table of Contents · Design Principles of CUBIC · CUBIC Congestion Control
  30. [30]
    What does XON/XOFF flow control actually do? - Stack Overflow
    Jun 12, 2019 · XON/XOFF are used for flow control. If you are processing the information and can't receive any more because your input buffers are full, ...How to send xon/xoff in case of binary data? - uart - Stack Overflowvb.net - Reading Xon-Xoff Standard Protocol - Stack OverflowMore results from stackoverflow.com
  31. [31]
    RFC 2217: Telnet Com Port Control Option
    This memo proposes a protocol to allow greater use of modems attached to a network for outbound dialing purposes.
  32. [32]
    Selecting the serial flow control scheme - PuTTY Documentation
    'XON/XOFF': flow control is done by sending XON and XOFF characters within the data stream. 'RTS/CTS': flow control is done using the RTS and CTS wires on the ...
  33. [33]
    Tera Term (Windows) - Serial Terminal Basics - SparkFun Learn
    If you need to adjust the serial settings, go up to Setup > Serial Port. You'll see a window pop up with a lot of familiar looking serial port settings.<|separator|>
  34. [34]
    Getting Started With Minicom
    Jul 13, 2017 · This page sets out to provide general information about using minicom to communicate between EMAC machines and a development PC.
  35. [35]
    Universal Asynchronous Receiver/Transmitter (UART) - ESP32
    The overview describes how to establish communication between an ESP32 and other UART devices using the functions and data types of the UART driver. A typical ...
  36. [36]
    Flow Control - FTDI Knowledgebase
    XON/XOFF - flow control is done by sending or receiving special characters. ... It is strongly encouraged that flow control is used because it is impossible to ...Missing: ESP32 Arduino embedded
  37. [37]
    Xon/Xoff In Arduino? - Networking, Protocols, and Devices
    May 3, 2023 · XonXoff is software control, no additional hardware required. Generally is is used with full duplex communications.
  38. [38]
    Remote Configuration (Debugging with GDB) - Sourceware
    GDB remote configuration includes setting address size, serial baud rate, parity, interrupt signals, hardware watchpoint limits, and TCP connection timeouts.Missing: XON/ XOFF
  39. [39]
    Device communication protocols - AWS IoT Core
    AWS IoT Core supports devices and clients that use the MQTT and the MQTT over WebSocket Secure (WSS) protocols to publish and subscribe to messages.Missing: SDR radio serial flow legacy