SlideShare a Scribd company logo
1 of 10
Layer-2 Data Link Layer
Bit Stuffing & Byte Stuffing
Introduction
• Data link layer is responsible for something called Framing, which is the division of a stream of bits
from the network layer into manageable units (called frames).
• Each frame consists of the sender’s address and a destination address. The destination address
defines where the packet is to go and the sender’s address helps the recipient acknowledge the
receipt.
• Frames could be fixed size or variable size.
• In fixed-size framing, there is no need for defining the boundaries of the frames as the size itself can
be used to define the end of the frame and the beginning of the next frame.
• But, in variable-size framing, we need a way to define the end of the frame and the beginning of the
next frame.
Introduction
• To separate one frame from the next, an 8-bit (or 1-byte) flag is
added at the beginning and the end of a frame.
• But the problem with that is, any pattern used for the flag could
also be part of the information. So, there are two ways to
overcome this problem:
1. Using Byte stuffing (or character stuffing)
2. Using Bit stuffing
Comparison
Feature Byte stuffing Bit stuffing
Definition
A technique used to prevent the occurrence of a specific byte in a
data stream by adding an extra byte.
A technique used to prevent the occurrence of a specific bit
sequence in a data stream by inserting an additional bit.
Concept Adds an extra byte to the data when a special byte is found. Adds an extra bit to the data when a special bit pattern is found.
Special byte/bit Flag byte (01111110) Flag bit pattern (01111110)
Insertion Extra byte is inserted after each occurrence of the flag byte. Extra bit is inserted after each occurrence of the flag bit pattern.
Removal The extra byte is removed at the receiver end. The extra bit is removed at the receiver end.
Comparison
Feature Byte stuffing Bit stuffing
Efficiency Less efficient due to the addition of an extra byte. More efficient as only an extra bit is added.
Applications Used in protocols like PPP and HDLC. Used in protocols like Ethernet and Token Ring.
Objective
To ensure data integrity and prevent data loss due to errors caused by
the presence of a specific byte in the data stream.
To ensure data integrity and prevent data loss due to errors
caused by the presence of a specific bit sequence in the data
stream.
How it works
The specific byte is replaced with a unique escape byte, followed by a
second byte that indicates the original byte’s value.
The specific bit sequence is replaced with a unique bit sequence
that indicates the original bit sequence’s value.
Byte stuffing
• It is a byte (usually escape character(ESC)), which has a predefined bit pattern is added to
the data section of the frame when there is a character with the same pattern as the flag.
• Whenever the receiver encounters the ESC character, it removes it from the data section
and treats the next character as data, not a flag.
• But the problem arises when the text contains one or more escape characters followed by
a flag.
• To solve this problem, the escape characters that are part of the text are marked by
another escape character i.e., if the escape character is part of the text, an extra one is
added to show that the second one is part of the text.
Example:
Bit stuffing
• Mostly flag is a special 8-bit pattern “01111110” used to define the beginning and the end of the
frame.
• Problem with the flag is the same as that was in the case of byte stuffing.
• So, in this protocol what we do is, if we encounter 0 and five consecutive 1 bits, an extra 0 is added
after these bits.
• This extra stuffed bit is removed from the data by the receiver.
• The extra bit is added after one 0 followed by five 1 bits regardless of the value of the next bit.
• Also, as the sender side always knows which sequence is data and which is flag it will only add this
extra bit in the data sequence, not in the flag sequence.
Example:
• Byte stuffing: It is used to convert a message format of a sequence of
bytes that may contain reserved values into another byte sequence that
does not contain reserved values. It is also known as character-oriented
framing. Here, a special byte is stuffed before flag and esc also that special
byte is escape(ESC).
• Bit stuffing: It is used for inserting one or more non-information bits into
a message to be transmitted, to break message sequence for
synchronization. It is also known as bit-oriented framing. Here,0 bit stuffed
after five consecutive 1 bits.i.e extra bit is added after five consecutive
ones.

More Related Content

Similar to 1Bit and Byte Stuffing computer networks

mod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesmod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesanandhakrishnankv
 
mod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesmod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesanandhakrishnankv
 
data link layer to print
data link layer to printdata link layer to print
data link layer to printBishalWosti1
 
data link layer to print
data link layer to printdata link layer to print
data link layer to printBishalWosti1
 
DataLinkControl.ppt
DataLinkControl.pptDataLinkControl.ppt
DataLinkControl.pptMaddalaSeshu
 
DataLinkControl.ppt
DataLinkControl.pptDataLinkControl.ppt
DataLinkControl.pptMaddalaSeshu
 
unit2-210710110327.pdf
unit2-210710110327.pdfunit2-210710110327.pdf
unit2-210710110327.pdfssuser3aa461
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSDr. SELVAGANESAN S
 
