Chapter 3 Data Link Layer
Chapter 3 Data Link Layer
Framing
1) Character Count.
Answer
Show the bit sequence transmitted (in binary) for the four-character frame: A
B ESC FLAG
When Flag bytes with byte stuffing framing method is used:
Answer
01111110 01000111 11100011 11100000 11100000
Original Data
After
Stuffing
After received
and destuffed
Example
The following character encoding is used in a data link protocol:
A: 01000111;
B: 11100011;
FLAG: 01111110;
ESC: 11100000
Show the bit sequence transmitted (in binary) for the four-character
frame: A B ESC FLAG
When Starting and ending flag bytes, with bit stuffing framing method is
used:
Answer
ANSWER:
Ack.
Ack. Ack.
Attenuation
Delay
Distortion
Noise
p1 : bits 1, 3, 5, 7, 9, 11..
p2 : bits 2,3,6,7,10,11..
p4 : bits 4,5,6,7..
p8 : bits 8,9,10,11..
Hamming Code Example (Cont.)
P(x) x d R(x)
Q(x)
G(x) G(x)
Transmitted: checksummed frame P(x)·xd + R(x)
It’s guaranteed that P(x)·xd + R(x) is divisible by
G(x)!!
Error-Detecting Code - CRC
Receiver
Divides checksummed frame by G(x)
If remainder is zero
No error, CRC is removed
Otherwise
Error, the frame is discarded
CRC -
Example
Generator:
x4 x 1
0 0
Received 0 0 0 1 0
Error during transmission
0
0 1
CRC -
Example
Generator:
x4 x 1 0
0
0 0 0
1 0
0 01 0 ≠0
Frame discarded
CRC – Example 1
G(x) = x3 x2 1 = 1101 Generator
P(x) = x7 x4 x3 x = 10011010 Message
1101 10011010000 Message plus k
1101 zeros
k + 1 bit check 1001
sequence c, 1101
equivalent to a 1000
degree-k 1101 Result:
polynomial 1011
1101 Transmit message
1100
1101
followed by
1000 remainder:
Remainder 1101
m mod c 0
Example 1:CRC Checking (With Errors)
Remainder
m mod c
Example 2 Calculating CRC
Example 2 :Checking CRC
Exercise
Receiver
Sender
first packet bit transmitted, t = 0
last packet bit transmitted, t = 20
500/2=250
1000 bits/50,000 bps=20 msec first packet bit arrives: 500/2=250
500
500/2=250
ACK arrives: 500+20=520
t
los
2,
k
Na
Select Repeat Protocol Implementation
Receiver has a buffer for each sequence
number within receiving window
Each buffer is associated with an
"arrived" bit
Check whether sequence number of an
arriving frame within window or not
If so, accept and store
Maximum window size = ? Can it be
MAX_SEQ ?
Select Repeat Protocol - Window Size
Problem is caused by new and old
windows overlapped
Solution
Window size=(MAX_SEQ+1)/2
E.g., if 4-bit window is used, MAX_SEQ = 15
window size = (15+1)/2 = 8
Number of buffers needed
= window size
Select Repeat Protocol