Download presentation
Presentation is loading. Please wait.
Published byRodney Underwood Modified over 6 years ago
1
March 21, 2001 Recall we have talked about the Sliding Window Protocol for Flow Control Review this protocol A window of size I can contain at most I frames that are to be transmitted The window expands in size as new frames are added to be transmitted, but the window will not grow to size larger than I See figure of sliding window on handout
2
Sliding Window Protocol
All frames before the window must have been acknowledged Frames inside the window are either unsent or have been sent and have not been acknowledged (outstanding frames) Frames beyond the widow are not yet sent
3
Sliding Window Protocol – Cont
If window size is equal to 1, then we have the Stop and Wait protocol If window size is greater than the number of frames, then we have the unrestricted protocol
4
Typical Frame Format Source address – address of station sending frame
Destination address – address where frame is to be sent Frame number – The sequence number starting with 0 and numbered sequentially Ack – An integer value that corresponds to the frame being acknowledged. This avoids sending a separate acknowledgement. The Ack is piggybacked on the data frame Type of frame Data CRC
5
Two implementations of the Sliding Window Protocol
Go-Back-n Selective Repeat
6
Go-Back-n Protocol Frame numbers are numbered between 0 and (2 to the power k) –1, where k = number of bits in frame number field Suppose k = 6 Frames are numbered 0, 1, …,63 and then repeat these numbers Receiver always expects to receive frames in order (modulo ) If one frame is received out of order, it ignores the frame and sends a NAK for the frame it expected It then waits for the correct frame to arrive
7
Go-Back-n Protocol – Cont
If a frame arrives and it is damaged, the receiving station ignores it and sends a NAK for it The receiving station does not acknowledge each received station explicitely If a sending station receives an ACK for frame j and later receives one for frame k (k>j), it assumes all frames between j and k have been received correctly A station uses the piggyback approach whenever possible to acknowledge the most recently arrived frame
8
Go-Back-n Protocol – Cont
The sending station buffers all the frames in the window in case it has to resend one or more Frames are removed from the buffer as they are acknowledged If a station does not receive an ACK over a period of time, it assumes something went wrong. It uses a frame timer, one for each frame, which is set when the data goes out The frame timer counts down and stops when an ACK is received for that frame If the frame timer expires then every frame in the window is resent (Explain this!) The name of the protocol comes from the fact that all n frames in the window are sent again
9
Go-Back-n Protocol – Cont
What is the maximum window size? The window size can’t be larger than 2 to the power k, where k = # of bits of frame number field Why? Otherwise you could have two frames with the same number outstanding and the sender would have no way of knowing which frame is being acknowledged If the window size = 2 to the power k, the protocol can still fail See handout that shows failure in this case
10
Go-Back-n Protocol – Cont
Works well especially over reliable channels When frames are rarely lost, the assumption that they arrive in the order they were sent is usually valid In the unusual case that a frame is lost, little time will be spent in resending all the outstanding frames As reliability decreases, the overhead of this approach increases
11
Selective Repeat Protocol
Another implementation of the sliding window protocol Similar to Go-Back-n Frames are numbered using a k-bit field The sender has a window defining the maximum number of outstanding frames Piggyback ACKs are used whenever possible If a frame is acknowledged, the sending station assumes all prior ones have been received as well NAKs are sent for damaged frames and frames sent out of order Timer is used to resend frames that have not been acknowledged for a while
12
Differences in Selective Repeat Protocol
Two sliding windows are defined, one for the sender and one for the receiver Thus each station has both a sending and a receiving window The sending window is the same as the Go-Back-n protocol window- it defines which frames may be outstanding The receiving window defines what frames can be received Frames in the receiving window are numbered consecutively The receiving station is not required to receive the frames in order A frame arriving out of order can be received as long as its number is in the receiving window Out of order frames are buffered until their predecessors arrive
13
Homework Questions Which type of Sliding Window Protocol does TCP use?
Examine the code of the Go-Back-n protocol to answer the following questions: How many events are in the main while loop? What are these events? Where in the code does it indicate that the receiver B will send a second ACK should the first one be lost?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.