unit2-210710110327.pdf
unit2-210710110327.pdfunit2-210710110327.pdf
unit2-210710110327.pdfssuser3aa461
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSDr. SELVAGANESAN S
 

Similar to 1Bit and Byte Stuffing computer networks (20)

Framing Protocols
Framing ProtocolsFraming Protocols
Framing Protocols
 
Framing Protocols
Framing ProtocolsFraming Protocols
Framing Protocols
 
mod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesmod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notes
 
mod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notesmod-3-cn-ppt (1).pdf bca bsc btech notes
mod-3-cn-ppt (1).pdf bca bsc btech notes
 
data link layer to print
data link layer to printdata link layer to print
data link layer to print
 
data link layer to print
data link layer to printdata link layer to print
data link layer to print
 
DataLinkControl.ppt
DataLinkControl.pptDataLinkControl.ppt
DataLinkControl.ppt
 
DataLinkControl.ppt
DataLinkControl.pptDataLinkControl.ppt
DataLinkControl.ppt
 
unit2-210710110327.pdf
unit2-210710110327.pdfunit2-210710110327.pdf
unit2-210710110327.pdf
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
 
unit2-210710110327.pdf
unit2-210710110327.pdfunit2-210710110327.pdf
unit2-210710110327.pdf
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
 
Data link layer
Data link layerData link layer
Data link layer
 
Data link layer
Data link layerData link layer
Data link layer
 
Ethernet Frames Explained
Ethernet Frames ExplainedEthernet Frames Explained
Ethernet Frames Explained
 
Ethernet Frames Explained
Ethernet Frames ExplainedEthernet Frames Explained
Ethernet Frames Explained
 
Unit 2 [autosaved]
Unit 2 [autosaved]Unit 2 [autosaved]
Unit 2 [autosaved]
 
Unit 2 [autosaved]
Unit 2 [autosaved]Unit 2 [autosaved]
Unit 2 [autosaved]
 
Unit 2 ppt 3.ppt
Unit 2 ppt 3.pptUnit 2 ppt 3.ppt
Unit 2 ppt 3.ppt
 
Unit 2 ppt 3.ppt
Unit 2 ppt 3.pptUnit 2 ppt 3.ppt
Unit 2 ppt 3.ppt
 

More from Manimaran A

2 Data Transmission Concepts and Terminology.ppt
2 Data Transmission Concepts and Terminology.ppt2 Data Transmission Concepts and Terminology.ppt
2 Data Transmission Concepts and Terminology.pptManimaran A
 
Transmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksTransmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksManimaran A
 
Dictionaries and Tolerant Retrieval.ppt
Dictionaries and Tolerant Retrieval.pptDictionaries and Tolerant Retrieval.ppt
Dictionaries and Tolerant Retrieval.pptManimaran A
 
History of Data Visualization
History of Data VisualizationHistory of Data Visualization
History of Data VisualizationManimaran A
 
A study on securing cloud environment from d do s attack to preserve data ava...
A study on securing cloud environment from d do s attack to preserve data ava...A study on securing cloud environment from d do s attack to preserve data ava...
A study on securing cloud environment from d do s attack to preserve data ava...Manimaran A
 
A study on security issues in cloud based e learning
A study on security issues in cloud based e learningA study on security issues in cloud based e learning
A study on security issues in cloud based e learningManimaran A
 

More from Manimaran A (9)

2 Data Transmission Concepts and Terminology.ppt
2 Data Transmission Concepts and Terminology.ppt2 Data Transmission Concepts and Terminology.ppt
2 Data Transmission Concepts and Terminology.ppt
 
Transmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer NetworksTransmission Control Protocol_ Computer Networks
Transmission Control Protocol_ Computer Networks
 
Dictionaries and Tolerant Retrieval.ppt
Dictionaries and Tolerant Retrieval.pptDictionaries and Tolerant Retrieval.ppt
Dictionaries and Tolerant Retrieval.ppt
 
Day-2.pptx
Day-2.pptxDay-2.pptx
Day-2.pptx
 
Day-4.pptx
Day-4.pptxDay-4.pptx
Day-4.pptx
 
Day - 6.pptx
Day - 6.pptxDay - 6.pptx
Day - 6.pptx
 
History of Data Visualization
History of Data VisualizationHistory of Data Visualization
History of Data Visualization
 
A study on securing cloud environment from d do s attack to preserve data ava...
A study on securing cloud environment from d do s attack to preserve data ava...A study on securing cloud environment from d do s attack to preserve data ava...
A study on securing cloud environment from d do s attack to preserve data ava...
 
A study on security issues in cloud based e learning
A study on security issues in cloud based e learningA study on security issues in cloud based e learning
A study on security issues in cloud based e learning
 

