Method and system for dynamically adjusting configuration parameters of LWIP protocol stack

By acquiring real-time network conditions and data volume, and dynamically adjusting the window size and retransmission timeout of the LWIP protocol stack, the problems of low efficiency and insufficient stability of the traditional LWIP protocol stack in dynamic network environments are solved, achieving efficient and stable data transmission.

CN120896900APending Publication Date: 2025-11-04SHAANXI QIANSHAN AVIONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510922992.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-11-04

AI Technical Summary

Technical Problem

Traditional LWIP protocol stacks use fixed configuration parameters, which cannot adapt to dynamically changing network environments, resulting in low data transmission efficiency or insufficient stability.

Method used

By creating UDP connections, network conditions and data volume are obtained in real time, and the window size and retransmission timeout of the LWIP protocol stack are dynamically adjusted, including setting network latency thresholds, packet loss rate thresholds, and data traffic thresholds. The protocol stack parameters are dynamically adjusted based on network conditions and data volume using the RFC6298 algorithm.

Benefits of technology

It implements adaptive configuration of the LWIP protocol stack, improves data transmission efficiency, reduces network congestion and packet loss rate, and ensures data transmission stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120896900A_ABST
    Figure CN120896900A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of network data transmission optimization design, and provides an LWIP protocol stack configuration parameter dynamic adjustment method and system, and the method comprises the steps: obtaining a network condition and a total data volume in real time through transmitting a UDP data packet, the network condition comprising network delay and a packet loss rate; setting initial configuration parameters, a network delay threshold value, a packet loss probability threshold value and a data flow threshold value of the LWIP protocol stack, wherein the initial configuration parameters comprise an initial window and initial retransmission timeout time; dynamically acquiring a current network window and a current retransmission timeout according to the network delay, the network delay threshold, the packet loss rate and the packet loss rate threshold; and dynamically adjusting the current network window and the current retransmission timeout according to the data flow threshold and the total data volume to obtain a final network window and a final retransmission timeout. According to the method, configuration parameters such as window size and retransmission mechanism can be dynamically adjusted according to the network condition and the data size, and the stability of system data transmission is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of network data transmission optimization design, and relates to a LWIP protocol stack configuration parameter dynamic adjustment method and system. BACKGROUND

[0002] At present, the LWIP protocol stack of the traditional LWIP network data transmission technology usually adopts fixed configuration parameters (such as window size, retransmission timeout time, etc.) for transmission. This mode cannot adapt to the dynamically changing network environment, which may cause the technical problems of low data transmission efficiency or insufficient stability. For example, the data acquisition system based on STM32 and LWIP disclosed in Chinese patent CN110825005A cannot realize the function of real-time sensing of network state (such as delay, packet loss rate, etc.), so it cannot optimize the data transmission process according to the network condition. In the case of network congestion or unstable signal, the system may not be able to adjust the transmission strategy in time, which may easily cause data loss or transmission delay. For another example, the remote data acquisition system and method based on the LWIP protocol stack disclosed in Chinese patent CN107294846A, the configuration parameters (such as window size, retransmission mechanism, etc.) of the LWIP protocol stack of the method are static and cannot be dynamically adjusted according to the network condition and data volume. When the network environment changes (such as delay increases, packet loss rate rises) or the data volume surges, the static configuration parameters may reduce the stability of data. SUMMARY

[0003] In order to solve the technical problem that the LWIP protocol stack with fixed configuration parameters cannot adapt to the dynamically changing network environment, which may cause low data transmission efficiency or insufficient stability, the application discloses a LWIP protocol stack configuration parameter dynamic adjustment method, which comprises the following steps: S1, creating a UDP connection, and acquiring network condition and total data volume in real time by sending a UDP data packet, wherein the network condition includes network delay and packet loss rate; S2, setting initial configuration parameters of the LWIP protocol stack, network delay threshold, packet loss rate threshold and data flow threshold, wherein the initial configuration parameters include initial window and initial retransmission timeout time; S3, dynamically acquiring current network window and current retransmission timeout time according to network delay, network delay threshold, packet loss rate and packet loss rate threshold; S4, dynamically adjusting the current network window and the current retransmission timeout time to obtain the final network window and retransmission timeout time according to the data flow threshold and the total data volume.

[0004] Further, in step S1, the UDP connection is created, and network condition data is acquired in real time by sending a UDP data packet, including: S101, the sender and the receiver create UDP connections respectively, and the sender sends a specified number of UDP data packets; S102, the receiver sends a response packet to the sender for each received UDP data packet; S103, after the sender has sent all the UDP data packets, the packet loss rate is calculated based on the total number of sent UDP data packets and the total number of received response packets.

[0005] Further, UDP connections are created to obtain network status data in real time by sending UDP data packets, including: S111, the sender and the receiver create UDP connections respectively, and the sender obtains the sending timestamp of the sent UDP data packets; S112, the receiver sends a response packet to the sender after receiving a UDP data packet, and the sender obtains the receiving timestamp of the received response packet; S113, the network delay is calculated based on the sending timestamp and the receiving timestamp.

[0006] Further, the above step S1 further includes: setting a response packet receiving callback function for the sender, and registering a UDP data packet receiving callback function for the receiver; the receiver sends a response packet to the sender through the UDP data packet receiving callback function for each received UDP data packet, and the sender performs +1 operation on the response packet receiving callback function and obtains the receiving timestamp after receiving each response packet.

[0007] Further, the above step S1 further includes: after obtaining the network status, deleting the UDP connection to release memory and computing resources.

[0008] Further, in the above step S1, UDP connections are created to obtain the total data volume in real time by sending UDP data packets, including: S121, UDP connections are created, and it is determined whether there are UDP data packets to be sent; S122, when there are UDP data packets to be sent, the number of bytes of the current UDP data packet is accumulated in the previous data volume until all UDP data packets are sent, and the total data volume is obtained.

[0009] Further, in the above step S3, the current network window and the current retransmission timeout are dynamically obtained based on the network delay, the network delay threshold, the packet loss rate, and the packet loss rate threshold, including: S31, when the network delay < the network delay threshold and the packet loss rate < the packet loss rate threshold, the current network window is obtained based on the maximum network window, the first growth factor, and the previous network window, and the current retransmission timeout is obtained by the RFC6298 algorithm based on the first growth factor, the weighted average of historical retransmission timeout, the network delay change amplitude, and the minimum retransmission time; S32, when the network delay >= the network delay threshold and / or the packet loss rate >= the packet loss rate threshold, obtaining the current network window according to the minimum network window, the first reduction factor and the previous network window, and obtaining the current retransmission timeout time according to the first reduction factor, the weighted average of the historical retransmission timeout time, the network delay variation range and the maximum retransmission time by the RFC6298 algorithm.

[0010] Further, in the step S4, the final network window and the retransmission timeout time are dynamically adjusted according to the data flow threshold and the total data amount based on the current network window and the current retransmission timeout time, comprising: S41, when the total data amount < the data flow threshold, the current retransmission timeout time and the current network window are selected as the final configuration parameters; S42, when the total data amount >= the data flow threshold, the final network window is obtained according to the maximum network window, the current network window, the second growth factor, the data flow threshold and the total data amount, and the final retransmission timeout time is obtained according to the current retransmission timeout time, the second reduction factor, the weighted average of the historical retransmission timeout time and the network delay variation range threshold.

[0011] The embodiment of the application also provides a system for dynamically adjusting the configuration parameters of the LWIP protocol stack, comprising a network state monitoring module, a data amount analysis module, a parameter configuration module and a configuration parameter dynamic adjustment module.

[0012] The network state monitoring module is used to create a UDP connection and obtain the network state in real time by sending a UDP data packet, and the network state comprises the network delay and the packet loss rate. The data amount analysis module is used to create a UDP connection and obtain the total data amount in real time by sending a UDP data packet. The parameter configuration module is used to set the initial configuration parameters of the LWIP protocol stack, the network delay threshold, the packet loss rate threshold and the data flow threshold, and the initial configuration parameters comprise the initial window and the initial retransmission timeout time. The configuration parameter dynamic adjustment module is used to dynamically obtain the current network window and the current retransmission timeout time according to the network delay, the network delay threshold, the packet loss rate and the packet loss rate threshold, and dynamically adjust the final network window and the retransmission timeout time according to the current network window and the current retransmission timeout time based on the data flow threshold and the total data amount.

[0013] Further, the configuration parameter dynamic adjustment module comprises a first judgment module, a first adjustment module, a second judgment module and a second adjustment module.

[0014] The first judging module is used for judging the network delay and the packet loss rate, the first adjusting module is used for obtaining the current network window according to the maximum network window, the first growth factor and the previous network window when the network delay < the network delay threshold value and the packet loss rate < the packet loss rate threshold value, and obtaining the current retransmission timeout time according to the first growth factor, the weighted average value of the historical retransmission timeout time, the network delay change range and the minimum retransmission time through the RFC6298 algorithm; the current network window is obtained according to the minimum network window, the first reduction factor and the previous network window when the network delay >= the network delay threshold value and / or the packet loss rate >= the packet loss rate threshold value, and the current retransmission timeout time is obtained according to the first reduction factor, the weighted average value of the historical retransmission timeout time, the network delay change range and the maximum retransmission time through the RFC6298 algorithm; The second judging module is used for judging the total data amount, the second adjusting module is used for selecting the current retransmission timeout time and the current network window as the final configuration parameters when the total data amount < the data flow threshold value, and obtaining the final network window according to the maximum network window, the current network window, the second growth factor, the data flow threshold value and the total data amount when the total data amount >= the data flow threshold value, and obtaining the final retransmission timeout time according to the current retransmission timeout time, the second reduction factor, the weighted average value of the historical retransmission timeout time and the network delay change range threshold value.

[0015] Compared with the prior art, the above at least one technical solution adopted by the embodiments of the present application can achieve at least the following beneficial effects: the LWIP protocol stack configuration parameter dynamic adjustment method of the present application can realize real-time sensing of network conditions and data amount, dynamically adjust the protocol stack parameters, and improve the data transmission efficiency. By adaptively configuring the parameters, network congestion and packet loss rate can be effectively reduced, and the stability of data transmission can be ensured. In addition, a ZYNQ development board can be used as a core processing unit, which has high performance and flexibility and is suitable for various network environments. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0017] Figure 1 The flowchart of the LWIP protocol stack configuration parameter dynamic adjustment method disclosed in the embodiments of the present application; Figure 2 The flowchart of the packet loss rate acquisition disclosed in the embodiments of the present application; Figure 3 The flowchart of the network delay acquisition disclosed in the embodiments of the present application; Figure 4 The total data acquisition flowchart disclosed by the embodiment of the application is shown in the following figure: Figure 5 The flowchart of dynamically adjusting the LWIP protocol stack configuration parameters disclosed by the embodiment of the application is shown in the following figure. DETAILED DESCRIPTION

[0018] The embodiments of the application will be described in detail below with reference to the accompanying drawings.

[0019] The embodiments of the application are described below by way of specific examples. Those skilled in the art can easily understand other advantages and effects of the application from the content disclosed in the specification. Obviously, the described embodiments are only a part of the embodiments of the application, not all the embodiments. The application can also be implemented or applied by other different specific embodiments, and the details in the specification can be modified or changed based on different views and applications without departing from the spirit of the application. It should be noted that the following embodiments and features of the embodiments can be combined with each other without conflict. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.

[0020] The window size is an important parameter in the LWIP protocol stack, which is used to control the amount of data that the sender can continuously send without receiving an acknowledgement. A larger window size can improve data transmission efficiency, but may cause an increase in packet loss rate when the network is congested. A smaller window size can reduce the packet loss rate, but will reduce the data transmission efficiency. The retransmission timeout time is a key parameter of the retransmission mechanism, which is used to resend data when the data packet is lost or not acknowledged within a timeout period, to ensure reliable transmission of data. When the network delay is low: shorten the retransmission timeout time, quickly detect packet loss and retransmit, improve transmission efficiency. When the network delay is high: extend the retransmission timeout time, which can avoid false positives and frequent retransmissions caused by delay fluctuations.

[0021] The embodiment of the application discloses a method for dynamically adjusting the configuration parameters of the LWIP protocol stack, as shown in the following figure: Figure 1 The method comprises the following steps: S1, create a UDP connection, and acquire network conditions and total data in real time by sending UDP data packets, wherein the network conditions include network delay and packet loss rate; S2, set the initial configuration parameters of the LWIP protocol stack, the network delay threshold, the packet loss rate threshold, and the data flow threshold, wherein the initial configuration parameters include the initial window and the initial retransmission timeout time; S3, dynamically acquire the current network window and the current retransmission timeout time according to the network delay, the network delay threshold, the packet loss rate, and the packet loss rate threshold; S4, dynamically adjusting the final network window and retransmission timeout time according to the data flow threshold and the total data amount.

[0022] Further, in step S1, referring to Figure 2 as shown, a UDP connection is created, and network condition data is acquired in real time by sending UDP data packets, including: S101, the sender and the receiver create UDP connections respectively, and the sender sends a specified number of UDP data packets; S102, the receiver sends a response packet to the sender for each UDP data packet received; S103, after the sender has sent all the UDP data packets, the packet loss rate is calculated according to the total number of sent UDP data packets and the total number of received response packets.

[0023] Further, referring to Figure 3 as shown, a UDP connection is created, and network condition data is acquired in real time by sending UDP data packets, including: S111, the sender and the receiver create UDP connections respectively, and the sender acquires the sending timestamp of the UDP data packet; S112, the receiver sends a response packet to the sender after receiving the UDP data packet, and the sender acquires the receiving timestamp of the received response packet; S113, the network delay is calculated according to the sending timestamp and the receiving timestamp.

[0024] Further, the above step S1 further includes: setting a response packet receiving callback function for the sender, and registering a UDP data packet receiving callback function for the receiver; the receiver sends a response packet to the sender through the UDP data packet receiving callback function for each UDP data packet received, and the sender performs +1 operation on the response packet receiving callback function and acquires the receiving timestamp after receiving each response packet.

[0025] Further, the above step S1 further includes: after acquiring the network condition, deleting the UDP connection to release memory and computing resources.

[0026] In the above step S1, after establishing the UDP connection, the established UDP connection can be bound to a locally specified port.

[0027] Further, referring to Figure 4 as shown, in the above step S1, a UDP connection is created, and the total data amount is acquired in real time by sending UDP data packets, including: S121, creating a UDP connection, and determining whether there is a UDP data packet to send; S122, when there is a UDP packet sending, the number of bytes of the current UDP packet is accumulated in the previous data volume until all UDP packets are sent, and the total data volume is obtained.

[0028] Further, referring to Figure 5 the above step S3, the current network window and the current retransmission timeout time are dynamically obtained according to the network delay, the network delay threshold, the packet loss rate and the packet loss rate threshold, including: S31, when the network delay < the network delay threshold and the packet loss rate < the packet loss rate threshold, the current network window is obtained according to the maximum network window, the first growth factor and the previous network window, and the current retransmission timeout time is obtained by the RFC6298 algorithm according to the first growth factor, the weighted average value of the historical retransmission timeout time, the network delay change amplitude and the minimum retransmission time; S32, when the network delay ≥ the network delay threshold and / or the packet loss rate ≥ the packet loss rate threshold, the current network window is obtained according to the minimum network window, the first reduction factor and the previous network window, and the current retransmission timeout time is obtained by the RFC6298 algorithm according to the first reduction factor, the weighted average value of the historical retransmission timeout time, the network delay change amplitude and the maximum retransmission time.

[0029] In specific implementation, the network delay threshold RTT thresh may be set to 200ms, the packet loss rate threshold LOSS thresh may be set to 1%, and the data flow threshold T thresh may be set to 1Mbps. If the network delay and the packet loss rate are both lower than the set threshold, it means that the current network state is good, and the network window can be increased and the retransmission time can be shortened, and if they are greater than or equal to the set threshold, the network window can be reduced and the retransmission time can be prolonged.

[0030] Specifically, the adjustment strategy formula of the window size (LWIP_WND) is: When the network state is good, the current network window is obtained by the formula: LWIP_WND new = (min( α ∙ LWIP_WND old , LWIP_WND_MAX) ; When the network state is bad, the current network window is obtained by the formula: LWIP_WND new = (min( LWIP_WND old - β ∙LWIP_WND old`LWIP_WND_MIN` retrieves the current network window; in, LWIP_WND new Indicates the current network window, LWIP_WND old Indicates the front network window, α The first growth factor is set to 1.5 here; β The first reduction factor is set to 0.5 here. LWIP_WND_MAX is the maximum network window set by the system, which can be 64KB. LWIP_WND_MIN is the minimum network window set by the system, which can be 1KB.

[0031] The formula for adjusting the retransmission timeout is: When the network is in good condition, use the formula: RTO new =max( SRTT +K∙ RTTVAR , α ∙RTO_MIN) retrieves the current retransmission timeout; When network conditions are poor, use the formula: RTO new =min( SRTT +K∙ RTTVAR , β • RTO_MAX) Gets the current retransmission timeout; in, SRTT is Weighted average of historical retransmission timeouts , RTTVAR is Network latency variation ; RTO_MIN is the minimum retransmission time, and RTO_MAX is the maximum retransmission time. RTO new This is the current retransmission timeout period.

[0032] Further, see Figure 5 As shown, in step S4 above, the final network window and retransmission timeout are obtained by dynamically adjusting the current network window and the current retransmission timeout based on the data traffic threshold and the total data volume, including: S41. When the total data volume is less than the data traffic threshold, the current retransmission timeout time and the current network window are selected as the final configuration parameters. S42. When the total data volume is greater than or equal to the data traffic threshold, the final network window is obtained based on the maximum network window, the current network window, the second growth factor, the data traffic threshold, and the total data volume. The final retransmission timeout is obtained based on the current retransmission timeout, the second reduction factor, the weighted average of historical retransmission timeouts, and the network latency change threshold.

[0033] In a specific implementation, if the data traffic T exceeds the set threshold T thresh , the current retransmission timeout time and the current network window calculated in step S31 or step S32 can be adjusted again to increase the current network window and reduce the current retransmission timeout time, and vice versa, the current parameters remain unchanged. Specifically, when the amount of data to be transmitted is large, the adjustment strategy formula is as follows: LWIP_WND new1 = (min( LWIP_WND new ∙(1+ α1 ( T -T thresh ) / T thresh ),LWIP_WND_MAX); RTO new1 =max( RTO new ∙(1- β1 ( RTT thresh - SRTT ) / RTT thresh ),RTO_MIN); RTTVAR; wherein, LWIP_WND new1 is the final network window, RTO new1 is the final retransmission timeout time, and the second growth factor α1 may be 0.5 , second shortening factor β1 may be 0.2; T thresh is the data traffic threshold.

[0034] Based on the same inventive concept, the present embodiment also provides a LWIP protocol stack configuration parameter dynamic adjustment system, as described in the following embodiment. Since the principle of solving problems of the LWIP protocol stack configuration parameter dynamic adjustment system is similar to the LWIP protocol stack configuration parameter dynamic adjustment method disclosed in the above embodiment, the implementation of the LWIP protocol stack configuration parameter dynamic adjustment system can be referred to the implementation of the LWIP protocol stack configuration parameter dynamic adjustment method disclosed in the above embodiment, and the repeated parts will not be described. The term "unit" or "module" used below can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiment is preferably implemented in software, hardware, or a combination of software and hardware is also possible and is contemplated.

[0035] The LWIP protocol stack configuration parameter dynamic adjustment system disclosed by the embodiment of the application comprises a network state monitoring module, a data volume analysis module, a parameter configuration module and a configuration parameter dynamic adjustment module, and the structure is described below.

[0036] The network state monitoring module is configured to create a UDP connection and acquire network conditions in real time by sending a UDP data packet, and the network conditions comprise network delay and packet loss rate. The data volume analysis module is configured to create a UDP connection and acquire total data volume in real time by sending a UDP data packet. The parameter configuration module is configured to set initial configuration parameters of the LWIP protocol stack, network delay threshold, packet loss rate threshold and data flow threshold, and the initial configuration parameters comprise an initial window and an initial retransmission timeout. The configuration parameter dynamic adjustment module is configured to dynamically acquire a current network window and a current retransmission timeout according to network delay, network delay threshold, packet loss rate and packet loss rate threshold, and dynamically adjust the current network window and the current retransmission timeout to obtain a final network window and a final retransmission timeout according to the data flow threshold and the total data volume.

[0037] Further, the configuration parameter dynamic adjustment module comprises a first judgment module, a first adjustment module, a second judgment module and a second adjustment module.

[0038] The first judgment module is configured to judge network delay and packet loss rate, and the first adjustment module is configured to acquire the current network window according to the maximum network window, the first growth factor and the previous network window, and acquire the current retransmission timeout according to the first growth factor, the weighted average value of the historical retransmission timeout, the network delay change amplitude and the minimum retransmission time by the RFC6298 algorithm when the network delay is less than the network delay threshold and the packet loss rate is less than the packet loss rate threshold, and acquire the current network window according to the minimum network window, the first reduction factor and the previous network window, and acquire the current retransmission timeout according to the first reduction factor, the weighted average value of the historical retransmission timeout, the network delay change amplitude and the maximum retransmission time by the RFC6298 algorithm when the network delay is greater than or equal to the network delay threshold and / or the packet loss rate is greater than or equal to the packet loss rate threshold. The second judgment module is configured to judge total data volume, and the second adjustment module is configured to select the current retransmission timeout and the current network window as the final configuration parameters when the total data volume is less than the data flow threshold, and acquire the final network window according to the maximum network window, the current network window, the second growth factor, the data flow threshold and the total data volume, and acquire the final retransmission timeout according to the current retransmission timeout, the second reduction factor, the weighted average value of the historical retransmission timeout and the network delay change amplitude threshold when the total data volume is greater than or equal to the data flow threshold.

[0039] The LWIP protocol stack configuration parameter dynamic adjustment method of the present application can realize real-time sensing of network conditions and data size, dynamically adjust the protocol stack parameters, and improve the data transmission efficiency. By adaptively configuring the parameters, network congestion and packet loss rate can be effectively reduced, and the stability of data transmission can be ensured. In addition, a ZYNQ development board can be used as a core processing unit, which has high performance and flexibility, and is suitable for various network environments.

[0040] Obviously, those skilled in the art should understand that each module or each step of the above-mentioned embodiments of the present application can be realized by a general computing device, which can be concentrated on a single computing device or distributed on a network composed of multiple computing devices, and can be realized by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in different order, or they can be manufactured into individual integrated circuit modules, or multiple modules or steps can be manufactured into a single integrated circuit module. Therefore, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0041] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for dynamically adjusting LWIP protocol stack configuration parameters, characterized in that, include: Establish a UDP connection and obtain network status and total data volume in real time by sending UDP packets. Network status includes network latency and packet loss rate. Set the initial configuration parameters of the LWIP protocol stack, network latency threshold, packet loss rate threshold, and data traffic threshold. The initial configuration parameters include the initial window and the initial retransmission timeout. Dynamically obtain the current network window and the current retransmission timeout based on network latency, network latency threshold, packet loss rate, and packet loss rate threshold. Based on the data traffic threshold and total data volume, the current network window and the current retransmission timeout are dynamically adjusted to obtain the final network window and retransmission timeout.

2. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 1, characterized in that, Establish a UDP connection and obtain real-time network status data by sending UDP packets, including: The sender and receiver each establish a UDP connection, and the sender sends a specified number of UDP packets. Each time the receiver receives a UDP packet, it sends a response packet to the sender. After the sender finishes sending UDP packets, the packet loss rate is calculated based on the total number of UDP packets sent and the total number of response packets received.

3. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 1, characterized in that, Establish a UDP connection and obtain real-time network status data by sending UDP packets, including: The sender and receiver each establish a UDP connection, and the sender obtains the timestamp of the UDP data packet being sent; After receiving a UDP packet, the receiver sends a response packet to the sender, and the sender obtains the timestamp of the received response packet. Calculate the network latency based on the sending and receiving timestamps.

4. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 2 or 3, characterized in that, Also includes: Set up a response packet reception callback function for the sender and register a UDP packet reception callback function for the receiver; Each time the receiver receives a UDP packet, it sends a response packet to the sender through the UDP packet reception callback function. Each time the sender receives a response packet, it increments the response packet reception callback function by 1 and obtains the reception timestamp.

5. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 2 or 3, characterized in that, Also includes: After obtaining network information, delete UDP connections to free up memory and computing resources.

6. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 1, characterized in that, Establish a UDP connection and obtain the total data volume in real time by sending UDP packets, including: Create a UDP connection, check if there are UDP packets to send, and when UDP packets are sent, add the number of bytes of the current UDP packet to the previous data volume until all UDP packets have been sent, and then get the total data volume.

7. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 1, characterized in that, Based on network latency, network latency threshold, packet loss rate, and packet loss rate threshold, dynamically obtain the current network window and current retransmission timeout, including: When network latency is less than network latency threshold and packet loss rate is less than packet loss rate threshold, the current network window is obtained based on the maximum network window, the first growth factor and the previous network window. The current retransmission timeout is obtained based on the first growth factor, the weighted average of historical retransmission timeout times, the network latency change magnitude and the minimum retransmission time, using the RFC6298 algorithm. When network latency is greater than or equal to the network latency threshold and / or packet loss rate is greater than or equal to the packet loss rate threshold, the current network window is obtained based on the minimum network window, the first reduction factor, and the previous network window. The current retransmission timeout is obtained using the RFC6298 algorithm based on the first reduction factor, the weighted average of historical retransmission timeout times, the magnitude of network latency change, and the maximum retransmission time.

8. The method for dynamically adjusting LWIP protocol stack configuration parameters according to claim 1, characterized in that, Based on the data traffic threshold and total data volume, the current network window and retransmission timeout are dynamically adjusted to obtain the final network window and retransmission timeout, including: When the total data volume is less than the data traffic threshold, the current retransmission timeout time and the current network window are selected as the final configuration parameters. When the total data volume is greater than or equal to the data traffic threshold, the final network window is obtained based on the maximum network window, the current network window, the second growth factor, the data traffic threshold, and the total data volume. The final retransmission timeout is obtained based on the current retransmission timeout, the second reduction factor, the weighted average of historical retransmission timeouts, and the network latency change threshold.

9. A system for dynamically adjusting LWIP protocol stack configuration parameters, characterized in that, include: The network status monitoring module is used to create UDP connections and obtain network status in real time by sending UDP packets. The network status includes network latency and packet loss rate. The data volume analysis module is used to create UDP connections and obtain the total data volume in real time by sending UDP data packets. The parameter configuration module is used to set the initial configuration parameters of the LWIP protocol stack, network latency threshold, packet loss rate threshold, and data traffic threshold. The initial configuration parameters include the initial window and the initial retransmission timeout. The configuration parameter dynamic adjustment module is used to dynamically obtain the current network window and the current retransmission timeout based on network latency, network latency threshold, packet loss rate, and packet loss rate threshold; and to dynamically adjust the current network window and the current retransmission timeout based on the data traffic threshold and the total data volume to obtain the final network window and retransmission timeout.

10. The LWIP protocol stack configuration parameter dynamic adjustment system according to claim 9, characterized in that, The configuration parameter dynamic adjustment module includes: The first judgment module is used to judge network latency and packet loss rate; The first adjustment module is used to obtain the current network window based on the maximum network window, the first growth factor, and the previous network window when the network latency is less than the network latency threshold and the packet loss rate is less than the packet loss rate threshold; and to obtain the current retransmission timeout time based on the first growth factor, the weighted average of historical retransmission timeout times, the network latency change magnitude, and the minimum retransmission time using the RFC6298 algorithm. When the network latency is greater than or equal to the network latency threshold and / or the packet loss rate is greater than or equal to the packet loss rate threshold, the first adjustment module is used to obtain the current network window based on the minimum network window, the first reduction factor, and the previous network window; and to obtain the current retransmission timeout time based on the first reduction factor, the weighted average of historical retransmission timeout times, the network latency change magnitude, and the maximum retransmission time using the RFC6298 algorithm. The second judgment module is used to judge the total amount of data. The second adjustment module is used to select the current retransmission timeout time and the current network window as the final configuration parameters when the total data volume is less than the data traffic threshold; when the total data volume is greater than or equal to the data traffic threshold, it obtains the final network window based on the maximum network window, the current network window, the second growth factor, the data traffic threshold, and the total data volume, and obtains the final retransmission timeout time based on the current retransmission timeout time, the second reduction factor, the weighted average of historical retransmission timeout times, and the network latency change magnitude threshold.

Citation Information

Patent Citations

  • Method and device for setting link aggregation group

    CN107294846A

  • Data acquisition system based on STM32 and LWIP

    CN110825005A