Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Flag bytes with byte stuffing framing method

We had seen in previous article framing, that to send packets from sender to the receiver framing is required. But the question was how the receiver will identify the starting and ending of a frame. For receiver, starting and ending of a frame is necessary to recognize the next frames transmitted by the sender.

So in this case Flag bytes with byte stuffing framing method will support.

  1. In this method a flag byte, is used as both the starting and ending of a frame. See in the  figure below.
  2. Two consecutive flag bytes indicate the end of one frame and the start of the next frame.
  3.  If the receiver ever loses synchronization it can just search for two flag bytes to find the end of the current frame and the start of the next frame.

What if accidental unwanted flag bytes occur in the data?

To prevent from wrong flag bytes, escape byte (ESC) is inserted just before each ‘‘accidental’’ flag byte in the data. As shown in the figure below.

The data link layer on the receiving end removes the ESC before giving the data to the network layer. This technique is called byte stuffing.

What if accidental unwanted ESC occur in the data?

This unwanted ESC is also stuffed with an escape byte (ESC). As shown in the figure below.