---
title: "Byte stuffing and piggybacking"
subject: "Computer Networks and Security"
chapter: 3
key: "semester_7/computer_networks_and_security:byte-stuffing-piggybacking"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/byte-stuffing-piggybacking
site: BCT Engineering
---

# Byte stuffing and piggybacking

Computer Networks and Security · Chapter 3: Data Link Layer

- Asked in: 2073 Chaitra, 3+2 marks
- Video: [Character or Byte Stuffing](https://www.youtube.com/watch?v=YTnylISRQZg) — TutorialsPoint
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/byte-stuffing-piggybacking
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-3

## Question

What is meant by byte stuffing technique? What is piggy backing?

## Short answer

Byte stuffing uses a FLAG byte to delimit frames, and an ESC byte before any FLAG or ESC in data to preserve transparency. Piggybacking attaches acknowledgements to outgoing data frames in bidirectional communication, avoiding separate ACK frames and saving bandwidth.

## Answer

#### Byte stuffing
Byte (character) stuffing is a framing technique in which each frame is delimited by a special **FLAG byte** at the start and end. If the FLAG pattern appears inside the data, the sender inserts a special **ESC (escape) byte** before it. The same is done if ESC itself appears in the data. The receiver removes the ESC byte it finds before a FLAG or ESC and takes the next byte as data. This keeps data transparent.

```text
 Data     : A  FLAG  B  ESC  C
 Stuffed  : FLAG A ESC FLAG B ESC ESC C FLAG
```
Used in PPP and in byte-oriented protocols.

#### Piggybacking
Piggybacking is a technique in bidirectional (full-duplex) communication where an **acknowledgement for received frames is attached to the next outgoing data frame** instead of being sent as a separate ACK frame. The ACK field is in the data frame header.

Advantages: better use of bandwidth and fewer frames. If no data is ready to send, the receiver waits a short time for outgoing data and then sends a separate ACK to avoid a timeout at the sender. It is used in sliding window protocols.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does byte stuffing insert and when?
   A. A 0 after five 1s
   B. An ESC byte before FLAG or ESC in the data
   C. A CRC byte
   D. A count byte
   Answer: B. ESC before FLAG or ESC in data keeps it transparent. (Key point: Byte stuffing)

2. What does the receiver do on finding ESC?
   A. Keeps it
   B. Removes it and takes the next byte as data
   C. Ends the frame
   D. Requests retransmission
   Answer: B. The ESC is stripped and the following byte is treated as data. (Key point: Receiver action)

3. What is piggybacking?
   A. Sending two frames together
   B. Attaching the ACK to the next outgoing data frame
   C. Compressing data
   D. Retransmitting twice
   Answer: B. The ACK rides in the header of a data frame, saving a separate ACK frame. (Key point: Piggybacking)

4. If no data is ready, what does the receiver do?
   A. Never acknowledges
   B. Waits briefly, then sends a separate ACK to avoid timeout
   C. Sends NAK
   D. Drops the frame
   Answer: B. A separate ACK prevents the sender's timeout. (Key point: Piggyback timer)
