Because a sender and receiver can't always process data at the same rate, some method of negotiating when to start and stop transmission is required. The Serial Driver supports two methods of controlling serial data flow. One method relies on the serial port hardware; the other is implemented in software.
Hardware flow control uses two of the serial port signal lines to control data transmission. When the Serial Driver is ready to accept data from an external device, it asserts the Data Terminal Ready (DTR) signal on pin 1 of the serial port, which the external device receives through its Data Set Ready (DSR) input.
Flow control can also be handled in software by using an agreed-upon set of characters as start and stop signals. The Serial Driver supports XON/XOFF flow control, which typically assigns the ASCII DC1 character (also known as control-Q) as the start signal and the DC3 character (Device Code3 (control-S)) as the stop signal, although you can choose different characters.
Obviously, the flow control is done as a part of the data stream; you need to insert special things in your data to make it flow or stop. This technique is called in-band signaling. The two biggest disadvantages of in-band signaling are that you continuously need to monitor the data stream, at high speed, to find the signals, and if one of the DTE happens to send an In-band Signal as part of the data, unpredictable things may happen! See In-band flow part for more information.
Handshaking
The method of exchanging signals for data flow control between computers and data sets is called handshaking. The most popular and most often used handshaking variant is called XON/XOFF; it's done by software, while other methods are hardware-based.


XON/XOFF
Two bytes that are not mapped to normal characters in the ASCII char set are called XON (Device Code1 (DC1), Ctrl-Q, ASCII 17) and XOFF (Device Code3 (DC3), Ctrl-S, ASCII 19). Whenever, either one of the sides wants to interrupt the data flow from the other (e.g. full buffers), it sends an XOFF Transmission Off. When its buffers have been purged again, it sends an XON Transmission On to signal that data can be sent again. With some implementations, this can be any character.
XON/XOFF is of course limited to text transmission. It cannot be used with binary data since binary files tend to contain every single one of the 256 characters. That's why hardware handshaking is normally used with modems, while XON/XOFF is often used with printers and plotters and terminals.


DTR/DSR
The Data Terminal Ready and Data Set Ready signals of the serial port can be used for handshaking purposes, too. Their names express what they do: the computer signals with DTR that it's ready to send and receive data, while the data set sets DSR. With most modems, the meaning of these signals is slightly different: DTR is ignored or causes the modem to hang up if it is dropped, while DSR signals that a connection has been established.


RTS/CTS
While DTR and DSR is mostly used to establish a connection, RTS and CTS have been specially designed for data flow control. The computer signals with RTS Request To Send that it wishes to send data to the data set, while the data set (modem) sets CTS Clear To Send when it's ready to do one part of its job: to send data through the phone wires.


Out-of-band Flow Control
Using a separate channel for signaling (than the voice or data channel).
The separate channel may be physically separate wires, or may be a time-multiplexed channel (such as an ISDN channel). While this often costs more it ensures that the full bandwidth is available for the voice or data.
For example, an EIA-232 interface using RTS/CTS (Request to Send/Clear to Send) flow control is out-of-band flow control, since these signals (pins 4 and 5) are separate from the data.


In-Band Flow Control
As in In-bandwidth, that is, using the same bandwidth (wires or data channel) for signaling (sending control information) as for data transmission.
Examples of in-band signaling include the following:
  • On an EIA-232 interface, sending and receiving the x-on and x-offx-on or x-off characters in them) flow control characters (11_16 and 13_16) on pins 2 and 3--that is, as part of the sent and received data (this means that the data cannot have any
  • On a standard touch-tone (DTMF) telephone or service type II switched 56 data set, sending the phone number dialed to the central office on the same pair of wires that the voice or data communications uses
While usually less expensive to implement than an out-of-band signaling method, in-band signaling is usually undesirable, since it restricts or disrupts the data that can be sent.

Also, in-band signaling leaves the possibility that users can inadvertently (or purposely) affect the signaling.

For example, on standard telephone connections the telephone company uses a 2,600-Hz tone to indicate that a long-distance call is completed, and sending one at the right time can provide free long-distance calls. People who often call themselves "phone freaks" make or buy blue boxes, which can generate this tone. Mind you, this is theft of telecommunications services, a bad thing to do. The Usenet newsgroup alt.2600 has many people trying to fool others that they have done this, trying to entrap people that do this, and claiming that others are trying to entrap others.