Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What is the character count? Explain with an example?
Data link layer translates the physical layer's raw bit stream into discrete messages called frames. The key challenge is determining how a frame can be transmitted so the receiver can recognize the start and end of each frame.
Frame Delimitation Techniques
The techniques used to identify frame boundaries are:
- Character count − Uses a header field to specify frame length
- Flag byte with byte stuffing − Uses special delimiter bytes
- Starting and ending flag with bit stuffing − Uses bit-level delimiters
- Encoding violation − Uses invalid signal patterns as delimiters
Character Count Method
The character count framing method uses a field in the frame header to specify the number of characters (or bytes) in the entire frame, including the count field itself. When the data link layer at the destination reads this count, it knows exactly how many characters follow and can determine where the frame ends.
Example: Normal Operation
Consider data sequence: 1 2 3 4 5 6 7 8 9 0 1 2 3
This data is divided into three frames:
| Frame | Count | Data | Total Characters |
|---|---|---|---|
| Frame 1 | 5 | 1, 2, 3, 4 | 5 (including count) |
| Frame 2 | 5 | 5, 6, 7, 8 | 5 (including count) |
| Frame 3 | 6 | 9, 0, 1, 2, 3 | 6 (including count) |
Problem with Character Count
The major disadvantage of character count is its vulnerability to transmission errors. If the count field itself gets corrupted, the receiver loses synchronization and cannot determine frame boundaries correctly.
Example: Error in Count Field
If the count field in Frame 2 gets corrupted from 5 to 7:
- Frame 1: Correctly received as count=5, data=[1,2,3,4]
- Frame 2: Incorrectly interpreted as count=7, reads [5,6,7,8,6,9] (takes data from next frame)
- Frame 3: Starts with remaining data, causing complete desynchronization
Advantages and Disadvantages
| Advantages | Disadvantages |
|---|---|
| Simple implementation | No error recovery mechanism |
| Efficient use of bandwidth | Single error destroys frame synchronization |
| No special delimiter characters needed | Difficult to resynchronize after errors |
Conclusion
Character count is a simple framing method that uses a header field to specify frame length. However, its vulnerability to count field corruption makes it unsuitable for unreliable transmission media, leading to the adoption of more robust framing techniques in modern networks.
