Framing Techniques
You'll learn: How the Data Link Layer delimits chunks of raw bit streams into distinguishable frames for transmission.
The Framing Problem
When data flows across a physical link as a continuous stream of bits, the receiving station needs to know where one frame ends and the next begins. Without clear boundaries, the receiver can't tell if 10111001 is one frame, two frames, or part of a larger message. Framing techniques solve this delimitation problem by marking frame boundaries in the bit stream.
Three Common Framing Methods
1. Byte-Stuffing (Character Stuffing)
Uses special flag bytes (like FLAG) to mark frame start and end. If that flag pattern appears naturally in the data payload, the sender "stuffs" an escape byte (ESC) before it. The receiver removes these escape bytes.
Analogy: Like using quotation marks in writing—if your sentence contains a quote, you escape it: He said "hello" becomes He said \"hello\".
2. Bit-Stuffing
The sender inserts extra bits into the data stream to prevent accidental flag patterns. For example, if the flag is 01111110, the sender inserts a 0 after every five consecutive 1s in the data. The receiver automatically removes these stuffed bits.
Analogy: Like a word-wrap algorithm that breaks lines to avoid overflow—automatic and invisible to the end user.
3. Length Field
The frame header includes a field specifying the frame's length in bytes. The receiver reads this length and knows exactly how many bytes follow.
Analogy: Like a package label that says "Contains 10 items"—you count ten and know you're done.
Key Takeaway: Framing techniques use byte-stuffing, bit-stuffing, or explicit length fields to reliably mark frame boundaries in a continuous bit stream, enabling the receiver to extract individual frames correctly.