Scheme Design of data retransmission mechanism based on select retransmission ARQ transmission protocol

Source: Internet
Author: User

1. Background

Recently in the project, due to the use of the TD network to transmit data, data packet loss is serious, and the software group boss asked me to handle the packet loss problem. As a result, I think of the "re-transmission of ARQ" protocol when talking about the data link layer protocol in the computer network (see p187 of Andrews. Tanenbaum in the fourth edition of computer network) to solve the packet loss problem. I was not a good student, so I forgot some details, so I found out the book and quickly browsed the section and remembered the specific workflow. However, this Protocol cannot be directly applied to projects, because the sender is equipped with an ARM chip sensor, and the arm processing capability is very weak, so such a complicated protocol is certainly useless.

2. Specific design

In this project, a function module needs a sensor to collect data five times and then upload the data to the PC through the TD network for processing. Each time data is used as a big package, each big package has 128 small packets. This module can be used only when a large package of data is fully collected. However, due to the unstable TD network, there is always a packet loss during transmission, so this data cannot be used. These sensors are distributed within a broad range of several kilometers to several hundred kilometers from the PC end. The latency of one data acquisition by the sensor is very large (it may take about one minute ), therefore, to improve system performance, data retransmission is particularly important.

As mentioned above, the sender is a sensor with poor processing capabilities. Existing complex protocols cannot be used. Therefore, you can only refer to existing retransmission schemes to design new ones.

Based on the above factors, we have designed a package-making agreement called the "complete package stop agreement. The specific process is shown in:

 

As shown in, the left side is the data retransmission switching diagram, and the right side is the two arrays maintained by the receiver: one for storing the received data packets; the other for each package, 1 indicates that no message is received. 0 indicates that the message has been received.

2.1 Initialization

Initially, when the receiver actively requests data, the initialization variables are: allocate the receiving data queue (128 spaces), and reset the flag Bit Array (unsigned char bit [16]). the initial value is 0xff, indicating that none of them have been received ).

As shown in note a, set a timer for the bit array of the retransmission flag. The delay time is determined based on the value specified in the upper layer.

 

2.2 receive data

After receiving a package (such as B, C, D, E, X), the receiver must do the following:

(1) Place the package in the corresponding position of the data queue;

(2) the corresponding position of the bits array is 0;

(3) cancel the previous timer and re-set the timer for the bit array of the retransmission flag according to the measured delay. For timer management, the Jacobson algorithm is used (also used for TCP timer management ). First, an optimal estimated round-trip time to the target end is provided, which is expressed by RTT. If the data is returned before the timer expires, measure the data transmission time and use M instead.

Here is a smoothing factor, which determines the weight of the old RTT value. In typical cases.

As shown in: When 2nd packets are lost, 3rd packets arrive normally. At this time, 3rd packets are received, and the 2nd packet is not processed. If the latency of 2nd packets reaches (as shown in "D"), the packets are also received normally to reduce the number of retransmission packets. After receiving the last packet of a large package or the timer times out, the bit array of the retransmission flag will be sent to the sender (as shown in F ), if the bits array is all 0 at this time, the corresponding timer is canceled. After receiving the bit array, the sender determines the retransmission packet by detecting the corresponding bit. If the value is 0, all the packets of the large package are normally received (that is, the confirmation message is normally received ), the data of the next big package can be sent. The message sending structure is as follows:

Typeedof // data retransmission {short type; // type int etype; // sub-type int times; // The number of sampled data (0... n needs to be initialized. If no packet is collected, it will be skipped and no collection is made to the K packet.) Char m_byteretrancount [16] // high level... low: 1... 128. If all values are 0, the receipt is complete. You can send the next packet of char reserve2; // reserve one byte ;}

2.3 Flowchart

According to the preceding descriptions, the process of package receiving and package completing is as follows:

3. Summary

This retransmission scheme is actually a mixture of "Stop and other protocols" and "select re-transmission ARQ". There are still many shortcomings in security and need to be further improved according to the actual situation.

* After studying Computer Networks for so many years, I finally applied it to practical projects. When I first learned this course, I thought that he was a literacy course, it will never be used in actual projects. Now it's naive to think about the original idea. Fortunately, I learned this course well at the beginning, but I don't know where to start if I encounter this problem.

 

 

 

 

 

 

 

 

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.