Byte Stuffing Sender Receiver

Byte stuffing is framing technique in which we add special characters (called flag) to distinguish beginning and end of a frame. This technique only works with text data.

In above technique there is problem when flag encounter as data. To overcome this problem we again introduce new special character (called Escape).  The escape characters have a predefined pattern. The receiver removes the escape character and keeps the data part. It cause to another problem, if the text contains escape characters as part of data. To deal with this, an escape character is prefixed with another escape character.

Byte Stuffing Sender Receiver Example