Recently uploaded

☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...mikehavy0
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfEr.Sonali Nasikkar
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfSkNahidulIslamShrabo
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentationsj9399037128
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...IJECEIAES
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxrajjais1221
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Toolssoginsider
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligencemahaffeycheryld
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelDrAjayKumarYadav4
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/FootingEr. Suman Jyoti
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfJNTUA
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxProfASKolap
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样A
 

Recently uploaded (20)

☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
☎️Looking for Abortion Pills? Contact +27791653574.. 💊💊Available in Gaborone ...
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdf
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentation
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptx
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/Footing
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Introduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptxIntroduction-to- Metrology and Quality.pptx
Introduction-to- Metrology and Quality.pptx
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
一比一原版(NEU毕业证书)东北大学毕业证成绩单原件一模一样
 

1Bit and Byte Stuffing computer networks

  • 1. Layer-2 Data Link Layer Bit Stuffing & Byte Stuffing
  • 2. Introduction • Data link layer is responsible for something called Framing, which is the division of a stream of bits from the network layer into manageable units (called frames). • Each frame consists of the sender’s address and a destination address. The destination address defines where the packet is to go and the sender’s address helps the recipient acknowledge the receipt. • Frames could be fixed size or variable size. • In fixed-size framing, there is no need for defining the boundaries of the frames as the size itself can be used to define the end of the frame and the beginning of the next frame. • But, in variable-size framing, we need a way to define the end of the frame and the beginning of the next frame.
  • 3. Introduction • To separate one frame from the next, an 8-bit (or 1-byte) flag is added at the beginning and the end of a frame. • But the problem with that is, any pattern used for the flag could also be part of the information. So, there are two ways to overcome this problem: 1. Using Byte stuffing (or character stuffing) 2. Using Bit stuffing
  • 4. Comparison Feature Byte stuffing Bit stuffing Definition A technique used to prevent the occurrence of a specific byte in a data stream by adding an extra byte. A technique used to prevent the occurrence of a specific bit sequence in a data stream by inserting an additional bit. Concept Adds an extra byte to the data when a special byte is found. Adds an extra bit to the data when a special bit pattern is found. Special byte/bit Flag byte (01111110) Flag bit pattern (01111110) Insertion Extra byte is inserted after each occurrence of the flag byte. Extra bit is inserted after each occurrence of the flag bit pattern. Removal The extra byte is removed at the receiver end. The extra bit is removed at the receiver end.
  • 5. Comparison Feature Byte stuffing Bit stuffing Efficiency Less efficient due to the addition of an extra byte. More efficient as only an extra bit is added. Applications Used in protocols like PPP and HDLC. Used in protocols like Ethernet and Token Ring. Objective To ensure data integrity and prevent data loss due to errors caused by the presence of a specific byte in the data stream. To ensure data integrity and prevent data loss due to errors caused by the presence of a specific bit sequence in the data stream. How it works The specific byte is replaced with a unique escape byte, followed by a second byte that indicates the original byte’s value. The specific bit sequence is replaced with a unique bit sequence that indicates the original bit sequence’s value.
  • 6. Byte stuffing • It is a byte (usually escape character(ESC)), which has a predefined bit pattern is added to the data section of the frame when there is a character with the same pattern as the flag. • Whenever the receiver encounters the ESC character, it removes it from the data section and treats the next character as data, not a flag. • But the problem arises when the text contains one or more escape characters followed by a flag. • To solve this problem, the escape characters that are part of the text are marked by another escape character i.e., if the escape character is part of the text, an extra one is added to show that the second one is part of the text.
  • 8. Bit stuffing • Mostly flag is a special 8-bit pattern “01111110” used to define the beginning and the end of the frame. • Problem with the flag is the same as that was in the case of byte stuffing. • So, in this protocol what we do is, if we encounter 0 and five consecutive 1 bits, an extra 0 is added after these bits. • This extra stuffed bit is removed from the data by the receiver. • The extra bit is added after one 0 followed by five 1 bits regardless of the value of the next bit. • Also, as the sender side always knows which sequence is data and which is flag it will only add this extra bit in the data sequence, not in the flag sequence.
  • 10. • Byte stuffing: It is used to convert a message format of a sequence of bytes that may contain reserved values into another byte sequence that does not contain reserved values. It is also known as character-oriented framing. Here, a special byte is stuffed before flag and esc also that special byte is escape(ESC). • Bit stuffing: It is used for inserting one or more non-information bits into a message to be transmitted, to break message sequence for synchronization. It is also known as bit-oriented framing. Here,0 bit stuffed after five consecutive 1 bits.i.e extra bit is added after five consecutive ones.