Skip to content Skip to sidebar Skip to footer

What Does Xon/xoff Flow Control Actually Do?

From what I have been able to discover, XON and XOFF are nothing but special ASCII characters used for handshaking between two serial devices. But it is not clear to me what actual

Solution 1:

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, then you would send XOFF to tell the other party to stop sending. When your input buffers have some room, you would send an XON to tell the other party to start sending again. The applications I've seen (and I did a lot of this many years ago) only use them when needed, not as a standard part of a message.

One of the issues with XON/XOFF is that on a noisy line, these characters might not be received correctly, so the receiving party might send XOFF when the buffer is 80% full, and maybe again when 90% full, and then start sending them more frequently if the sending party doesn't stop.

Similarly, the receiving party might send XON when ready to receive, but if nothing more is received then it might send it periodically to make sure that the first one wasn't missed.

To implement successfully, neither character can appear in any part of the messages. Wikipedia explains some of this better than I can.

In PySerial, you shouldn't have to actually send them explicitly. It will handle it for you or you can use the API to send it.

Post a Comment for "What Does Xon/xoff Flow Control Actually Do?"