"Data communication and network" note--error control protocol in the link layer

Source: Internet
Author: User
Tags ack

The following is a description of three protocol for error control.1. Stop waiting for automatic Duplicate request protocol (stop-and-wait ARQ)The following figure is the process of stopping waiting for an automatic repeat request:
In the figure, SN points to the number of frames that will be sent, and RN points to the number of frames expecting the next receipt. Where the number of frames can be recycled, determined by the bit length of the number field, if the Number field is 2 bits, the number range is 0~3 (0~2*2-1), the number range is 0~1 in the figure above, so the number field is 1 (0~2-1) to process the following steps: 1. The sender sends a frame with number 0 and starts the timer, After receiving the receiver, expect the next received frame number of 1, and send ACK1 to the sender 2. The sender receives the ACK1 within the time specified by the timer, the timer stops, and the SN points to 1, that is, the next time the frame with the number 1 is sent. 3. The sender sends a frame with number 1 and starts the timer, but is lost in transit. 4. The sender side timer timeout, again send the frame number 1 and start the timer, the receiver received, expect the next received frame number 0, and send ACK0 to the sender 5. The sender receives the ACK0 within the time specified by the timer, the timer stops, and the SN points to 0, that is, the next send the frame numbered 0. 6. The sender sends the frame of number 0 and starts the timer, and the receiver receives it, expects the next received frame number is 1, and sends the ACK1 to the sender 7. The sender does not receive the ACK1 within the specified time of the timer, so re-send the sn-pointing frame (numbered 0). But the receiver expects a frame numbered 1, the frame numbered 0 has been acknowledged, so the frame with number 0 is discarded, and then the ACK1 is sent to the receiver.
The above is the process of stopping waiting for automatic duplicate request protocol, but the efficiency of this protocol is very inefficient, if it is me, it will never use ...
2. Fallback n-Frame automatic re-send request protocol (Go-back Automatic Repeat requests)In this protocol, involves sliding window concept, sliding window when an abstract concept, used to define the sender and receiver concerned about the range of sequences, the sender is concerned about the sequence range is sent sliding window, the receiver is concerned about the sequence of receiving sliding window. In the fallback n-Frame automatic Resend Request protocol, the size of the sending sliding window must be less than 2^m (M is the window's bit length, reason and so on), the receiving sliding window size is 1, below the protocol, the following figure, the gray section is the window range, the number of bit segment is 2, so the sending window size is 2^2-1= 3, the Receive sliding window size is 1. SF is the first frame to be confirmed, and SN is the next frame to be sent. RN is expected to be received by the frame. 1. The first frame sent by the sender is 0, and the first frame to be confirmed is 0.
2. The sender sends frame 0, the next frame to be sent becomes 1, the receiver receives frame 0, the next frame expecting to be received becomes 1, and then sends the ACK1
3. The sender receives the ACK1, and the next frame to be confirmed becomes 1.
4. The sender sends frame 1, the next frame to be sent becomes 2, the receiver receives frame 1, the next expected received frame becomes 2, and then sends the ACK2, but the ACK2 is lost in transit.
5. The sender sends frame 2, the next frame to be sent becomes 3, the receiver receives frame 2, the next expected received frame becomes 3, and then sends the ACK3.
6. The sender sends frame 3, the next frame to be sent becomes 4, the receiver receives frame 3, the next expected received frame becomes 4, and then sends the ACK4.
7. The sender receives the ACK3, the next to be confirmed the frame becomes 3, this side may have the question, why the sender does not receive the ACK2, can guarantee the receiver has received the frame 1, everybody thinks, if the receiver does not receive the frame 2,rn the value has been 1, So the sender receives the ACK3, indicating that frame 2 must have been received.
8. The sender receives the ACK4, and the next frame to be confirmed becomes 4.
In this protocol, we just use a timer, that is, when the SF = = SN is used to start the timer, when the timer to the time, if the SN is not equal to SF, then the SF to SN all the frames are re-sent.

Why the window size must be smaller than 2^m, see the following figure: 1. The sender sends a frame numbered 0, the first frame to be confirmed is 0, the next frame to be sent is 1, the receiver expects to receive a frame of 0, but the sent ACK is lost. 2. The sender does not receive an ACK, so SF is still 1, then continue to send the frame numbered 1, SN becomes 2, the receiver expects to receive a frame of 1, but the sent ACK is lost. 3. The sender does not receive an ACK, so SF is still 1, then continue to send the frame numbered 2, SN becomes 3, the receiver expects to receive a frame of 2, but the sent ACK is lost. 4. The sender does not receive an ACK, so SF is still 1, then continue to send the frame numbered 3, SN becomes 4, the receiver expects to receive a frame of 3, but the sent ACK is lost. 5. The sender always does not receive the ACK of the frame numbered 1, when the timer time-out, the sender to send SF to SN in turn all the frames, then sent a frame numbered 0, the receiver expects the frame number is also 1, so the receiver should reject the frame, but it was when received, resulting in an error.
So the conclusion is: the size of the sending sliding window must be less than 2^m
Fallback n-Frame automatic re-send request protocol has progressed somewhat more than stopping waiting for the automatic duplicate request protocol, but the timer-to-time is the re-sending of all unacknowledged frames or reduced link usage.
Selective automatic re-send request protocol (selective Repeat ARQ)Selective automatic Resend request protocol should be an improvement to the fallback n-Frame automatic Resend Request protocol, the size of the received sliding window in the fallback n-Frame automatic Resend Request protocol is 1, but in the selective automatic Resend request protocol, the size of the receiving sliding window is not 1, the sending and receiving window size is 2^m/ 2 (M is the window is a bit long, the reason will be explained again), the following figure illustrates how the protocol works: 1. The first frame sent by the sender is 0, and the first frame to be confirmed is 0. 2. The sender sends frame 0, starts the timer, the next send frame becomes 1, the receiver receives, the window slides back one frame, the next expecting frame is 1, and sends the ACK1. 3. After the sender receives the ACK1, the timer is lifted, and the first frame to be confirmed is added 1, which becomes 1. 4. The sender sends frame 1, the next sent frame becomes 2, but frame 1 is lost during the sending process. 5. The sender sends frame 2, the next sent frame becomes 3, and the receiver receives the frame 2, because frame 2 is received in the receiving window, but the RN is still pointing to 1, so the NAK1 6 is sent. The sender sends frame 3, the next sent frame becomes 4, and the timer is started. The receiver received the frame 3, because frame 2 in the receiving window, so successfully received, but at this time RN still point to 1, at this time NAK1 has been sent, so no more send NAK1. 7. The sender receives the NAK1, re-sends frame 1, the receiver receives frame 1, the frame in the receiver's window has all received, sliding the window, and sends the ACK4. 8. The sender received the NAK4, indicating that the receiver's frame has been received, the window to slide, to release all timers
The following explains why the size of the Send and receive window is 2^M/2, the window size is larger than 2^ (M-1) (M 2), or 3. 1. The sender sends the frame 0, the next sent frame becomes 1, at this time the receiver next expects the frame is 0, receives the frame 0, the RN becomes 1, the window slides, then sends the ACK1, but ACK1 loses in the transmission process. 2. The sender sends the frame 1, the next sent frame becomes 1, at this time the receiver next expects the frame is 1, receives the frame 1, the RN becomes 2, the window slides, then sends the ACK2, but ACK2 loses in the transmission process. 3. The sender sends the frame 2, the next sent frame becomes 3, at this time the receiver next expects the frame is 2, receives the frame 2, the RN becomes 3, the window slides, then sends the ACK3, but ACK3 loses in the transmission process. 4. The sender SN has exceeded the window size, so cannot send, wait until the timer expires, the sender resend frame 0, the receiver window contains frame 0, so frame 0 is received by the receiver incorrectly.
Final conclusion: The size of the sending and receiving window is 2^M/2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.