Data packet transmission method, system, electronic device and storage medium
Through the MQTT over QUIC connection and priority scheduling mechanism, the problem of low-priority data packets blocking high-priority data packets is solved, and the data transmission efficiency and user experience of the IoT system in an unstable network environment are improved.
Patent Information
- Application Number
- CN202510370937.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-03-27
AI Technical Summary
In the case of unstable network, the retransmission of low-priority data packets may block the transmission of high-priority data packets, resulting in delay and loss of high-priority data, affecting user experience. The existing technology has failed to effectively solve the problem of low data packet transmission efficiency.
By establishing an MQTT over QUIC connection, the initial priority of the data packet is obtained and the target priority is determined according to the preset priority rules. The transmission of high-priority data packets is prioritized, bandwidth resources are allocated, and a priority scheduling mechanism is established to prioritize high-priority data packet requests when the network is unstable.
It effectively reduces the obstruction of low-priority data packets on the transmission of high-priority data packets, improves the data transmission efficiency of the IoT system in an unstable network environment, and enhances the user experience.
Smart Images

Figure CN119892745B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data transmission, and in particular to a data packet transmission method, system, electronic device and storage medium. Background Art
[0002] MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol widely used for communication between IoT devices. MQTT supports multiple data streams with varying priorities, making it flexible in handling both real-time and non-real-time data.
[0003] However, in practical applications, especially when the network is unstable, the retransmission of low-priority data packets may block the transmission of high-priority data packets, resulting in delay and loss of high-priority data, affecting user experience.
[0004] Currently, no effective solution has been proposed for the problem of low data packet transmission efficiency in related technologies. Summary of the Invention
[0005] The embodiments of the present application provide a data packet transmission method, system, electronic device, and storage medium to at least solve the problem of low data packet transmission efficiency in the related art.
[0006] In a first aspect, an embodiment of the present application provides a method for transmitting a data packet, the method comprising:
[0007] Establishing an MQTT over QUIC connection, obtaining a data packet to be sent and an initial priority of the data packet, the initial priority including at least two priority levels;
[0008] Determining whether the data packet is a retransmitted data packet, and determining a target priority of the data packet based on the determination result, the initial priority, and a preset priority rule, wherein the preset priority rule includes: a data packet with a higher initial priority has a higher corresponding target priority, and when the initial priorities are the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet;
[0009] Based on the target priority, the data packet is transmitted via an MQTT over QUIC connection.
[0010] In some embodiments, the initial priority includes QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority and QoS=2 being the highest priority; and determining the target priority of the data packet based on the judgment result, the initial priority, and a preset priority rule includes:
[0011] In the case of QoS=0, the target priority of the corresponding initial transmission data packet is set to 0, and the target priority of the corresponding retransmission data packet is set to 1;
[0012] In the case of QoS=1, the target priority of the corresponding initial transmission data packet is set to 2, and the target priority of the corresponding retransmission data packet is set to 3;
[0013] In the case of QoS=2, the target priority of the corresponding initial transmission data packet is set to 4, and the target priority of the corresponding retransmission data packet is set to 5, where 0 is the lowest priority and 5 is the highest priority.
[0014] In some embodiments, the initial priority includes QoS=0, QoS=1, and QoS=2, QoS=0 is the lowest priority, QoS=2 is the highest priority, and there is no retransmission setting for a data packet with QoS=0; determining the target priority of the data packet based on the judgment result, the initial priority, and the preset priority rule includes:
[0015] In the case of QoS=0, the target priority of the corresponding initial transmission data packet is set to 0;
[0016] In the case of QoS=1, the target priority of the corresponding initial transmission data packet is set to 1, and the target priority of the corresponding retransmission data packet is set to 2;
[0017] In the case of QoS=2, the target priority of the corresponding initial transmission data packet is set to 3, and the target priority of the corresponding retransmission data packet is set to 4, where 0 is the lowest priority and 4 is the highest priority.
[0018] In some embodiments, transmitting the data packet based on the target priority through the MQTT over QUIC connection includes:
[0019] During the transmission of the data packets, a priority scheduling mechanism is established to give priority to processing the data packet transmission requests with high target priority when the network is unstable.
[0020] In some embodiments, transmitting the data packet based on the target priority through the MQTT over QUIC connection includes:
[0021] Allocating a corresponding transport stream for the data packet;
[0022] Based on the target priority of the data packets on each transmission flow, corresponding bandwidth resources are allocated to each transmission flow for data transmission.
[0023] In some embodiments, the method further comprises:
[0024] After the data packet is successfully transmitted, it is determined whether to send a confirmation message to the client according to the initial priority and a preset confirmation mechanism.
[0025] In a second aspect, an embodiment of the present application provides a data packet transmission system, the system comprising:
[0026] an acquisition module, configured to establish an MQTT over QUIC connection, obtain a data packet to be sent and an initial priority of the data packet, wherein the initial priority includes at least two priority levels;
[0027] an analysis module, configured to determine whether the data packet is a retransmitted data packet, and determine a target priority of the data packet based on a determination result, the initial priority, and a preset priority rule, wherein the preset priority rule includes: a data packet with a higher initial priority has a higher corresponding target priority; and when the initial priorities are the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet;
[0028] A transmission module is configured to transmit the data packet via an MQTT over QUIC connection based on the target priority.
[0029] In some embodiments, the initial priority includes QoS=0, QoS=1 and QoS=2, QoS=0 is the lowest priority and QoS=2 is the highest priority; the analysis module includes:
[0030] The first priority setting module is used to set the target priority of the corresponding initial transmission data packet to 0 and the target priority of the corresponding retransmission data packet to 1 when QoS=0;
[0031] The second priority setting module is used to set the target priority of the corresponding initial transmission data packet to 2 and the target priority of the corresponding retransmission data packet to 3 when QoS=1;
[0032] The third priority setting module is used to set the target priority of the corresponding initial transmission data packet to 4 and the target priority of the corresponding retransmission data packet to 5 when QoS=2, where 0 is the lowest priority and 5 is the highest priority.
[0033] In a third aspect, an embodiment of the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for transmitting data packets as described in the first aspect above is implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data packet transmission method as described in the first aspect above.
[0035] Compared with related technologies, the data packet transmission method provided in the embodiment of the present application establishes an MQTT over QUIC connection, obtains the data packet to be sent and the initial priority of the data packet, the initial priority includes at least two priority levels, determines whether the data packet is a retransmission data packet, and determines the target priority of the data packet based on the judgment result, the initial priority and the preset priority rule. The preset priority rule includes: the higher the initial priority, the higher the corresponding target priority of the data packet. When the initial priority is the same, the target priority of the retransmission data packet is higher than the target priority of the initial transmission data packet. Based on the target priority, the data packet is transmitted through the MQTT over QUIC connection, solving the problem of low data packet transmission efficiency. By reasonably dividing and scheduling the priorities of MQTT over QUIC data packets, the obstruction of low-priority data packets on the transmission of high-priority data packets is effectively reduced, the data transmission efficiency of the Internet of Things system in an unstable network environment is improved, and the user experience is enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 is a flowchart of a data packet transmission method according to an embodiment of the present application;
[0038] Figure 2 is a structural block diagram of a data packet transmission system according to an embodiment of the present application;
[0039] Figure 3 Schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is described and illustrated below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely used to explain this application and are not intended to limit this application. Based on the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without making any creative efforts are within the scope of protection of this application.
[0041] Obviously, the drawings described below are merely examples or embodiments of the present application. Those skilled in the art can, without inventive effort, apply the present application to other similar scenarios based on these drawings. Furthermore, it is also understood that, although the effort involved in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, changes in design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as an insufficiency of the content disclosed in this application.
[0042] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments unless there is a conflict.
[0043] Unless otherwise defined, technical or scientific terms used herein shall have the ordinary meaning as understood by persons of ordinary skill in the art to which this application belongs. The terms "a," "an," "an," "the," and similar expressions used herein do not denote quantitative limitations and may refer to either the singular or the plural. The terms "comprise," "include," "have," and any variations thereof, used herein, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or modules (units) is not limited to the listed steps or units but may also include steps or units not listed, or may include other steps or units inherent to the process, method, product, or apparatus. The terms "connected," "connected," "coupled," and similar expressions used herein are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. As used herein, "plurality" means two or more. "And / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" may mean: A exists alone; A and B exist simultaneously; or B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.
[0044] This embodiment provides a data packet transmission method. Figure 1 is a flow chart of a data packet transmission method according to an embodiment of the present application, such as Figure 1 As shown, the process includes the following steps:
[0045] Step S201: Establish an MQTT over QUIC connection, obtain a data packet to be sent and an initial priority of the data packet, where the initial priority includes at least two priority levels.
[0046] MQTT is a lightweight, publish / subscribe messaging protocol widely used in the Internet of Things (IoT). In modern network environments, MQTT typically uses different transport layer protocols to ensure efficient and reliable communication. QUIC (Quick UDP Internet Connections) is a new UDP-based transport layer protocol designed to reduce latency and improve the performance of internet connections.
[0047] This application uses MQTT over QUIC for data transmission, optimizing the MQTT protocol through the QUIC transport protocol to improve performance. The QUIC protocol itself has built-in flow control and congestion control mechanisms, which can reduce the impact of packet loss and congestion, thereby providing a more stable connection. In unstable network conditions, it can better maintain the reliability of connection and message delivery and reduce message loss.
[0048] Furthermore, compared to the traditional MQTT TCP connection establishment, QUIC only requires one round trip (1-RTT) to establish a connection, reducing communication latency. Furthermore, QUIC combines mechanisms such as stream multiplexing and forward error correction to optimize the utilization of network resources, enabling more efficient transmission of large numbers of smaller data packets.
[0049] Step S202, determine whether the data packet is a retransmitted data packet, and determine the target priority of the data packet based on the judgment result, the initial priority and the preset priority rules. The preset priority rules include: the higher the initial priority, the higher the corresponding target priority of the data packet. When the initial priority is the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet.
[0050] The initially transmitted data packet is a data packet that is initially transmitted, and the retransmitted data packet is a data packet that is retransmitted.
[0051] The existing QUIC transport layer always considers retransmitted packets to have a higher priority than initially transmitted packets, which can cause high-priority data streams to be blocked by retransmitted packets from lower-priority data streams. This embodiment redefines the priorities of initially transmitted and retransmitted packets. That is, regardless of whether the initial priority of a retransmitted packet or an initially transmitted packet is higher, the corresponding target priority is also higher. Only when the initial priorities are the same will the target priority of the retransmitted packet be higher than the target priority of the initially transmitted packet.
[0052] In some embodiments, the initial priority includes QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority and QoS=2 being the highest priority; step S202 specifically includes:
[0053] Step S301: When QoS=0, the target priority of the corresponding initially transmitted data packet is set to 0, and the target priority of the corresponding retransmitted data packet is set to 1.
[0054] Step S302: When QoS=1, the target priority of the corresponding initially transmitted data packet is set to 2, and the target priority of the corresponding retransmitted data packet is set to 3.
[0055] Step S303, when QoS=2, the target priority of the corresponding initially transmitted data packet is set to 4, and the target priority of the corresponding retransmitted data packet is set to 5, wherein 0 is the lowest priority and 5 is the highest priority.
[0056] In the original MQTT data transmission model, packet priorities are categorized into QoS 0-2, corresponding to the priority of each flow. In the original transmission model, MQTT flows with QoS 0-2 are mapped to priorities 0-2 at the transport layer, with 2 being the highest priority. In this embodiment, the original mapping of QoS 0-2 to priority 0-2 is expanded to a mapping of priorities 0-5.
[0057] Each QoS flow is divided into normal transmission data and retransmission data. Table 1 is a correspondence table between target priority and data flow according to an embodiment of the present application.
[0058] Table 1
[0059] Through the above priority setting, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet only when the initial priority is the same, thereby avoiding the high-priority data stream being blocked by the retransmitted packets of the low-priority data stream, reducing the packet loss rate of the high-priority data packet, and improving the data transmission efficiency of the IoT system in an unstable network environment.
[0060] In some embodiments, the initial priority includes QoS=0, QoS=1, and QoS=2, QoS=0 is the lowest priority, QoS=2 is the highest priority, and there is no retransmission setting for QoS=0 packets; step S202 specifically includes:
[0061] Step S401: When QoS=0, the target priority of the corresponding initially transmitted data packet is set to 0.
[0062] Step S402: When QoS=1, the target priority of the corresponding initially transmitted data packet is set to 1, and the target priority of the corresponding retransmitted data packet is set to 2.
[0063] Step S403, when QoS=2, the target priority of the corresponding initially transmitted data packet is set to 3, and the target priority of the corresponding retransmitted data packet is set to 4, wherein 0 is the lowest priority and 4 is the highest priority.
[0064] In some cases, some low-priority data is not retransmitted due to its low importance. For example, in social media data transmission, data with QoS=0 includes the prompt message "the other party is typing." Because this information is of low importance, the retransmission function can be disabled. In other words, QoS=0 only includes the initial transmission of the data packet, without the retransmission of the data packet.
[0065] Table 2 is another table of correspondence between target priorities and data flows according to an embodiment of the present application.
[0066] Table 2
[0067] Step S203: Based on the target priority, the data packet is transmitted through the MQTT over QUIC connection.
[0068] In some embodiments, step S203 includes:
[0069] Step S2031: assign a corresponding transport stream to the data packet.
[0070] Step S2032: Allocate corresponding bandwidth resources to each transmission stream based on the target priority of the data packets on each transmission stream for data transmission.
[0071] Bandwidth resources are allocated based on target priority. In the case of network instability, data packet transmission requests with high target priority are processed first to prevent high-priority data streams from being blocked by retransmitted packets of low-priority data streams.
[0072] In some embodiments, step S203 specifically includes:
[0073] Step S2033: During the data packet transmission process, a priority scheduling mechanism is established to give priority to processing data packet transmission requests with high target priority when the network is unstable.
[0074] For the retransmission of low-priority data packets, the system will make dynamic adjustments based on the network conditions and the transmission status of high-priority data packets to ensure that the transmission of high-priority data packets is not affected.
[0075] Through the above steps, an MQTT over QUIC connection is established, and the data packet to be sent and the initial priority of the data packet are obtained. The initial priority includes at least two priority levels. It is determined whether the data packet is a retransmission data packet. The target priority of the data packet is determined based on the judgment result, the initial priority, and the preset priority rules. The preset priority rules include: the higher the initial priority, the higher the corresponding target priority of the data packet. When the initial priority is the same, the target priority of the retransmission data packet is higher than the target priority of the initial transmission data packet. Based on the target priority, the data packet is transmitted through the MQTT over QUIC connection, solving the problem of low data packet transmission efficiency. By rationally dividing and scheduling the priorities of MQTT over QUIC data packets, the obstruction of low-priority data packets on the transmission of high-priority data packets is effectively reduced, the data transmission efficiency of the IoT system in an unstable network environment is improved, and the user experience is enhanced.
[0076] Regardless of whether it is a retransmitted data packet or an initial transmission data packet, the higher the initial priority, the higher the corresponding target priority. Only when the initial priorities are the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet, avoiding the high-priority data stream being blocked by the retransmitted packets of the low-priority data stream, reducing the packet loss rate of high-priority data packets, and improving the data transmission efficiency of the Internet of Things system in an unstable network environment.
[0077] In some embodiments, the method further comprises:
[0078] After the data packet is successfully transmitted, it is determined whether to send a confirmation message to the client based on the initial priority and the preset confirmation mechanism.
[0079] By sending a confirmation message to the client, it indicates that the message has been received and confirmed.
[0080] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0081] This embodiment also provides a data packet transmission system, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the terms "module," "unit," "subunit," etc. may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0082] Figure 2is a structural block diagram of a data packet transmission system according to an embodiment of the present application, such as Figure 2 As shown, the system includes:
[0083] The acquisition module 21 is used to establish an MQTT over QUIC connection, obtain a data packet to be sent and an initial priority of the data packet, where the initial priority includes at least two priority levels.
[0084] The analysis module 22 is used to determine whether the data packet is a retransmitted data packet, and determine the target priority of the data packet based on the judgment result, the initial priority and the preset priority rules. The preset priority rules include: the higher the initial priority, the higher the corresponding target priority of the data packet. When the initial priority is the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet.
[0085] The transmission module 23 is used to transmit data packets based on the target priority through the MQTT over QUIC connection.
[0086] In some embodiments, the initial priorities include QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority and QoS=2 being the highest priority; the analysis module 22 includes:
[0087] The first priority setting module is used to set the target priority of the corresponding initial transmission data packet to 0 and the target priority of the corresponding retransmission data packet to 1 when QoS=0.
[0088] The second priority setting module is used to set the target priority of the corresponding initial transmission data packet to 2 and the target priority of the corresponding retransmission data packet to 3 when QoS=1.
[0089] The third priority setting module is used to set the target priority of the corresponding initial transmission data packet to 4 and the target priority of the corresponding retransmission data packet to 5 when QoS=2, where 0 is the lowest priority and 5 is the highest priority.
[0090] In some embodiments, the initial priority includes QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority, QoS=2 being the highest priority, and no retransmission setting for QoS=0 packets; the analysis module 22 includes:
[0091] The fourth priority setting module is used to set the target priority of the corresponding initially transmitted data packet to 0 when QoS=0.
[0092] The fifth priority setting module is used to set the target priority of the corresponding initial transmission data packet to 1 and the target priority of the corresponding retransmission data packet to 2 when QoS=1.
[0093] The sixth priority setting module is used to set the target priority of the corresponding initial transmission data packet to 3 and the target priority of the corresponding retransmission data packet to 4 when QoS=2, where 0 is the lowest priority and 4 is the highest priority.
[0094] In some embodiments, the transmission module 23 includes: a priority scheduling module for establishing a priority scheduling mechanism during the transmission of data packets, so as to give priority to data packet transmission requests with high target priorities when the network is unstable.
[0095] In some embodiments, the transmission module 23 includes: an allocation module for allocating corresponding transmission streams to data packets; and allocating corresponding bandwidth resources to each transmission stream for data transmission based on the target priority of the data packets on each transmission stream.
[0096] In some embodiments, the data packet transmission system further includes: a confirmation module, configured to determine whether to send a confirmation message to the client after the data packet is successfully transmitted, based on the initial priority and a preset confirmation mechanism.
[0097] Through the above system, the acquisition module 21 establishes an MQTT over QUIC connection, obtains the data packet to be sent and the initial priority of the data packet, the initial priority includes at least two priority levels, the analysis module 22 determines whether the data packet is a retransmission data packet, and determines the target priority of the data packet based on the judgment result, the initial priority and the preset priority rule. The preset priority rule includes: the higher the initial priority, the higher the target priority corresponding to the data packet. When the initial priority is the same, the target priority of the retransmission data packet is higher than the target priority of the initial transmission data packet. The transmission module 23 transmits the data packet through the MQTT over QUIC connection based on the target priority, thereby solving the problem of low data packet transmission efficiency. By reasonably dividing and scheduling the priorities of MQTT over QUIC data packets, the obstruction of low-priority data packets on the transmission of high-priority data packets is effectively reduced, the data transmission efficiency of the Internet of Things system in an unstable network environment is improved, and the user experience is enhanced.
[0098] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0099] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0100] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0101] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0102] S1: Establish an MQTT over QUIC connection, obtain a data packet to be sent and an initial priority of the data packet, where the initial priority includes at least two priority levels.
[0103] S2, judge whether the data packet is a retransmitted data packet, and determine the target priority of the data packet based on the judgment result, the initial priority and the preset priority rules. The preset priority rules include: the higher the initial priority, the higher the corresponding target priority of the data packet. When the initial priority is the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet.
[0104] S3 transmits data packets based on target priority via MQTT over QUIC connections.
[0105] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.
[0106] In one embodiment, Figure 3 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 3 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in FIG. Figure 3 As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a data packet transmission method is implemented.
[0107] Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0108] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0109] Those skilled in the art should understand that the various technical features of the above-described embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the various technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0110] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A data packet transmission method, characterized in that: The method comprises: Establishing an MQTT over QUIC connection, obtaining a data packet to be sent and an initial priority of the data packet, the initial priority including at least two priority levels; Determining whether the data packet is a retransmitted data packet, and determining a target priority of the data packet according to a determination result, the initial priority, and a preset priority rule, wherein the preset priority rule includes: a data packet with a higher initial priority corresponds to a higher target priority; when the initial priorities are the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet; when the initial priorities are different, if the initial priority of the initial transmission data packet is higher than the initial priority of the retransmitted data packet, the target priority of the initial transmission data packet is higher than the target priority of the retransmitted data packet; Based on the target priority, transmitting the data packet via an MQTT over QUIC connection; In a case where the initial priorities include QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority and QoS=2 being the highest priority, determining the target priority of the data packet according to the judgment result, the initial priority, and the preset priority rule includes: In the case of QoS=0, the target priority of the corresponding initial transmission data packet is set to 0, and the target priority of the corresponding retransmission data packet is set to 1; In the case of QoS=1, the target priority of the corresponding initial transmission data packet is set to 2, and the target priority of the corresponding retransmission data packet is set to 3; In the case of QoS=2, the target priority of the corresponding initial transmission data packet is set to 4, and the target priority of the corresponding retransmission data packet is set to 5, where 0 is the lowest priority and 5 is the highest priority.
2. The method according to claim 1, characterized in that The initial priorities include QoS=0, QoS=1 and QoS=2, QoS=0 is the lowest priority, QoS=2 is the highest priority, and there is no retransmission setting for QoS=0 packets; Determining the target priority of the data packet according to the judgment result, the initial priority and the preset priority rule includes: In the case of QoS=0, the target priority of the corresponding initial transmission data packet is set to 0; In the case of QoS=1, the target priority of the corresponding initial transmission data packet is set to 1, and the target priority of the corresponding retransmission data packet is set to 2; In the case of QoS=2, the target priority of the corresponding initial transmission data packet is set to 3, and the target priority of the corresponding retransmission data packet is set to 4, where 0 is the lowest priority and 4 is the highest priority.
3. The method according to claim 1, wherein Transmitting the data packet based on the target priority through the MQTT over QUIC connection includes: During the transmission of the data packets, a priority scheduling mechanism is established to give priority to processing the data packet transmission requests with high target priority when the network is unstable.
4. The method according to claim 1, wherein Transmitting the data packet based on the target priority through the MQTT over QUIC connection includes: Allocating a corresponding transport stream for the data packet; Based on the target priority of the data packets on each transmission flow, corresponding bandwidth resources are allocated to each transmission flow for data transmission.
5. The method according to claim 1, wherein The method further comprises: After the data packet is successfully transmitted, it is determined whether to send a confirmation message to the client according to the initial priority and a preset confirmation mechanism.
6. A data packet transmission system, characterized in that: The system comprises: an acquisition module, configured to establish an MQTT over QUIC connection, obtain a data packet to be sent and an initial priority of the data packet, wherein the initial priority includes at least two priority levels; an analysis module, configured to determine whether the data packet is a retransmitted data packet, and determine a target priority of the data packet based on a determination result, the initial priority, and a preset priority rule, wherein the preset priority rule includes: a data packet with a higher initial priority corresponds to a higher target priority; when the initial priorities are the same, the target priority of the retransmitted data packet is higher than the target priority of the initial transmission data packet; when the initial priorities are different, if the initial priority of the initial transmission data packet is higher than the initial priority of the retransmitted data packet, the target priority of the initial transmission data packet is higher than the target priority of the retransmitted data packet; A transmission module, configured to transmit the data packet via an MQTT over QUIC connection based on the target priority; In a case where the initial priorities include QoS=0, QoS=1, and QoS=2, QoS=0 being the lowest priority and QoS=2 being the highest priority, determining the target priority of the data packet according to the judgment result, the initial priority, and the preset priority rule includes: In the case of QoS=0, the target priority of the corresponding initial transmission data packet is set to 0, and the target priority of the corresponding retransmission data packet is set to 1; In the case of QoS=1, the target priority of the corresponding initial transmission data packet is set to 2, and the target priority of the corresponding retransmission data packet is set to 3; In the case of QoS=2, the target priority of the corresponding initial transmission data packet is set to 4, and the target priority of the corresponding retransmission data packet is set to 5, where 0 is the lowest priority and 5 is the highest priority.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the data packet transmission method according to any one of claims 1 to 5 is implemented.
8. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data packet transmission method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Flow scheduling method and system based on dynamic priority
CN116489104A