Presentation is loading. Please wait.

Presentation is loading. Please wait.

NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer.

Similar presentations


Presentation on theme: "NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer."— Presentation transcript:

1 NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer communications Networks and Communication Department 1

2 Stop-and-Wait ARQ  Simplest flow and error control protocol  Data frames and ACK frames are numbered alternately (0,1)  When receiver sends ACK1: it acknowledges data frame 0 and is expecting data frame 1, ACK0 acknowledges data frame 1 and is expecting data frame 0  Sequence Numbers are incremented modulo 2. 1+1 = 0, and 0+1=1  Receiver has a counter (R ) which hold the number of the expected frame to be received. R is incremented by 1 modulo 2 when the expected frame is received.  The sender keeps a counter (S ) which holds the number of the last transmitted frame. S is incremented by 1 modulo 2 when the acknowledgement of the last transmitted frame is received and the next frame is transmitted

3 Normal operation Expected frame to be received Last transmitted frame

4 Stop-and-Wait ARQ – Cont’d  If the receiver detects an error in the frame it discards it  If the receiver receives an out-of-order frame ( frame 0 instead of frame 1 or vice versa), it knows that the expected frame is lost or damaged and discards the out-of-order frame and resend the previous ACK  The sending device keeps a copy of the last frame transmitted until it receives the right acknowledgment (ACK) for the frame  The sender starts a timer when it sends a frame. If an ACK is not received within the allocated time, the sender assumes that the frame was lost or damaged and resends it

5 Stop-and-Wait ARQ, lost frame

6 Stop-and wait ARQ Example Networks and Communication Department 6

7 Go-Back-N ARQ  Setup – Sender sliding window  Frames are numbered sequentially using k-bit in the frame header  For k bits frame sequence numbers 0 – (2 k –1), repeated  k=3  (0,1,2,3,4,5,6,7,0, 1,2,3,4,5,6,7,…),  k=4  (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0, 1,2,3,4,5,6,7,8,....15,….),  Sender can send multiple frames while waiting for ACK, but total number of unacknowledged frames should not exceed 2 k –1 which is called window  Window is an imaginary placeholder that covers the frames sequence numbers which can be in transit  The frames to the left of the window are already acknowledged and to the right can not be sent until window slides over them  Frames inside the window are outstanding (have been sent but not yet acknowledged OR will be sent soon once received from upper-layer)  Sender window will slide to frame number (i ) when (ACK i) is received.  S f : first outstanding frame, S n : next frame to send

8 Go-Back-N ARQ  Setup –Receiver sliding window  The size of the receiver window is always 1 and points to the next expected frame number to arrive  This means that frames should arrive in order  If the expected frame is received without errors, the receiver window slides over the next sequence number.  Operation  The receiver sends a positive ACK if a frame has arrived without error and in order (with the expected sequence number )  Receiver does not have to acknowledge each individual frame received correctly and in order.  Receiver can send cumulative ACK for several frames (ACK 5 acknowledges frames (0,1,2,3,4) and expecting frame 5)  If the frame is damaged or out-of-order, the receiver discards it (and stay silent) and also discards all subsequent frames until it receives the one expected.  In this case, no ACK will be transmitted  If the sender timer expires before receiving an ACK, it will resend ALL frames beginning with the one expired until the last one sent (Go-Back-N).

9 Go-Back-N ARQ, normal operation Sender window will slide to frame number (i ) when (ACK i) is received. K=2 Sequence # : 0 – (2 k –1), 0  3 Window size: 2 k –1 = 3 Window size=1

10 Go-Back-N ARQ Example Networks and Communication Department 10

11 Go-Back-N ARQ Example Networks and Communication Department 11 Timeout for frame 1 expired

12 Selective-Reject ARQ  Setup-Window size (for both sender and receiver)  For k bit sequence number the maximum window size 2 k-1  Operation  Sender in case of damaged or lost frame retransmits Those which are negatively acknowledged Those for which timer expires  Receiver can accept out of order frames and buffer (store) them until the lost, damaged, or delayed frame arrives.  Receiver does not acknowledge out of order frames but buffers them only  If the receiver receives an out-of-order, error frame, it will send a frame called Negative Acknowledge (NAK or SREJ) with the number of the frame to be retransmitted only.  NAK improves the performance because it requests retransmission of the lost frame before the corresponding sender timer expires

13 Selective Reject Example Networks and Communication Department 13 K=3 Sequence # = 0 – (2 k –1), 0  7 Window size: 2 k-1 =4

14 Question Networks and Communication Department 14. In the Go-Back-N ARQ Protocol, we can send several frames before receiving acknowledgments. If a frame is lost or damaged, all outstanding frames sent before that frame are resent. In the Selective- Repeat ARQ protocol we avoid unnecessary transmission by sending only the frames that are corrupted or missing. Both Go- Back-N and Selective-Repeat Protocols use sliding windows. In Go-Back-N ARQ, if k is the number of bits for the sequence number, then the size of the send window must be at most ; the size of the receiver window is always 1. In Selective- Repeat ARQ, the size of the sender and receiver window must be at most

15 Question Networks and Communication Department 15 A five-bit sequence number can create sequence numbers from 0 to 31. The sequence number in the Nth packet is (N mod 32). This means that the 101th packet has the sequence number (101 mod 32) or 5.

16 Question Networks and Communication Department 16

17 Question Networks and Communication Department 17

18 Question Networks and Communication Department 18 Draw the flow diagram of a system using Go back N ARQ protocol for five frames using 4-bits sequence numbers. Assume the fourth frame (frame 3) is lost. size of Sender window: (2k –1) =15 size of receiver window :1 frames sequence numbers: 0 – (2k –1) = 0-15

19 Networks and Communication Department 19

20 Any Questions ? The End 20 Networks and Communication Department


Download ppt "NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 4 : Chapter 7 Data & computer."

Similar presentations


Ads by Google