Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
CSC 535
Communication Networkls I
Chapter 5b
Peer-to-Peer Protocols
Dr. Cheer-Sun Yang
n+1
entity
n+1
entity
n-SDU
n-SDU
SAP2
SAP1
n-SDU
H
n entity
n entity
H
n-SDU
n-PDU
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Figure 5.1
2
Peer-to-Peer Protocols
(1)Used for linking a host to another host or
point-to-point (2)used for linking an end system
with another end system.
Physical layer delas with bits; data link layer
deals with frames; network layer deals with
datagrams or packets; transport layer deals with
segments.
In this chapter, we focus on data link layer
protocols: stop-and-wait (with) ARQ, Go-Back-N
(with) ARQ, and Selective Repeat (with) ARQ
3
(a)
A
Packets
Packets
Data link
Layer
Data link
Layer
Frames
Physical
Layer
Physical
Layer
B
(b)
1 2
3
2 1
Medium
A
1
3
B
2
1
2 1
Physical layer entity
3
2
1 2
Network layer entity
Data
link layer
entity
Copyright
2000
McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Figure 5.2
4
Messages
Messages
Segments
Transport
Layer
Transport
Layer
Network
Layer
Network
Layer
Network
Layer
Network
Layer
Data link
Layer
Data link
Layer
Data link
Layer
Data link
Layer
Layer
Physical
Layer
Physical
Layer
Physical
Layer
End system
Physical
a
End system
B
Network
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Figure 5.3
5
C
1 2
3
2 1
End System
a
4 3 2 1
1 2
3
2 1
1 2
3
B
2
1
Medium
A
2 1
End System
b
1 2 3 4
Network
1
Physical layer entity
2
Data link layer entity
3
3
Network layer entity
4
Transport layer entity
Network layer entity
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Figure 5.4
6
ARQ Protocols
A frame level error recovery technique. Their
purpose is to ensure that frame level error can
be recovered automatically without the request
of upper layer (i.e., network layer) software.
ARQ forms the basis for point-to-point protocols
that provide for reliable transfer of information.
There are three protocols:
Stop-and-Wait ARQ
Go-Back-N ARQ
Selective Repeat ARQ
7
Point-to-Point Requirements
Data link layer provides a point-to-point reliable
service.
This service provides an adaptation function for
a host to attach to a network.
Major issues include but are not limited to:
arbitrary message size (major)
reliability and sequencing (=>transport layer)
pacing and flow control (=>transport layer)
timing (major)
addressing (major)
privacy, integrity, and authentication
(=>presentation)
8
Network service
Application
Network
Application
Adaptation
Function
Adaptation
Function
End-to-end application requirements
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Figure 5.5
9
1 call = 1 message = entire sequence of speech samples
(a)
1 call = sequence of 1-byte messages
(b)
2 or more short messages
1 long message
(c)
2 or more blocks
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
1 block
10
Figure 5.6
End-to-End vs. Hop-by-Hop
Data link layer provides hop-by-hop (or point-topoint) services, whereas transport layer provides
end-to-end (or host-to-host) services.
In this chapter, we will only talk about data link
layer functions. (Skip 5.1.3-it causes more
confusion to a beginner than clarification.)
We first take a look at a point-to-point
communication model.
11
Error-free
packet
sequence
Information
frames
Packet
sequence
Transmitter
Receiver
Station A
Control
frames
CRC
Station B
CRC
Information
packet
Information Frame
Header
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Header
Control frame
12
Figure 5.8
Other Basic Elements:
Information frames (I-frames): user packets (to/
from network layer)
Control frames: ACKs,NAKs, or enquiry frame
ENQ
Time-out mechanism
We begin with Stop-and-Wait ARQ
13
Stop and Wait
Source transmits frame
Destination receives frame and replies with
acknowledgement
Source waits for ACK before sending next frame
Destination can stop flow by not send ACK
Works well for a few large frames
(Add time out mechanism)
=>Stop-and-Wait ARQ
14
(a) Frame 1 lost
A
Time-out
time
frame
0
frame
1
ACK
B
(b) ACK lost
A
B
frame
1
frame
2
ACK
Time-out
time
frame
0
frame
1
ACK
frame
1
ACK
frame
2
ACK
In parts (a) and (b) transmitting station A acts the same way, but part
(b) receiving station B accepts frame 1 twice.
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
15
Figure 5.9
time-out
A
time
frame
0
ACK
B
frame
0
ACK
frame
1
frame
2
Transmitting station A misinterprets duplicate ACKs
Possible ambiguities when ACKs are unnumbered.
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
16
Figure 5.10
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
Rnext
Slast
Timer
Slast
Transmitter
Rnext
Station A
(0,0)
Global State:
(Slast, Rnext)
Station B
Error-free frame 0
arrives at receiver
ACK for
frame 1
arrives at
transmitter
(1,0)
Receiver
Error-free frame 1
arrives at receiver
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
(0,1)
ACK for
frame 0
arrives at
transmitter
(1,1)
17
Figure 5.11
Time-out
(a) Frame 1 lost
A
time
frame
0
B
(b) ACK for frame 1 lost
A
B
frame
1
ACK
1
ENQ
frame
1
ACK
1
Time-out
time
frame
0
frame
1
ACK
1
ENQ
ACK
0
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
frame
0
ACK
0
18
Figure 5.12
Fragmentation
Large block of data may be split into small
frames
Limited buffer size
Errors detected sooner (when whole frame received)
On error, retransmission of smaller frames is needed
Prevents one station occupying medium for long
periods
Stop and wait becomes inadequate
19
Go-Back-N ARQ
Stop-and-Wait is too conservative and the
effective information transmission rate and
protocol transmission efficiency (discussed later)
are too low.
20
4 frames are outstanding; so go back 4
Go-Back-4:
fr
0
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
3
fr
4
fr
5
fr
6
fr
7
A
B
A
C
K
1
A
C
K
2
A
C
K
3
Out-of-sequence frames A
C
K
4
error
A
C
K
5
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
fr
8
A
C
K
6
time
fr
9
A
C
K
7
A
C
K
8
A
C
K
9
21
Figure 5.13
Time-out expires
Stop-and-Wait
fr
0
fr
0
A
time
fr
1
B
A
C
K
1
error
4 frames are outstanding; so go back 4
Go-Back-N
A
B
fr
0
fr
1
fr
2
fr
3
fr
0
fr
1
fr
2
fr
3
Out-of-sequence framesA
A
C
C
K
K
Copyright 2000 McGraw-Hill
1
error
Leon-Garcia and Widjaja 2
Communication Networks
fr
4
fr
5
A
C
K
3
time
fr
6
A
C
K
4
A
C
K
5
A
C
K
6
22
Figure 5.14
Transmitter
Receiver
Send Window
...
Frames
transmitted S
last
and ACKed
Srecent
Receive Window
Slast+Ws-1
frames
received
Buffers
Timer
Slast
Timer
Slast+1
...
Timer
Srecent
Rnext
The receiver will only accept
a frame that is error-free and
that has sequence number Rnext
...
Slast+Ws-1
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
23
Figure 5.15
M =22 = 4, Go-Back - 4:
fr
0
fr
2
fr
1
fr
3
Transmitter goes back 4
fr
0
fr
1
fr
2
fr
3
time
A
B
A
C
K
2
A
C
K
1
M=22=4, Go-Back-3:
fr
0
A
C
K
4
Receiver has Rnext=0, but it does not
know whether its ACK for frame 0
was received, so it does not know
whether this is the old frame 0 or a
new frame 0
Transmitter goes back 3
fr
2
fr
1
A
C
K
3
fr
0
fr
1
fr
2
time
A
B
A
C
K
1
A
C
K
2
A
C
K
3Copyright
Receiver has Rnext=3 , so it rejects the old
2000frame
McGraw-Hill
0
Leon-Garcia and Widjaja
Communication Networks
24
Figure 5.16
Transmitter goes back to frame 1
Go-Back-7:
fr
0
fr
1
fr
2
A
fr
3
fr
4
fr
5
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
7
time
fr
0
B
A
C
K
1
N
A
K
1
Out-of-sequence
frames
A
C
K
2
A
C
K
3
A
C
K
4
A
C
K
5
A
C
K
6
A
C
K
7
error
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
25
Figure 5.17
Station B
Station A
SArecent RA next
Transmitter
Receiver
Transmitter
Receiver
SBrecent RB next
ACKs are piggybacked in headers
“A” Receive Window
“B” Receive Window
RA next
RB next
“A” Send Window
...
SA last
“B” Send Window
...
SB last
SA last+WA s-1
Buffers
Timer
SA last
Timer
SA last+1
...
SArecent
...
Timer
Timer
SA last+WA s-1
SB last+WB s-1
Buffers
Timer
SB last
Timer
SBlast+1
...
SBrecent
...
Timer
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
Timer
SB last+WB s-1
26
Figure 5.18
Tout
Tproc
Tprop
Tf
Tf
Tprop
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
27
Figure 5.19
Selective Repeat ARQ
Data link layer provides hop-by-hop (or point-topoint) services, whereas transport layer provides
end-to-end (or host-to-host) services.
In this chapter, we will only talk about data link
layer functions. (Skip 5.1.3-it causes more
confusion to a beginner than clarification.)
We first take a look at a point-to-point
communication model.
28
Transmitter
Receiver
Receive Window
Send Window
...
Frames
transmitted S
last
and ACKed
Srecent
Slast+Ws-1
Frames
received
Buffers
Timer
Slast
Timer
Slast+1
Rnext
Rnext +Wr-1
Buffers
Rnext+1
Rnext+2
...
Timer
...
Srecent
Rnext+Wr-1
...
Copyright 2000 McGraw-Hill
Slast+Ws-1 Leon-Garcia and Widjaja
Communication Networks
29
Figure 5.20
fr
0
A
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
2
fr
7
A
C
K
2
A
C
K
2
fr
8
fr
9
fr
10
fr
11
time
fr
12
B
A
C
K
1
A
C
K
2
error
N
A
K
2
A
C
K
2
A
C
K
7
A
C
K
8
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
A
C
K
9
A
C
K
1
0
A
C
K
1
1
A
C
K
1
2
30
Figure 5.21
M=22=4, Selective Repeat: Send Window = Receive Window = 3
Frame 0 resent
fr
0
fr
2
fr
1
time
fr
0
A
A
C
K
2
A
C
K
1
B
A
C
K
3
Receive Window {3,0,1}
Send Window = Receive Window = 2
fr
0
fr
0
fr
1
Frame 0 resent
time
A
B
A
C
K
1
A
C
K
2
frame 0 rejected
Copyright 2000 McGraw-Hill
Leon-Garcia
and Widjaja
Receive
Window
Communication Networks
{2,3}
31
Figure 5.22
Transmission Efficiency
Intuitively, stop-and-wait is the worst; go-back-n
could be better if error rate is not too high;
selective repeat could be better is error is high.
Now, we will discuss them formally.
32
t0
A
tproc
B
tprop
frame
tf time
tproc
tack
tprop
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
33
Figure 5.23
1
0.8
Selective Repeat
Go-Back-N
0.6
0.4
0.2
Stop & Wait
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
1.E-07
5.E-07
1.E-06
5.E-06
1.E-05
5.E-05
1.E-04
5.E-04
1.E-03
5.E-03
1.E-02
5.E-02
0
1.E-01
p
34
Figure 5.24
0.9
0.8
Selective Repeat
0.7
0.6
Go-Back-N
0.5
0.4
62
32
17
10
0.3
6
3
0.2
3
Stop &Wait
0.1
3
nf
0
32
64
128
256
512
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
1024
1536
2048
35
Figure 5.25
Flow Control
Flow control refers to procedures that prevent a
transmitter from overrunning a receiver’s buffer.
Congestion control refers to a network layer
function that prevents a source to overwhelm a
router’s buffer.
Techniques:
(physical layer) X-ON/X-OFF(“server” to “client”)
(physical layer) RTS/CTS (host to/from modem,
respectively)
(data link layer) sliding window protocols
36
A
transmit
transmit
time
on
off
on
off
time
B
2Tprop
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
37
Figure 5.26
Sliding Windows Flow Control
Allow multiple frames to be in transit
Receiver has buffer W long
Transmitter can send up to W frames without
ACK
Each frame is numbered
ACK includes number of next frame expected
Sequence number bounded by size of field (k)
Frames are numbered modulo 2k
38
Sliding Window Diagram
39
Sliding Window Enhancements
Receiver can acknowledge frames without
permitting further transmission (Receive Not
Ready)
Must send a normal acknowledge to resume
If duplex, use piggybacking
If no data to send, use acknowledgement frame
If data but no acknowledgement to send, send last
acknowledgement number again, or have ACK valid
flag (TCP)
40
return of permits
tcycle
A
time
B
time
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
41
Figure 5.27
Synchronous source sends
periodic information blocks
Network output not periodic
Networ
k
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
42
Figure 5.28
arrival
times
time
send
times
Receiver too slow
buffer overflow
playout
times
Tplayout
time
Receiver too fast
buffer starvation
time
time
Receiver speed
just right
Many late
packets
Tplayout
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja T
time
Communication Networks playout
time
43
Figure 5.29
Buffer for information blocks
Error
signal
+
Add
t4
t3
t2
t1
Playout
command
Smoothing
filter
Adjust
frequency
-
Recovered
clock
Timestamps
Counter
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
44
Figure 5.30
Receiver
Transmitter
f
f
fs
Network
fr
fn
Network clock
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
45
Figure 5.31
Application
Application
byte stream
byte stream
Segments
Transmitter
Receiver
Receive buffer
Send buffer
ACKs
* SKIP SECTION 5.3.3 !!!
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
46
Figure 5.32
Summary of Major Data Link
Layer Functions:
Framing: where to begin and where to end
Error control: error detection and frame level
error recovery
Flow control: error control is not enough!
47
Example Data Link Layer
Protocols (HDLC, PPP)
High Level Data Link Control (HDLC)
Point-to-Point Protocol (PPP)
48
Network
Layer
NLPDU
Network
Layer
“packet”
DLSDU
DLSAP
DLSAP
Data Link
Layer
DLSDU
DLPDU
Data Link
Layer
“frame”
Physical
Layer
Physical
Layer
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
49
Figure 5.32
HDLC Station Types
Primary station
Controls operation of link
Frames issued are called commands
Maintains separate logical link to each secondary
station
Secondary station
Under control of primary station
Frames issued called responses
Combined station
May issue commands and responses
50
HDLC Link Configurations
Unbalanced
One primary and one or more secondary stations
Supports full duplex and half duplex
Balanced
Two combined stations
Supports full duplex and half duplex
51
Unbalanced Point-to-point link
Commands
Primary
Secondary
Responses
Unbalanced Multipoint link
Commands
Primary
Responses
Secondary
Secondary
Secondary
Balanced Point-to-point link between Combined Stations
Primary
Secondary
Commands
Copyright 2000 McGraw-Hill
ResponsesLeon-Garcia and Widjaja
Communication Networks
Responses
Secondary
Commands
Primary
52
Figure 5.33
Flag
Address
Control
Information
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
FCS
Flag
53
Figure 5.35
Information Frame
1
2-4
0
5
N(S)
6-8
P/F
N(R)
N(R)
Supervisory Frame
1
0
S
S
P/F
M
M
P/F
Unnumbered Frame
1
1
M
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
M
M
54
Figure 5.36
SABM
UA
Data
transfer
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
DISC
UA
55
Figure 5.37
Secondaries B, C
Primary A
B, RR, 0, P
X
B, I, 0, 0
B, I, 1, 0
B, I, 2, 0,F
B, SREJ, 1
C, RR, 0, P
C, RR, 0, F
B, SREJ, 1,P
B, I, 1, 0
B, I, 3, 0
B, I, 4, 0, F
B, I, 0, 5
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
56
Figure 5.38
Combined Station A
Combined Station B
B, I, 0, 0
B, I, 1, 0
A, I, 0, 0
X
A, I, 1, 1
B, I, 2, 1
A, I, 2, 1
B, I, 3, 2
B, REJ, 1
B, I, 4, 3
A, I, 3, 1
B, I, 1, 3
B, I, 2, 4
B, RR, 2
B, I, 3, 4
B, RR, 3
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
57
Figure 5.39
Other DLC Protocols
(LAPB,LAPD)
Link Access Procedure, Balanced (LAPB)
Part of X.25 (ITU-T)
Subset of HDLC - ABM
Point to point link between system and packet
switching network node
Link Access Procedure, D-Channel
ISDN (ITU-D)
ABM
Always 7-bit sequence numbers (no 3-bit)
16 bit address field contains two sub-addresses
One for device and one for user (next layer up)
58
Other DLC Protocols (PPP)
Provides a method for encapsulating datagrams
over point-to-point links
can be used to connect two routers
can be used to connect a PC to the Internet via
a modem over a phone line
59
Flag
Address
01111110 1111111
All stations are to
accept the frame
Control
00000011
Unnumbered
frame
Protocol
Information
CRC
flag
01111110
Specifies what kind of packet is contained in the
payload, e.g., LCP, NCP, IP, OSI CLNP, IPX
Copyright 2000 McGraw-Hill
Leon-Garcia and Widjaja
Communication Networks
60
Figure 5.40
A Typical Scenario
Dead
1. Carrier
Detected
Home PC to Internet Service
Provider
1. PC calls router via modem.
failed
2. PC and router exchange LCP
packets to negotiate PPP
Establish
Terminate
parameters.
2. Options
3. Check on identities.
6. Done
Negotiated
failed
4. NCP packets exchanged to
Authenticate
5. Open
configure the network layer, e.g.,
TCP/IP ( requires IP address
3. Authentication
assignment).
4. NCP
Completed
5. Data transport, e.g.
Configuration
Network
send/receive IP packets.
6. NCP used to tear down the
network layer connection (free
Copyright 2000 McGraw-Hill
Leon-Garcia and up
Widjaja
IP address); LCP used to shut
Communication Networks
61
down data link layer connection.
Figure 5.41
7. Carrier
Dropped
Required Reading
Chapter 5
62