Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang.

Similar presentations


Presentation on theme: "CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang."— Presentation transcript:

1 CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang

2 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks2 n+1 entity SAP1 n+1 entity SAP2 n entity n-SDU H H n-PDU Figure 5.1

3 3 Peer-to-Peer Protocols z(1)Used for linking a host to another host or point-to-point (2)used for linking an end system with another end system. zPhysical layer delas with bits; data link layer deals with frames; network layer deals with datagrams or packets; transport layer deals with segments. zIn this chapter, we focus on data link layer protocols: stop-and-wait (with) ARQ, Go-Back-N (with) ARQ, and Selective Repeat (with) ARQ

4 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks4 3 2 1 1 2 2 1 3 2 1 1 2 2 1 2 1 Medium 1 2 Physical layer entity Data link layer entity 3 Network layer entity Physical Layer Data link Layer Physical Layer Data link Layer A B A B Packets Frames (a) (b) Figure 5.2

5 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks5 Physical Layer Data link Layer Physical Layer Data link Layer End system  Network Layer Network Layer Physical Layer Data link Layer Network Layer Physical Layer Data link Layer Network Layer Transport Layer Transport Layer Messages Segments End system  Network Figure 5.3

6 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks6 3 2 1 1 2 2 1 3 2 1 1 2 2 1 2 1 Medium A B 3 2 1 1 2 2 1 C 2 1 2 1 2 1 3 4 1 2 3 4 End System  End System  Network 1 2 Physical layer entity Data link layer entity 3 Network layer entity 3 Transport layer entity 4 Figure 5.4

7 7 ARQ Protocols zA 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. zARQ forms the basis for point-to-point protocols that provide for reliable transfer of information. zThere are three protocols: yStop-and-Wait ARQ yGo-Back-N ARQ ySelective Repeat ARQ

8 8 Point-to-Point Requirements zData link layer provides a point-to-point reliable service. zThis service provides an adaptation function for a host to attach to a network. zMajor issues include but are not limited to: yarbitrary message size (major) yreliability and sequencing (=>transport layer) ypacing and flow control (=>transport layer) ytiming (major) yaddressing (major) yprivacy, integrity, and authentication (=>presentation)

9 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks9 Application Network Application Adaptation Function Adaptation Function End-to-end application requirements Network service Figure 5.5

10 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks10 1 call = 1 message = entire sequence of speech samples 1 call = sequence of 1-byte messages (a) (b) (c) 1 long message 2 or more blocks 2 or more short messages 1 block Figure 5.6

11 11 End-to-End vs. Hop-by-Hop zData link layer provides hop-by-hop (or point-to- point) services, whereas transport layer provides end-to-end (or host-to-host) services. zIn this chapter, we will only talk about data link layer functions. (Skip 5.1.3-it causes more confusion to a beginner than clarification.) zWe first take a look at a point-to-point communication model.

12 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks12 Packet sequence Error-free packet sequence Information frames Control frames TransmitterReceiver CRC Information packet Header Station A Station B Information Frame Control frame CRC Header Figure 5.8

13 13 Other Basic Elements: zInformation frames (I-frames): user packets (to/ from network layer) zControl frames: ACKs,NAKs, or enquiry frame ENQ zTime-out mechanism zWe begin with Stop-and-Wait ARQ

14 14 Stop and Wait zSource transmits frame zDestination receives frame and replies with acknowledgement zSource waits for ACK before sending next frame zDestination can stop flow by not send ACK zWorks well for a few large frames z(Add time out mechanism) =>Stop-and-Wait ARQ

15 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks15 (a) Frame 1 lost A B frame 0 frame 1 ACK frame 1 ACK time Time-out frame 2 (b) ACK lost A B frame 0 frame 1 ACK frame 1 ACK time Time-out 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. Figure 5.9

16 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks16 A B frame 0 frame 0 ACK frame 1 ACK time time-out frame 2 Transmitting station A misinterprets duplicate ACKs Figure 5.10 Possible ambiguities when ACKs are unnumbered.

17 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks17 Transmitter Receiver S last R next 0 1 (0,0) (0,1) (1,0) (1,1) Timer Global State: (S last, R next ) Error-free frame 0 arrives at receiver ACK for frame 0 arrives at transmitter ACK for frame 1 arrives at transmitter Error-free frame 1 arrives at receiver Station A Station B R next S last Figure 5.11

18 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks18 (a) Frame 1 lost A B frame 0 frame 1 ACK 1 ENQ ACK 1 time Time-out frame 1 (b) ACK for frame 1 lost A B frame 0 frame 1 ACK 1 ENQ ACK 0 time Time-out frame 0 ACK 0 Figure 5.12

19 19 Fragmentation zLarge block of data may be split into small frames yLimited buffer size yErrors detected sooner (when whole frame received) yOn error, retransmission of smaller frames is needed yPrevents one station occupying medium for long periods zStop and wait becomes inadequate

20 20 Go-Back-N ARQ zStop-and-Wait is too conservative and the effective information transmission rate and protocol transmission efficiency (discussed later) are too low.

21 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks21 A B fr 0 time fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 fr 3 ACK1ACK1 error Out-of-sequence frames Go-Back-4: 4 frames are outstanding; so go back 4 fr 5 fr 6 fr 4 fr 7 fr 8 fr 9 ACK2ACK2 ACK3ACK3 ACK4ACK4 ACK5ACK5 ACK6ACK6 ACK7ACK7 ACK8ACK8 ACK9ACK9 Figure 5.13

22 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks22 A B fr 0 time fr 1 fr 2 fr 3 fr 0 error Out-of-sequence frames 4 frames are outstanding; so go back 4 fr 2 fr 3 fr 1 fr 4 fr 5 fr 6 A B time fr 0 fr 0 error Time-out expires fr 1 ACK1ACK1 Stop-and-Wait Go-Back-N ACK1ACK1 ACK2ACK2 ACK3ACK3 ACK4ACK4 ACK5ACK5 ACK6ACK6 Figure 5.14

23 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks23 Timer S last S last +1 S recent S last +W s -1 Timer Transmitter Receiver... Receive Window Buffers S last S last +W s -1... Send Window S recent Frames transmitted and ACKed R next frames received The receiver will only accept a frame that is error-free and that has sequence number R next... Figure 5.15

24 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks24 A B fr 0 time fr 1 fr 2 fr 3 fr 0 fr 1 fr 2 fr 3 ACK1ACK1 M =2 2 = 4, Go-Back - 4: ACK4ACK4 ACK2ACK2 ACK3ACK3 Transmitter goes back 4 Receiver has R next =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 A B fr 0 time fr 1 fr 2 fr 0 fr 1 fr 2 ACK1ACK1 M=2 2 =4, Go-Back-3: ACK2ACK2 ACK3ACK3 Transmitter goes back 3 Receiver has R next =3, so it rejects the old frame 0 Figure 5.16

25 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks25 A B fr 0 time fr 1 fr 2 fr 3 fr 4 fr 5 fr 1 fr 2 ACK1ACK1 error Out-of-sequence frames Go-Back-7: fr 4 fr 5 fr 3 fr 6 fr 7 fr 0 NAK1NAK1 ACK3ACK3 ACK4ACK4 ACK5ACK5 ACK6ACK6 ACK7ACK7 ACK2ACK2 Transmitter goes back to frame 1 Figure 5.17

26 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks26 Transmitter Receiver Transmitter Receiver ACKs are piggybacked in headers Station A Station B R A next “A” Receive Window R B next “B” Receive Window S A last S A last +1 S A recent S A last +W A s -1 Timer S A last +W A s -1... Buffers “A” Send Window... S B last S B last +1 S B recent S B last +W B s -1... Buffers “B” Send Window... S A recent R A next S B recent R B next Timer Figure 5.18

27 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks27 TfTf TfTf T proc T prop T out Figure 5.19

28 28 Selective Repeat ARQ zData link layer provides hop-by-hop (or point-to- point) services, whereas transport layer provides end-to-end (or host-to-host) services. zIn this chapter, we will only talk about data link layer functions. (Skip 5.1.3-it causes more confusion to a beginner than clarification.) zWe first take a look at a point-to-point communication model.

29 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks29 Transmitter Receiver Buffers S last S last +W s -1... Send Window S recent Frames transmitted and ACKed Timer S last S last +1 S recent S last +W s -1 Timer... Receive Window R next Frames received R next +W r -1 R next +1 R next +2 R next +W r -1... Buffers Figure 5.20

30 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks30 A B fr 0 time fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 fr 2 ACK1ACK1 error fr 8 fr 9 fr 7 fr 10 fr 11 fr 12 ACK2ACK2 NAK2NAK2 ACK7ACK7 ACK8ACK8 ACK9ACK9 ACK10ACK10 ACK11ACK11 ACK12ACK12 ACK2ACK2 ACK2ACK2 ACK2ACK2 Figure 5.21

31 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks31 A B fr 0 time fr 1 fr 2 fr 0 ACK1ACK1 M=2 2 =4, Selective Repeat: Send Window = Receive Window = 3 ACK2ACK2 ACK3ACK3 Receive Window {3,0,1} Frame 0 resent A B fr 0 time fr 1 fr 0 ACK1ACK1 Send Window = Receive Window = 2 ACK2ACK2 Receive Window{2,3} Frame 0 resent frame 0 rejected Figure 5.22

32 32 Transmission Efficiency zIntuitively, 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. zNow, we will discuss them formally.

33 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks33 frame t f time A B t prop t ack t proc t prop t proc t0t0 Figure 5.23

34 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks34 Selective Repeat Go-Back-N Stop & Wait p  Figure 5.24

35 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks35 nfnf  Selective Repeat Go-Back-N Stop &Wait 62 32 17 10 6 3 3 3 Figure 5.25

36 36 Flow Control zFlow control refers to procedures that prevent a transmitter from overrunning a receiver’s buffer. zCongestion control refers to a network layer function that prevents a source to overwhelm a router’s buffer. zTechniques: y(physical layer) X-ON/X-OFF(“server” to “client”) y(physical layer) RTS/CTS (host to/from modem, respectively) y(data link layer) sliding window protocols

37 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks37 on off on A B transmit 2T prop time Figure 5.26

38 38 Sliding Windows Flow Control zAllow multiple frames to be in transit zReceiver has buffer W long zTransmitter can send up to W frames without ACK zEach frame is numbered zACK includes number of next frame expected zSequence number bounded by size of field (k) yFrames are numbered modulo 2 k

39 39 Sliding Window Diagram

40 40 Sliding Window Enhancements zReceiver can acknowledge frames without permitting further transmission (Receive Not Ready) zMust send a normal acknowledge to resume zIf duplex, use piggybacking yIf no data to send, use acknowledgement frame yIf data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP)

41 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks41 A B t cycle return of permits time Figure 5.27

42 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks42 Networ k Synchronous source sends periodic information blocks Network output not periodic Figure 5.28

43 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks43 send times playout times arrival times T playout time Receiver too slow buffer overflow T playout time Receiver too fast buffer starvation Many late packets T playout time Receiver speed just right Figure 5.29

44 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks44 t4t4 t3t3 t2t2 t1t1 Timestamps Add Smoothing filter Adjust frequency Recovered clock Counter + - Buffer for information blocks Error signal Playout command Figure 5.30

45 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks45 Network clock fnfn Transmitter Network Receiver fsfs frfr  f Figure 5.31

46 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks46 byte stream Send buffer Segments Receive buffer byte stream Application ACKs Transmitter Receiver Figure 5.32 * SKIP SECTION 5.3.3 !!!

47 47 Summary of Major Data Link Layer Functions: zFraming: where to begin and where to end zError control: error detection and frame level error recovery zFlow control: error control is not enough!

48 48 Example Data Link Layer Protocols (HDLC, PPP) zHigh Level Data Link Control (HDLC) zPoint-to-Point Protocol (PPP)

49 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks49 Physical Layer Data Link Layer Data Link Layer Network Layer DLSDU Network Layer Physical Layer DLPDU NLPDU “packet” “frame” DLSAP Figure 5.32

50 50 HDLC Station Types zPrimary station yControls operation of link yFrames issued are called commands yMaintains separate logical link to each secondary station zSecondary station yUnder control of primary station yFrames issued called responses zCombined station yMay issue commands and responses

51 51 HDLC Link Configurations zUnbalanced yOne primary and one or more secondary stations ySupports full duplex and half duplex zBalanced yTwo combined stations ySupports full duplex and half duplex

52 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks52 PrimarySecondary Commands Responses Unbalanced Point-to-point link Primary Commands Responses Secondary Unbalanced Multipoint link Primary Secondary Commands Responses Balanced Point-to-point link between Combined Stations Primary Secondary Commands Responses Figure 5.33

53 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks53 Flag Address ControlInformation FCS Figure 5.35

54 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks54 0N(S) N(R) P/F 1 2-4 5 6-8 Information Frame N(R) P/F Supervisory Frame Unnumbered Frame 1 0 SS P/F 1 1 MMM M M Figure 5.36

55 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks55 SABM UA DISC Data transfer Figure 5.37

56 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks56 Primary A Secondaries B, C B, RR, 0, P B, I, 0, 0 B, I, 1, 0 B, I, 2, 0,F X 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 Figure 5.38

57 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks57 Combined Station A Combined Station B B, I, 0, 0 A, I, 0, 0 B, I, 1, 0 B, I, 2, 1 A, I, 1, 1 A, I, 2, 1 X B, REJ, 1 B, I, 3, 2 B, I, 4, 3 B, I, 1, 3 B, I, 2, 4 B, I, 3, 4 A, I, 3, 1 B, RR, 2 B, RR, 3 Figure 5.39

58 58 Other DLC Protocols (LAPB,LAPD) zLink Access Procedure, Balanced (LAPB) yPart of X.25 (ITU-T) ySubset of HDLC - ABM yPoint to point link between system and packet switching network node zLink Access Procedure, D-Channel yISDN (ITU-D) yABM yAlways 7-bit sequence numbers (no 3-bit) y16 bit address field contains two sub-addresses xOne for device and one for user (next layer up)

59 59 Other DLC Protocols (PPP) zProvides a method for encapsulating datagrams over point-to-point links zcan be used to connect two routers zcan be used to connect a PC to the Internet via a modem over a phone line

60 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks60 Flag flag Address Control Information CRC Protocol 01111110 1111111 00000011 Unnumbered frame Specifies what kind of packet is contained in the payload, e.g., LCP, NCP, IP, OSI CLNP, IPX All stations are to accept the frame Figure 5.40

61 Copyright 2000 McGraw-Hill Leon-Garcia and Widjaja Communication Networks61 A Typical Scenario Home PC to Internet Service Provider 1. PC calls router via modem. 2. PC and router exchange LCP packets to negotiate PPP parameters. 3. Check on identities. 4. NCP packets exchanged to configure the network layer, e.g., TCP/IP ( requires IP address assignment). 5. Data transport, e.g. send/receive IP packets. 6. NCP used to tear down the network layer connection (free up IP address); LCP used to shut down data link layer connection. 7. Modem hangs up. Dead Establish Authenticate Network Terminate Open failed 1. Carrier Detected 2. Options Negotiated 3. Authentication Completed 4. NCP Configuration 6. Done 7. Carrier Dropped 5. Figure 5.41

62 62 Required Reading zChapter 5


Download ppt "CSC 535 Communication Networkls I Chapter 5b Peer-to-Peer Protocols Dr. Cheer-Sun Yang."

Similar presentations


Ads by Google