CN110149278B - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN110149278B
CN110149278B CN201910428636.9A CN201910428636A CN110149278B CN 110149278 B CN110149278 B CN 110149278B CN 201910428636 A CN201910428636 A CN 201910428636A CN 110149278 B CN110149278 B CN 110149278B
Authority
CN
China
Prior art keywords
sequence number
maximum
sliding window
target
data packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910428636.9A
Other languages
Chinese (zh)
Other versions
CN110149278A (en
Inventor
刘袁
王亚林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Miaozhen Information Technology Co Ltd
Original Assignee
Miaozhen Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Miaozhen Information Technology Co Ltd filed Critical Miaozhen Information Technology Co Ltd
Priority to CN201910428636.9A priority Critical patent/CN110149278B/en
Publication of CN110149278A publication Critical patent/CN110149278A/en
Application granted granted Critical
Publication of CN110149278B publication Critical patent/CN110149278B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/33Flow control; Congestion control using forward notification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/34Flow control; Congestion control ensuring sequence integrity, e.g. using sequence numbers

Abstract

The application provides a data transmission method and a device, wherein the data transmission method comprises the following steps: acquiring a target serial number of a data packet to be stored currently; determining a target position sequence number of a data packet to be stored in the sliding window at present according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window; and storing the data packet to be stored at present in the target position sequence number in the sliding window. By the data transmission method, the received out-of-order data packets can be orderly forwarded to the receiving end, and the transmission rate of the data packets is ensured; and when the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum position sequence number, creating a null data packet and completing missing data packets in the data stream, so that a receiving end can process the data stream according to ordered and full-volume logic, the processing logic of the data stream is simplified, and the processing efficiency is improved.

Description

Data transmission method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data transmission method and apparatus.
Background
Streaming data is a set of sequential, large, fast, continuous arriving data sequences, and in general, a data stream can be viewed as a dynamic collection of data that grows indefinitely over time. In streaming data transmission/reception, it is necessary to ensure that all packets are in order and not lost.
In the prior art, in a Transmission Control Protocol (TCP), a sliding window is used in cooperation with a timer to ensure that data is sent in order and a data packet is received by a receiving party.
However, the above method needs to know the number of packets to be transmitted in advance, and further uses a timer to ensure that each packet is actually received by the receiving end, and the number of packets to be transmitted before the streaming data is transmitted is unknown, so a method for transmitting streaming data is needed.
Disclosure of Invention
In view of this, an object of the present invention is to provide a data transmission method and apparatus, which can forward the received out-of-order data packets to a receiving end in order and ensure the transmission rate of the data packets.
In a first aspect, an embodiment of the present application provides a data transmission method, including:
acquiring a target serial number of a data packet to be stored currently;
determining a target position serial number of the data packet to be stored currently in the sliding window according to the target serial number, the maximum serial number in the serial numbers of the data packets stored in the sliding window and the maximum position serial number of the sliding window;
and storing the data packet to be stored currently in the target position sequence number in the sliding window.
With reference to the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, where before determining, according to the target sequence number, a maximum sequence number of sequence numbers of packets already stored in a sliding window, and a maximum position sequence number of the sliding window, a target position sequence number of the packet to be currently stored in the sliding window, the method further includes:
acquiring the maximum sequence number in the sequence numbers of the data packets stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number;
if not, deleting the data packet to be stored currently.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides a second possible implementation manner of the first aspect, where if the target sequence number is greater than the maximum sequence number and less than a sum of the maximum sequence number and the maximum location sequence number; determining the sequence number of the target position where the current data packet to be stored is stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window, including:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transfer value as a subtracted number, taking the maximum serial number as a subtracted number, and calculating a difference value between the first transfer value and the maximum serial number;
and taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides a third possible implementation manner of the first aspect, where if the target sequence number is greater than or equal to a sum of the maximum sequence number and the maximum location sequence number; determining the sequence number of the target position where the current data packet to be stored is stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window, including:
adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if so, determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window.
With reference to the third possible implementation manner of the first aspect, an embodiment of the present application provides a fourth possible implementation manner of the first aspect, where the method further includes:
and if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and executing the step of adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain the first sequence number until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides a fifth possible implementation manner of the first aspect, where the method further includes:
and forwarding the data packets stored in the sliding window from small to large according to the position sequence number in the sliding window.
In a second aspect, an embodiment of the present application further provides a data transmission apparatus, where the data transmission apparatus includes:
the acquisition module is used for acquiring the target serial number of the data packet to be stored currently;
the determining module is used for determining a target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window and the maximum position sequence number of the sliding window;
and the storage module is used for storing the data packet to be stored at present in the target position sequence number in the sliding window.
With reference to the second aspect, the present application provides a first possible implementation manner of the second aspect, where the method further includes:
the judging module is used for acquiring the maximum serial number in the serial numbers of the data packets stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number or not;
and if not, deleting the data packet to be stored currently.
With reference to the first possible implementation manner of the second aspect, this application provides a second possible implementation manner of the second aspect, where if the target sequence number is greater than the maximum sequence number and less than a sum of the maximum sequence number and the maximum position sequence number; the determining module is specifically configured to:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transit value as a subtree, taking the maximum sequence number as a subtree, and calculating a difference value between the first transit value and the maximum sequence number;
and taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window.
With reference to the first possible implementation manner of the second aspect, this application provides a third possible implementation manner of the second aspect, where if the target serial number is greater than or equal to a sum of the maximum serial number and the maximum location serial number; the determining module is specifically configured to:
adding one to the maximum sequence number to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if so, determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window.
The data transmission method and device provided by the embodiment of the application comprise the following steps: acquiring a target serial number of a data packet to be stored currently; determining a target position sequence number of a data packet to be stored in the sliding window at present according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window; and storing the data packet to be stored at present in the target position sequence number in the sliding window. By the data transmission method, the received out-of-order data packets can be orderly forwarded to the receiving end, and the transmission rate of the data packets is ensured; and when the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum position sequence number, creating a null data packet and completing missing data packets in the data stream, so that a receiving end can process the data stream according to ordered and full-volume logic, the processing logic of the data stream is simplified, and the processing efficiency is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 shows a flowchart of a data transmission method provided in an embodiment of the present application;
fig. 2 is a flowchart illustrating another data transmission method provided in an embodiment of the present application;
fig. 3 is a flowchart illustrating another data transmission method provided by an embodiment of the present application;
fig. 4 is a schematic structural diagram illustrating a data transmission apparatus according to an embodiment of the present application;
fig. 5 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
In the prior art, in a Transmission Control Protocol (TCP), a sliding window is used in cooperation with a timer to ensure that data is sent in order and a data packet is received by a receiving party. However, the above method needs to know the number of packets transmitted in advance, and then uses a timer to ensure that each packet is actually received by the receiving end, and the number of packets to be transmitted is unknown before the streaming data is transmitted. In view of the above problems, the data transmission method and apparatus provided in the embodiments of the present application may sequentially forward the received out-of-order data packets to the receiving end, and ensure the transmission rate of the data packets.
For the convenience of understanding the embodiments of the present application, a data transmission method disclosed in the embodiments of the present application is first described in detail.
As shown in fig. 1, a flowchart of a data transmission method when a server is used as an execution subject in the embodiment of the present application is shown, which includes the following specific steps:
s101, acquiring a target serial number of a data packet to be stored currently.
In a specific implementation, a sending end continuously sends a large number of data packets to a receiving end, so that the receiving end analyzes according to the received data packets. Here, the data packet may be a production log or the like generated by a plurality of devices.
The server in the embodiment of the application can control the sliding window, receive the data packet before the receiving end receives the data packet, and then forward the data packet to the receiving end, so that the purpose of forwarding the received out-of-order data packet to the receiving end in order is achieved.
Specifically, after receiving the data packet to be currently stored, the target sequence number of the data packet to be currently stored is extracted from the data packet to be currently stored. The sequence number of the data packet may be a sequence number of the data packet calibrated by the sending end, or may be determined by the server according to a time stamp of the arrival of the data packet, and the sequence number of each data packet has uniqueness.
S102, determining the sequence number of the target position of the data packet to be stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window and the maximum position sequence number of the sliding window.
In the implementation, the server monitors information such as the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window and the maximum position sequence number of the sliding window in real time. The maximum position sequence number of the sliding window is the number of the data packets which can be stored most in the sliding window, and the number can be set according to actual requirements.
After the target sequence number of the data packet to be stored currently is obtained, the target position sequence number of the data packet to be stored currently in the sliding window is determined according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window.
In practical application, after the serial number of the data packet is calibrated, the data packet may arrive at the sliding window in a delayed manner or may arrive at the sliding window in advance, so that before the serial number of the target position where the data packet to be stored is stored in the sliding window is determined, the maximum serial number in the serial numbers of the data packets stored in the sliding window is obtained, and whether the target serial number is greater than or equal to the maximum serial number is judged; if the target sequence number is smaller than the maximum sequence number, namely the sliding window has already received the data packet or has created the corresponding empty data packet, deleting the data packet to be stored at present; if the target sequence number is greater than or equal to the maximum sequence number, the target position sequence number of the data packet to be currently stored in the sliding window is determined according to the method shown in fig. 2 provided in the embodiment of the present application.
And S103, storing the data packet to be stored at present in the target position sequence number in the sliding window.
In specific implementation, after the target position sequence number of the data packet to be stored currently in the sliding window is determined, the target position sequence number of the data packet to be stored currently in the sliding window is stored.
And sequentially forwarding the data packets stored in the sliding window from small to large according to the position sequence number in the sliding window, so that the data packets can be sequentially forwarded to a receiving end.
By the data transmission method provided by the embodiment of the application, the received out-of-order data packets can be orderly forwarded to the receiving end, and the transmission rate of the data packets is ensured.
After judging whether the target sequence number is greater than or equal to the maximum sequence number, if the target sequence number is greater than the maximum sequence number, judging whether the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number again, and if the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number, determining the target position sequence number of the data packet to be stored in the sliding window according to the method shown in fig. 2, wherein the specific steps are as follows:
s201, acquiring a first position serial number stored in a sliding window by a data packet corresponding to the maximum serial number;
s202, summing the first position sequence number and the target sequence number to obtain a first transfer value;
s203, taking the first transit value as a decremented number and the maximum sequence number as a decremented number, and calculating a difference value between the first transit value and the maximum sequence number;
and S204, taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window.
For example, the maximum position sequence number of the sliding window is 16, the target sequence number of the data packet to be currently stored is 135, the server detects that the maximum sequence number of the sequence numbers of the data packets already stored in the sliding window is 130, and the first position sequence number of the data packet corresponding to the maximum sequence number 130 stored in the sliding window is 3, first, the first position sequence number 3 is added to the target sequence number 135 to obtain a first transit value 138; then, taking the first intermediate value 138 as a decremented number, taking the maximum sequence number 130 as a decremented number, and calculating the difference value between the first intermediate value 138 and the maximum sequence number 130 to be 8; and finally, taking the difference value 8 as a dividend, taking the maximum position serial number 16 as a divisor, obtaining a remainder of 8 corresponding to the difference value 8 and the maximum position serial number 16, taking the remainder 8 as a target position serial number of the current data packet stored in the sliding window, and storing the current data packet to be stored in the position of the sliding window with the position serial number of 8.
According to this method, the data packet corresponding to the sequence number 136 may be stored in the position with the sliding window position sequence number of 9, the data packet corresponding to the sequence number 137 may be stored in the position with the sliding window position sequence number of 10, the data packet corresponding to the sequence number 138 may be stored in the position with the sliding window position sequence number of 11, and so on. It should be noted that the server controls the sliding window to forward the stored data packets to the receiving end from small to large according to the position sequence number in the sliding window.
If the target sequence number is determined to be greater than or equal to the sum of the maximum sequence number and the maximum position sequence number, determining the target position sequence number of the data packet to be stored in the sliding window according to the method shown in fig. 3, wherein the specific steps are as follows:
s301, performing plus-one calculation on the maximum sequence number corresponding to the data packet in the current sliding window to obtain a first sequence number;
s302, creating an empty data packet corresponding to the first sequence number;
s303, storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
s304, judging whether the target serial number is smaller than the sum of the first serial number and the maximum position serial number;
s305, if yes, determining the target position sequence number of the data packet to be stored in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window and the maximum position sequence number of the sliding window.
S306, if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and returning to the step 301 until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number.
In implementations, packets may arrive ahead of time in the sliding window. For example, the maximum position sequence number of the sliding window is 16, the target sequence number of the data packet to be currently stored is 146, the server detects that the maximum sequence number of the sequence numbers of the data packets already stored in the sliding window is 130, and the first position sequence number stored in the sliding window by the data packet corresponding to the maximum sequence number 130 is 3, the server determines that the target sequence number 146 is greater than or equal to the sum of the maximum sequence number 130 and the maximum position sequence number 16 through judgment, and then the data packet to be currently stored arrives at the sliding window in advance, and exceeds the maximum allowable delay limit of the sliding window (the maximum allowable delay limit of the sliding window is the number of the data packets which can be stored most in the sliding window), then the maximum sequence number 130 corresponding to the data packet in the current sliding window is added with a calculation to obtain a first sequence number 131; creating an empty data packet corresponding to the first sequence number 131, and storing the empty data packet in a position sequence number corresponding to the empty data packet in the sliding window; the location sequence number corresponding to the null data packet may be determined according to the method shown in fig. 2.
After the empty data packet corresponding to the first sequence number 131 is stored in the position sequence number corresponding to the empty data packet in the sliding window, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window in the current sliding window is the first sequence number 131, and whether the target sequence number 146 is smaller than the sum of the first sequence number 131 and the maximum position sequence number 16 is determined. At this time, if it is determined that the target sequence number 146 is smaller than the sum of the first sequence number 131 and the maximum position sequence number 16, the target position sequence number of the data packet to be currently stored in the sliding window is determined according to the target sequence number 146, the maximum sequence number 131 of the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number 16 of the sliding window, which is specifically referred to the method of fig. 2.
If the target sequence number is larger than or equal to the sum of the first sequence number and the maximum position sequence number, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and returning to the step 301 until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number.
Based on the same inventive concept, embodiments of the present application further provide a data transmission apparatus corresponding to the data transmission method, and since the principle of the apparatus in the embodiments of the present application for solving the problem is similar to the data transmission method described above in the embodiments of the present application, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 4, a data transmission device according to another embodiment of the present application includes:
an obtaining module 401, configured to obtain a target sequence number of a data packet to be currently stored;
a determining module 402, configured to determine, according to the target sequence number, a maximum sequence number in sequence numbers of data packets already stored in a sliding window, and a maximum position sequence number of the sliding window, a target position sequence number, in which the data packet to be currently stored is stored in the sliding window;
a storing module 403, configured to store the data packet to be currently stored in the target location serial number in the sliding window.
In one embodiment, the data transmission apparatus further includes:
a determining module 404, configured to obtain a maximum sequence number from the sequence numbers of the data packets already stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number;
if not, deleting the data packet to be stored currently.
In another embodiment, if the target sequence number is greater than the maximum sequence number and less than the sum of the maximum sequence number and the maximum position sequence number; the determining module 402 is specifically configured to:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transit value as a subtree, taking the maximum sequence number as a subtree, and calculating a difference value between the first transit value and the maximum sequence number;
and taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window.
In yet another embodiment, if the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum location sequence number; the determining module 402 is specifically configured to:
adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if yes, determining the target position sequence number stored in the sliding window of the data packet to be stored currently according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window.
In yet another embodiment, the determining module 402 is further configured to:
and if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and executing the step of adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain the first sequence number until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number.
In another embodiment, the data transmission apparatus further includes:
and the forwarding module 405 is configured to forward the data packets stored in the sliding window from small to large in sequence according to the position sequence number in the sliding window.
Fig. 5 illustrates a structure of an electronic device 500 according to an embodiment of the present invention, where the electronic device 500 includes: at least one processor 501, at least one network interface 504 or other user interface 503, storage 505, at least one communication bus 502. A communication bus 502 is used to enable connective communication between these components. The electronic device 500 optionally contains a user interface 503 including a display (e.g., touchscreen, LCD, CRT, holographic (Holographic) or projection (Projector), etc.), a keyboard or a pointing device (e.g., mouse, trackball (trackball), touch pad or touchscreen, etc.).
The storage 505 may comprise a read-only storage and a random access storage and provides instructions and data to the processor 501. A portion of memory 505 may also include non-volatile random access memory (NVRAM).
In some embodiments, store 505 stores the following elements, executable modules or data structures, or a subset thereof, or an expanded set thereof:
an operating system 5051, containing various system programs, for implementing various basic services and processing hardware-based tasks;
the application module 5052 contains various applications, such as a desktop (launcher), a Media Player (Media Player), a Browser (Browser), etc., for implementing various application services.
In an embodiment of the present invention, processor 501, by invoking programs or instructions stored in storage 505, is configured to:
acquiring a target sequence number of a data packet to be stored currently;
determining a target position serial number of the data packet to be stored currently in the sliding window according to the target serial number, the maximum serial number in the serial numbers of the data packets stored in the sliding window and the maximum position serial number of the sliding window;
and storing the data packet to be stored at present in the target position sequence number in the sliding window.
Optionally, in the method executed by the processor 501, before determining, according to the target sequence number, a maximum sequence number of sequence numbers of data packets already stored in the sliding window, and a maximum position sequence number of the sliding window, a target position sequence number of the data packet to be currently stored in the sliding window is stored in the sliding window, the method further includes:
acquiring the maximum sequence number in the sequence numbers of the data packets stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number;
and if not, deleting the data packet to be stored currently.
Optionally, in the method executed by the processor 501, if the target sequence number is greater than the maximum sequence number and less than the sum of the maximum sequence number and the maximum position sequence number; the determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window includes:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transit value as a subtree, taking the maximum sequence number as a subtree, and calculating a difference value between the first transit value and the maximum sequence number;
and taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window.
Optionally, in the method executed by the processor 501, if the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum position sequence number; determining the sequence number of the target position where the current data packet to be stored is stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window, including:
adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if so, determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window.
Optionally, the processor 501 executes a method further including:
and if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and executing the step of adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain the first sequence number until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number.
Optionally, the processor 501 executes a method, further including:
and forwarding the data packets stored in the sliding window from small to large according to the position sequence number in the sliding window.
The computer program product of the data transmission method and apparatus provided in the embodiment of the present application includes a computer readable storage medium storing a program code, and instructions included in the program code may be used to execute the method in the foregoing method embodiment.
Specifically, the storage medium can be a general storage medium, such as a removable disk, a hard disk, or the like, and when the computer program on the storage medium is executed, the data transmission method can be executed, so that the received out-of-order data packets can be sequentially forwarded to the receiving end, and the transmission rate of the data packets is ensured.
The functions, if implemented as software functional units and sold or used as a stand-alone product, may reside in a non-transitory computer readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: those skilled in the art can still make modifications or changes to the embodiments described in the foregoing embodiments, or make equivalent substitutions for some features, within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (2)

1. A method of data transmission, comprising:
acquiring a target sequence number of a data packet to be stored currently;
determining a target position serial number of the data packet to be stored currently in the sliding window according to the target serial number, the maximum serial number in the serial numbers of the data packets stored in the sliding window and the maximum position serial number of the sliding window;
storing the data packet to be stored at present in the target position sequence number in the sliding window;
determining the sequence number of the target position where the current data packet to be stored is stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window, including:
judging whether the target sequence number is greater than or equal to the maximum sequence number;
if the target sequence number is greater than the maximum sequence number, judging whether the target sequence number is less than the sum of the maximum sequence number and the maximum position sequence number again;
if the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number, determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window;
before determining the sequence number of the target position where the current data packet to be stored is stored in the sliding window according to the sequence number of the target, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the sequence number of the maximum position of the sliding window, the method further includes:
acquiring the maximum sequence number in the sequence numbers of the data packets stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number;
if not, deleting the data packet to be stored currently;
if the target sequence number is greater than the maximum sequence number and less than the sum of the maximum sequence number and the maximum position sequence number; the determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window includes:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transit value as a subtree, taking the maximum sequence number as a subtree, and calculating a difference value between the first transit value and the maximum sequence number;
taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored currently stored in the sliding window;
if the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum position sequence number; the determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets already stored in the sliding window, and the maximum position sequence number of the sliding window includes:
adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if so, determining a target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window;
if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and executing the step of adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain the first sequence number until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number;
the data transmission method further comprises:
and forwarding the data packets stored in the sliding window from small to large according to the position sequence number in the sliding window.
2. A data transmission apparatus, comprising:
the acquisition module is used for acquiring the target serial number of the data packet to be stored currently;
the determining module is used for determining a target position serial number of the data packet to be stored currently in the sliding window according to the target serial number, the maximum serial number in the serial numbers of the data packets stored in the sliding window and the maximum position serial number of the sliding window;
the storage module is used for storing the data packet to be stored at present in the target position sequence number in the sliding window;
the determination module is to:
judging whether the target sequence number is greater than or equal to the maximum sequence number;
if the target serial number is greater than the maximum serial number, judging whether the target serial number is less than the sum of the maximum serial number and the maximum position serial number again;
if the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number, determining the target position sequence number of the data packet to be stored currently in the sliding window according to the target sequence number, the maximum sequence number in the sequence numbers of the data packets stored in the sliding window and the maximum position sequence number of the sliding window;
further comprising:
the judging module is used for acquiring the maximum serial number in the serial numbers of the data packets stored in the sliding window;
judging whether the target sequence number is greater than or equal to the maximum sequence number or not;
if not, deleting the data packet to be stored currently;
if the target sequence number is greater than the maximum sequence number and less than the sum of the maximum sequence number and the maximum position sequence number; the determining module is specifically configured to:
acquiring a first position sequence number of the data packet corresponding to the maximum sequence number and stored in the sliding window;
summing the first position sequence number and the target sequence number to obtain a first transit value;
taking the first transit value as a subtree, taking the maximum sequence number as a subtree, and calculating a difference value between the first transit value and the maximum sequence number;
taking the difference value as a dividend, taking the maximum position serial number as a divisor, obtaining a remainder corresponding to the difference value and the maximum position serial number, and taking the remainder as a target position serial number of the data packet to be stored in the sliding window;
if the target sequence number is greater than or equal to the sum of the maximum sequence number and the maximum position sequence number; the determining module is specifically configured to:
adding one to the maximum sequence number to obtain a first sequence number;
creating an empty data packet corresponding to the first sequence number;
storing the empty data packet in a position serial number corresponding to the empty data packet in the sliding window;
judging whether the target sequence number is smaller than the sum of the first sequence number and the maximum position sequence number;
if so, determining a target position serial number of the data packet to be stored currently in the sliding window according to the target serial number, the maximum serial number in the serial numbers of the data packets stored in the sliding window and the maximum position serial number of the sliding window;
the determining module is further configured to:
if not, taking the first sequence number as the maximum sequence number corresponding to the data packet in the current sliding window, and executing a step of adding one to the maximum sequence number corresponding to the data packet in the current sliding window to obtain the first sequence number until the target sequence number is smaller than the sum of the maximum sequence number and the maximum position sequence number;
further comprising:
and the forwarding module is used for sequentially forwarding the data packets stored in the sliding window from small to large according to the position sequence number in the sliding window.
CN201910428636.9A 2019-05-22 2019-05-22 Data transmission method and device Active CN110149278B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910428636.9A CN110149278B (en) 2019-05-22 2019-05-22 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910428636.9A CN110149278B (en) 2019-05-22 2019-05-22 Data transmission method and device

Publications (2)

Publication Number Publication Date
CN110149278A CN110149278A (en) 2019-08-20
CN110149278B true CN110149278B (en) 2023-01-17

Family

ID=67592630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910428636.9A Active CN110149278B (en) 2019-05-22 2019-05-22 Data transmission method and device

Country Status (1)

Country Link
CN (1) CN110149278B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115134434A (en) * 2022-06-17 2022-09-30 奇安信科技集团股份有限公司 Session connection monitoring method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1277390C (en) * 2003-05-09 2006-09-27 华为技术有限公司 Method for ordering to eliminate its jitter time delay by rank of RTP data packet
CN101471784B (en) * 2007-12-29 2011-07-27 北京天融信网络安全技术有限公司 Method for implementing IPSEC resistance of replay aggression
CN101394252A (en) * 2008-11-12 2009-03-25 北京佳讯飞鸿电气股份有限公司 Data transmission method based on RTP
US8474034B2 (en) * 2011-04-19 2013-06-25 Futurewei Technologies, Inc. Method and apparatus for fast check and update of anti-replay window without bit-shifting in internet protocol security

Also Published As

Publication number Publication date
CN110149278A (en) 2019-08-20

Similar Documents

Publication Publication Date Title
CN106850402B (en) Message transmission method and device
US9069726B2 (en) Iteratively calculating standard deviation for streamed data
US10116746B2 (en) Data storage method and network interface card
CN110609872A (en) Method and apparatus for synchronizing node data
CN105550051A (en) Asynchronous processing method and device of business request
CN112650790B (en) Target point cloud plane determining method and device, electronic equipment and storage medium
KR101426575B1 (en) Distributed processing system and method
CN110581812A (en) Data message processing method and device
CN106572146A (en) Message sending method and message sending device
EP3369238B1 (en) Method, apparatus, computer-readable medium and computer program product for cloud file processing
CN110766348B (en) Method and device for combining goods picking tasks
CN110149278B (en) Data transmission method and device
CN110399329B (en) RDMA data processing method and related device
CN113259415A (en) Network message processing method and device and network server
CN104270287A (en) Message disorder detecting method and device
CN110770720B (en) Resource searching method and related products
CN104618324A (en) Method and device for transmitting data and detecting data legality
CN115550250B (en) Small flow message retransmission method, system, electronic equipment and storage medium
CN103746843A (en) Method and equipment for processing RPC (Remote Procedure Call Protocol) command
CN111277488A (en) Session processing method and device
US9332071B2 (en) Data stage-in for network nodes
CN107580033B (en) Load information processing method and device, message processing method and device, and server
JP2017212617A (en) Network device, queue control method, and computer system
CN112417326A (en) URL conversion method and device, electronic equipment and storage medium
CN116915860B (en) Instruction transmission method, device, equipment and medium based on UDP

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant