Data communication and network notes-error control protocol at the data link layer

Source: Internet
Author: User

Data communication and network notes-error control protocol at the data link layer
The following describes three protocols for error control. 1. the Stop-and-Wait ARQ protocol is used to Stop the process of waiting for an automatic recurring request. In the figure, the Sn points to the number of the frame to be sent, rn points to the number of the frame to be received next time. The frame number can be used cyclically. It is 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), where the serial number ranges from 0 ~ 1, so the number field is 1 (0 ~ 2-1) The processing steps are as follows: 1. the sender sends a frame numbered 0 and starts the timer. After receiving the frame, the receiver expects the number of the next received frame to be 1 and sends ACK1 to the sender. the sender receives ACK1 within the time specified by the timer, the timer stops, and the Sn points to 1, that is, the next frame sent with ID 1. 3. The sender sends the frame numbered 1 and starts the timer, but the frame is lost during transmission. 4. the sender-side timer times out, resends a frame numbered 1 and starts the timer. After receiving the frame, the receiver expects the number of the next received frame to be 0, and sends ACK0 to the sender. the sender receives ACK0 within the time specified by the timer, the timer stops, and the Sn points to 0, that is, the next frame sent with no. 0. 6. the sender sends a frame numbered 0 and starts the timer. After receiving the frame, the receiver expects the number of the next received frame to 1 and sends ACK1 to the sender 7. the sender does not receive ACK1 within the specified time. Therefore, the sender resends the frame pointed to by the Sn (number: 0), but the receiver expects a frame numbered 1, frames numbered 0 have been confirmed to be received. Therefore, frames numbered 0 are discarded and ACK1 is sent to the receiver. The above is the process of stopping the automatic repetition request protocol, but the efficiency of this protocol is very inefficient. If it is me, it will never be used... 2. the Go-Back Automatic Repeat Request (Go-Back Automatic Repeat Request) protocol involves the concept of a sliding window and an abstract concept of a sliding window, it is used to define the sequence range that the sender and receiver care about. The sequence range that the sender cares about is the transmission sliding window, and the sequence receiving sliding window that the receiver cares about. In the automatic Resend Request protocol for N frames, the size of the send sliding window must be less than 2 ^ m (m indicates the length of the window, and the reason will be explained again ), the size of the received sliding window is 1. The following describes the protocol. The gray part of the middle part is the window range, and the bit segment of the number is 2, therefore, the size of the send window is 2 ^ 2-1 = 3, and the size of the receive sliding window is 1. Sf is the first frame to be confirmed, and Sn is the frame to be sent next. Rn is the frame to be received. 1. the sender's first frame to be sent is 0, and the first frame to be confirmed is 0.
2. the sender sends frame 0, the next frame to be sent is 1, the receiver receives frame 0, the next frame to be received is 1, and then ACK1 is sent.
3. The sender receives ACK1 and the next frame to be confirmed changes to 1.
4. the sender sends frame 1, and the next frame to be sent is 2. The receiver receives frame 1, the next frame to be received is 2, and then ACK2 is sent, but ACK2 is lost during transmission.
5. The sender sends frame 2, the next frame to be sent is 3, the receiver receives frame 2, the next frame to be received is 3, and then sends ACK3.
6. The sender sends frame 3, the next frame to be sent is changed to 4, the receiver receives frame 3, the next frame to be received is changed to 4, and then sends ACK4.
7. when the sender receives ACK3 and the next frame to be confirmed changes to 3, there may be questions about why the sender does not receive ACK2, so it can ensure that the receiver has received frame 1, if the receiver does not receive frame 2 and the Rn value is always 1, the sender receives ACK3, indicating that frame 2 must have been received.
8. the sender receives ACK4, And the next frame to be confirmed is changed to 4. In this protocol, we only use a timer, that is, when Sf = Sn, the start timer is used, when the timer reaches the time, if the Sn is not equal to Sf, all frames from Sf to Sn will be resold. The window size must be smaller than 2 ^ m. See: 1. the sender sends a frame numbered 0. The first frame to be confirmed is 0, the next frame to be sent is 1, and the receiver expects to receive a frame of 0, however, the ACK sent is lost. 2. the sender does not receive the ACK, so the Sf is still 1. Next, send the frame numbered 1, and the Sn is 2. The receiver expects the received frame to be 1, but the ACK is lost. 3. the sender does not receive the ACK, so the Sf is still 1. Next, the sender continues to send the frame numbered 2, and the Sn changes to 3. The receiver expects the received frame to be 2, but the ACK is lost. 4. the sender does not receive the ACK, so the Sf is still 1. Next, the sender continues to send frames numbered 3, with the Sn changed to 4, and the receiver expects to receive three frames, but the ACK is lost. 5. the sender never receives the ACK of the frame number 1. At this time, the timer times out and the sender needs to send all frames between Sf and Sn in sequence, so the frame number 0 is sent, at this time, the receiver expects the frame number to be 1. Therefore, the receiver should have rejected the frame, but it was accepted, resulting in an error. So the conclusion is: the size of the send sliding window must be less than 2 ^ m to roll back N frames of automatic Resend Request Protocol than to stop waiting for automatic repeated request protocol has made some progress, however, when the timer arrives, it resends all unconfirmed frames or reduces the link usage. The Selective Repeat ARQ protocol should be an improvement in the N-frame automatic Resend Request protocol, the size of the receiving sliding window in the automatic resending request protocol for N frames is 1, but in the selective automatic resending request protocol, the size of the receiving sliding window is not 1, the maximum size of the sending and receiving windows is 2 ^ m/2 (m indicates the bit length of the window, and the reason will be explained again). The working principle of the Protocol is described as follows: 1. the sender's first frame to be sent is 0, and the first frame to be confirmed is 0. 2. the sender sends 0 frames, starts the timer, And the next frame is changed to 1. After the receiver receives the message, the window slides a frame backward, and the next expected frame is 1, and send ACK1.3. after the sender receives ACK1, the timer is released. Then, add 1 to the first frame to be confirmed and change it to 1. 4. When the sender sends frame 1, the next frame is changed to 2, but frame 1 is lost during transmission. 5. the sender sends frame 2, the next frame is changed to 3, and the timer is started. The receiver receives frame 2. Because frame 2 is in the receiving window, it is successfully received, however, at this time, Rn still points to 1, so the sender sends the NAK16. sender sends the frame 3, the next sent frame changes to 4, and starts the timer. The receiver receives the frame 3, because frame 2 is in the receiving window, it is successfully received, but Rn still points to 1. Now NAK1 has been sent, so no more NAK1.7. the sender has received NAK1, resend frame 1, and the receiver receives frame 1. At this time, all frames in the receiver's window have been received, slide the window, and send ACK4.8. the sender receives NAK4, it indicates that all frames of the receiver have been received and the window slides. The following explains why the maximum size of the sending and receiving windows is 2 ^ m/2, the window size is greater than 2 ^ (S-1) (m is 2), that is, 3. 1. the sender sends 0 frames, and the next frame to be sent changes to 1. At this time, the next expected frame of the receiver is 0. After the received frame is 0, Rn changes to 1. The window slides and ACK1 is sent again, however, ACK1 is being transferred. Lost. 2. the sender sends frame 1 and the next frame is changed to 1. The next expected frame of the receiver is 1. After the receiver receives frame 1, the Rn changes to 2. The window slides and ACK2 is sent again, however, ACK2 is lost during transmission. 3. the sender sends frame 2 and the next frame is changed to 3. The next expected frame of the receiver is 2. After the received frame is 2, the Rn changes to 3. The window slides and ACK3 is sent again, however, ACK3 is lost during transmission. 4. the sender's Sn has exceeded the window size, so it cannot be sent. When the timer times out, the sender resends frame 0 and the receiver's window contains frame 0, therefore, frame 0 is incorrectly received by the receiver. Conclusion: the maximum size of the sending and receiving windows 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.