Download - Lect21 09-11
1
ApplicationLayer
PresentationLayer
SessionLayer
TransportLayer
NetworkLayer
Data LinkLayer
PhysicalLayer
ApplicationLayer
PresentationLayer
SessionLayer
TransportLayer
NetworkLayer
Data LinkLayer
PhysicalLayer
NetworkLayer
Electrical and/or Optical Signals
Application A Application B
Data LinkLayer
PhysicalLayer
NetworkLayer
Data LinkLayer
PhysicalLayer
Communication Network
Figure 2.6
Review of seven layers
Data Link Control
• Framing
• Line Discipline/MAC
• Flow Control
• Error Control
• Addressing
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Data Link Layer
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Peer-to-peer protocols
• Two communicating entities are called peer processes.
• Communication between layer n+1 peers is virtual and is carried by layer n service
• Two meanings of peer-to-peer:
point-to-point (hop-by-hop):
end-to-end (user-to-user):
Physical link
network
6
3 2 11 22
1
3 2 11 22
1
21
Medium
1
2
Physical layer entity
Data link layer entity
3 Network layer entity
PhysicalLayer
Data linkLayer
PhysicalLayer
Data linkLayer
A B
A B
Packets Packets
Frames
(a)
(b)
Peer-to-peer protocol across a single hop
1. take packets2. form frame3. transfer through
Physical layer
5. deliver tonetwork layer
Several pairs of data link & physical entities
Only one network layer entity, a routermay connect several different networks
4. Pass up
PhysicalLayer
Data linkLayer
PhysicalLayer
Data linkLayer
End system
NetworkLayer
NetworkLayer
PhysicalLayer
Data linkLayer
NetworkLayer
PhysicalLayer
Data linkLayer
NetworkLayer
TransportLayer
TransportLayer
MessagesMessages
Segments
End system
Network
Peer-to-peer protocol operating end-to-end across network
3 2 11 22
1
3 2 11 22
1
21
Medium
A B
3 2 11 221
C
21
21
2 134 1 2 3 4
End System End System
Network1
2
Physical layer entity
Data link layer entity 3 Network layer entity
3 Network layer entity
Transport layer entity4Figure 5.4Peer-to-peer protocol operating end-to-end across network
1. Layer 4 not in middle 2.Data go up and down in router
3. Different paths4. Out of order, delay, duplicate, lost
9
Service models
• Connection-oriented and connectionless• Confirmed and unconfirmed• A service may transfer in constant bit rate ( CBR)
or variant bit rate (VBR)
1 2 3 4 5
Data Data Data
ACK/NAK
Data
1 2 3 4 5
Data Data Data Data
ACK/NAK
ACK/NAK
ACK/NAK
ACK/NAK
End-to-end
Hop-by-hop
Figure 5.7
Adaptation functions may be implemented end-to-end or hop-by-hop
Data are ACK or NAK by the other end
Data are ACK or NAK by each hop
11
End-to-end versus hop-by-hop (cont.)•Hop-by-hop: faster recovery & more reliable
but more burden on middle nodes•End-to-end: simpler and only at end-system•QUESTIONS:
–could hop-to-hop waivers end-to-end? NO. it is difficult for all elements in the hop-by-hop
chain to operate correctly, furthermore the errors
may be introduced in middle nodes
--Adaptations are implemented at which layer(s)?
Hop-by-hop: End-by-End:
Data link & network layerTransport & application layer
12
End-to-end versus hop-by-hop (cont.)
• In case of error-detection and recovery:– If frequent errors, use hop-by-hop , otherwise end-to-end
• Flow control and congestion control could be exercised on a hop-by-hop or end-to-end basis or both.
• Security issue: may be hop-by-hop or end-by-end– IPSec (IP security protocol) in Internet layer, hop-by-hop/end-to-end?
– SSL (Secure Socket Layer) in transport layer, end-to-end
– SSH (Secure Shell) in application layer, end-to-end
13
ARQ (Automatic Repeat Request) protocols
• A technique used to ensure accurate delivery of a data stream despite errors during transmission
• Form a basis for peer-to-peer protocols• Assume that
– There is a connection between peers– The channel is error-prone– A sequence of information blocks for transfer
14
Typical ARQ protocols• Assume unidirectional transmission, consider
bidirectional transmission later– Stop-and-wait ARQ– Go-back-N ARQ
• Based on ARQs,– Sliding-window flow control– Reliable stream service (TCP preview)
• Data link layer protocols --HDLC (High-level Data Link Control)
--PPP (Point-to-Point protocol)
15
Stop-and-Wait ARQ
• Transmitter sends one frame and waits for acknowledgment
• Receiver acknowledges the receiving of the frame• After receiving acknowledgment, transmitter
sends the next frame• In case the transmitted frame or returned
acknowledgment was lost, the transmitter’s timer will time out, the transmitter resends the frame
16
A
B
One frame
ACK
Another frame
ACK
timeAnotherframe
Figure 5.9
Stop-and-Wait ARQ
•Transmitter A sends one frame and waits for acknowledgment
•Receiver B acknowledges the receiving of the frame
•After receiving acknowledgment, transmitter A sends the next frame
Any Problem with it?Transmitted frame may lost, the acknowledgment may lost.
How to solve?Set up timer, when timer times out, resends the frame
17
(a) Frame 1 lost or badly garbled
A
B
One
frame Another
frame
ACK
The frame
ACK
timeTime-out
Anotherframe
(b) ACK lost
A
B
One
frame Anotherframe
ACK
theframe
ACK
timeTime-out
Anotherframe
ACK
Figure 5.9
Using timer to retransmit the frame when a frame or acknowledgement lost
Any problem? Frame was received twice when ACK lost.
How to solve it?Introduce sequence number (SN) into frame and discard duplicate frame
18
Go-back-N ARQ• Sends enough frames to keep channel busy and
then waits for ACK• ACK to one frame validates all frames ahead of
this frame (called accumulated ACK)• If ACK for a frame is not received before time
out, all outstanding frames are retransmitted.
19
A
B
fr0
timefr1
fr2
fr3
fr4
fr5
fr6
fr3
ACK1 error
Out-of-sequence frames
Go-Back-4: 4 frames are outstanding; so go back 4
fr5
fr6
fr4
fr7
fr8
fr9
ACK2
ACK3
ACK4
ACK5
ACK6
ACK7
ACK8
ACK9
Figure 5.13
Basic Go-back-N ARQ
1. A sends 0,1,2,3 frames then waits for ACK2. ACK1 just comes in time and A sends one more frame: 43. ACK2 and 3 come and A sends frame 5 and 64. Frame 3 lost and no ACK for it5. B discards out-of-sequence frame 4,5,6 6. A exhausts its window (4 frames) and does not receive ACK, so resends all outstanding frames 3,4,5,6, called Go-back N
Sliding Window Protocols
• Bidirectional Protocol
• Each frame contains a sequence number
• Sliding window refers to a imaginary boxes at the transmitter and receiver.
• At any instant of time , the sender maintains a set of sequence numbers corresponding to the frames permitted to send.
• The receiver also maintains a receiver window corresponding to the set of frames permitted to accept
Sliding Window
Figure 10-11
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Sliding window
• The sequence number within a sender’s window represents the no of frames sent but not yet acknowledged.
• The receiving window corresponds to the frames the receiver may accept.
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Sender Sliding Window
Figure 10-13
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Receiver Sliding Window
Figure 10-14
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Sliding Window Example
Figure 10-14-continued
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Sender
WCB/McGraw-Hill The McGraw-Hill Companies, Inc., 1998
Receiver