Data packet transmission method, apparatus, device, and readable storage medium
By sending ACK confirmation messages to retransmit lost data packets only when preset conditions are met in a stable network environment or a local data center with low latency and high bandwidth, the problem of wasted bandwidth in TCP transmission by ACK messages is solved, and transmission efficiency is improved.
Patent Information
- Application Number
- CN202411508626.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-10-28
AI Technical Summary
In a local computer room with a stable network environment or low latency and large bandwidth, the existing TCP transmission method of transmitting a large number of ACK messages wastes bandwidth and has low transmission efficiency.
By receiving data packets from the client and determining whether preset response conditions are met, an ACK confirmation message is sent only when the conditions are met to retransmit lost data packets, thereby reducing the transmission of invalid ACK messages.
It reduces invalid packets in the bandwidth and improves bandwidth utilization and transmission efficiency.
Smart Images

Figure CN119402146B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data packet transmission method, apparatus, device, and readable storage medium. Background Art
[0002] Currently, a basic mechanism for implementing TCP's reliable transmission is the confirmation and response mechanism, that is, each time a receiver receives a new data packet, it must send a special confirmation character (Acknowledge character, ACK) message as a response.
[0003] When a data packet is lost during transmission, there are currently three methods to ensure that the lost data is retransmitted: timeout retransmission, fast retransmission, and selective acknowledgment (SACK). All three transmission methods require the transmission of a large number of protocol control ACK messages unrelated to user services during the TCP transmission process.
[0004] However, if the network environment is stable, or in a communication scenario within a local computer room with low latency and large bandwidth, the above method of transmitting a large number of ACK messages is too cumbersome, wastes bandwidth, and has low transmission efficiency. Summary of the Invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data packet transmission method, apparatus, device and readable storage medium to reduce the number of transmissions of protocol control ACK messages that are not related to user services, thereby reducing invalid packets in the bandwidth, improving bandwidth utilization, and improving transmission efficiency.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for transmitting a data packet, the method comprising:
[0007] Receive a data packet sent by a client, the data packet including a starting sequence number and a data length;
[0008] Determine whether the preset response conditions are currently met;
[0009] If the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0010] In a second aspect, an embodiment of the present disclosure provides a data packet transmission device, the device comprising:
[0011] A receiving module is used to receive a data packet sent by a client, wherein the data packet includes a starting sequence number and a data length;
[0012] A judgment module is used to judge whether the preset response conditions are currently met;
[0013] The sending module is used to send an ACK confirmation message to the client if the preset response condition is currently met, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0014] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0015] Memory;
[0016] processor; and
[0017] computer programs;
[0018] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in the first aspect.
[0020] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, implements the method described in the first aspect.
[0021] The data packet transmission method, apparatus, device and readable storage medium provided by the embodiments of the present disclosure receive a data packet sent by a client, the data packet including a starting sequence number and a data length, and determine whether a preset response condition is currently satisfied. If the preset response condition is currently satisfied, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet. Compared with the prior art, the embodiments of the present disclosure determine whether the preset response condition is currently satisfied. Only when the preset response condition is currently satisfied will an ACK confirmation message be sent to the client, thereby reducing the number of transmissions of protocol control ACK messages that are not related to user services, thereby reducing invalid packets in the bandwidth, improving bandwidth utilization, and improving transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0024] Figure 1 A flow chart of a data packet transmission method provided in an embodiment of the present disclosure;
[0025] Figure 2 A flow chart of a data packet transmission method provided in another embodiment of the present disclosure;
[0026] Figure 3 A flow chart of a data packet transmission method provided in another embodiment of the present disclosure;
[0027] Figure 4 A schematic diagram of a data packet transmission process in a no-packet-loss scenario provided by an embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram of a data packet transmission process in a packet loss scenario provided by an embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram of the structure of a data packet transmission device provided in an embodiment of the present disclosure;
[0030] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0032] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0033] Currently, a basic mechanism for implementing TCP's reliable transmission is the confirmation and response mechanism, that is, each time a receiver receives a new data packet, it must send a special confirmation character (Acknowledge character, ACK) message as a response.
[0034] When a data packet is lost during transmission, there are currently three methods to ensure that the lost data is retransmitted: timeout retransmission, fast retransmission, and selective acknowledgment (SACK). All three transmission methods require the transmission of a large number of protocol control ACK messages unrelated to user services during the TCP transmission process.
[0035] However, in a stable network environment or in a local data center with low latency and high bandwidth, the above-mentioned method of transmitting a large number of ACK messages is too cumbersome, wastes bandwidth, and has low transmission efficiency. To address this problem, the present disclosure provides a data packet transmission method, which is described below in conjunction with specific embodiments.
[0036] Figure 1 Flowchart of the data packet transmission method provided in the embodiment of the present disclosure. The executor of the method is an electronic device. The electronic device is, for example, a server, which can specifically be a portable mobile device such as a smart phone, a tablet computer, a laptop computer, a car navigation device, or smart sports equipment; it can also be a fixed device such as a personal computer, a smart home appliance, or a server, wherein the server can be a single server or a server cluster, and the server cluster can be a distributed cluster or a centralized cluster. The method can be applied to scenarios where data packets are transmitted, and can also be applied to scenarios where data packets are transmitted based on TCP. It can be understood that the data packet transmission method provided in the embodiment of the present disclosure can also be applied in other scenarios.
[0037] Below Figure 1 The data packet transmission method shown in FIG is introduced, wherein the client is the data packet sender and the server is the data packet receiver. The specific steps of the method are as follows:
[0038] S101: Receive a data packet sent by a client, where the data packet includes a starting sequence number and a data length.
[0039] In this step, the client sends a data packet to the server, and the server receives the data packet sent by the client. The data packet can be one or more, without limitation. The data packet includes a starting sequence number, data length, and may also include an Internet Protocol (IP) address and port number, without limitation.
[0040] S102: Determine whether a preset response condition is currently met.
[0041] In this step, the server determines whether the preset response conditions are met. Only when the preset response conditions are met will the server respond, that is, send an ACK message to the client, reducing the number of responses and improving bandwidth utilization.
[0042] In some embodiments, S102 may include but is not limited to S1021, S1022, and S1023:
[0043] S1021. Calculate the out-of-sequence value of the data packet based on the starting sequence number of the data packet.
[0044] After receiving a data packet, the server can obtain the starting sequence number of the data packet. Based on the starting sequence number of each data packet, it can determine whether the data packet is out of order and further calculate the out-of-order value of the data packet. In some embodiments, the out-of-order value can be determined based on the number of out-of-order data packets. For example, if there are two out-of-order data packets, the out-of-order value is 2; if there are four out-of-order data packets, the out-of-order value is 4. In some embodiments, the out-of-order value can also be calculated using other methods, which are not specifically limited here.
[0045] S1022: Determine whether the out-of-sequence value reaches a preset out-of-sequence value threshold.
[0046] In this step, the server determines whether the out-of-order value reaches a preset out-of-order value threshold. If the out-of-order value reaches the preset out-of-order value threshold, step S1023 is executed.
[0047] In some embodiments, if the disorder value does not reach a preset disorder value threshold, that is, the disorder value is less than the preset disorder value threshold, it is determined that the preset response condition is not currently met.
[0048] S1023: If the out-of-sequence value reaches a preset out-of-sequence value threshold, it is determined that a preset response condition is currently met.
[0049] If it is determined that the out-of-order value is greater than or equal to the preset out-of-order value threshold, the server determines that the preset response condition is currently met.
[0050] S103: If the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0051] When the preset response condition is currently met, the server sends an ACK confirmation message to the client. Further, the client receives the ACK confirmation message, obtains the sequence number information of the lost data packet based on the ACK confirmation message, and retransmits the lost data packet to the server.
[0052] The embodiment of the present disclosure receives a data packet sent by a client, the data packet including a starting sequence number and a data length, determines whether a preset response condition is currently met, and if so, sends an ACK confirmation message to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet. Compared with the prior art, the embodiment of the present disclosure determines whether the preset response condition is currently met, and only sends an ACK confirmation message to the client if the preset response condition is currently met, thereby reducing the number of transmissions of protocol control ACK messages that are not related to user services, thereby reducing invalid packets in the bandwidth, improving bandwidth utilization, and improving transmission efficiency.
[0053] Figure 2 A flow chart of a data packet transmission method provided in another embodiment of the present disclosure is shown as follows: Figure 2 As shown, the method includes the following steps:
[0054] S201. Establish a TCP connection with the client.
[0055] In this step, the server first establishes a TCP connection with the client. Only after the connection is established can data packets be sent and received.
[0056] In some embodiments, establishing a TCP connection with the client includes: responding to a connection request sent by the client, replying to the client to agree to establish the connection, and establishing a TCP connection with the client.
[0057] For example, the client sends a connection request to the server. The server receives the connection request sent by the client, and further responds to the connection request, responding to the client to agree to establish the connection, and establishes a TCP connection between the client and the server.
[0058] S202: Receive a data packet sent by the client, where the data packet includes a starting sequence number and a data length.
[0059] Specifically, the implementation process and principle of S202 and S101 are the same and will not be repeated here.
[0060] S203: Record the time interval from the last response to the client, and determine whether the time interval reaches a preset time threshold.
[0061] In this step, the server records the time interval since its last response to the client and determines whether the time interval has reached a preset time threshold. The "last response to the client" can be understood as the server's most recent communication with the client, such as the server's most recent message sent to the client. For example, if the preset time threshold is 5ms, the server will determine whether the time interval since the last response to the client has reached 5ms.
[0062] S204: If the time interval reaches a preset time threshold, it is determined that a preset response condition is currently met.
[0063] If the time interval is greater than or equal to the preset time threshold, the server determines that the preset response condition is currently met.
[0064] In some embodiments, if the time interval does not reach a preset time threshold, that is, the time interval is less than the preset time threshold, it is determined that the preset response condition is not currently met.
[0065] S205: Detect whether data packet loss currently occurs.
[0066] After determining that the preset response condition is currently met, the server will detect whether data packet loss occurs. If it is detected that no data packet loss occurs, S206 is executed; if it is detected that data packet loss occurs, S207 is executed.
[0067] In some embodiments, S205 may include but is not limited to S2051, S2052, S2053, and S2054:
[0068] S2051. Parse the received data packet to obtain the sequence number information of the received data packet;
[0069] S2052: performing statistics based on the sequence number information of the received data packets to determine whether the sequence numbers of the received data packets are continuous;
[0070] S2053: If the sequence numbers of the received data packets are discontinuous, it is determined that a data packet loss situation currently occurs;
[0071] S2054: If the sequence numbers of the received data packets are continuous, it is determined that no data packet loss has occurred.
[0072] S206: If no data packet loss occurs, an ACK message is sent to the client, where the ACK message includes the received end sequence number information.
[0073] If the server detects that there is no data packet loss, it will send an ACK message to the client, and the ACK message includes the received end sequence number information. Figure 4 As shown, the client (sender) sent 4 data packets to the server (receiver), and the server received all 4 data packets. The server sent an ACK confirmation message to the client, and the content of the ACK confirmation message was "ack: 5004", indicating that the server has currently received the data packets with sequence numbers before 5004.
[0074] S207. If data packet loss occurs, determine the sequence number information of the lost data packet and send an ACK confirmation message to the client. The ACK confirmation message includes the received cutoff sequence number information and the sequence number information of the lost data packet, so that the client retransmits the lost data packet based on the sequence number information of the lost data packet.
[0075] If the server detects that a data packet is currently lost, it determines the sequence number information of the lost data packet and sends an ACK confirmation message to the client. The ACK confirmation message includes the received end sequence number information and the sequence number information of the lost data packet. Further, the client receives the ACK confirmation message and retransmits the lost data packet according to the sequence number information of the lost data packet in the ACK confirmation message. Figure 5 As shown, the client (sender) sent 4 data packets to the server (receiver), but the third data packet was lost and the server did not receive it. The server determined that the sequence number information of the lost data packet was 3002-4003, and the server sent an ACK confirmation message to the client. The content of the ACK confirmation message is "ack: 5004, loss ack: 3002-4003", indicating that the server has currently received the data packets with sequence numbers before 5004 and the sequence numbers of the lost data packets are 3002-4003.
[0076] The embodiment of the present disclosure establishes a TCP connection with the client and receives a data packet sent by the client, wherein the data packet includes a starting sequence number and a data length. Furthermore, the time interval from the last response to the client is recorded to determine whether the time interval reaches a preset time threshold. If the time interval reaches the preset time threshold, it is determined that the preset response condition is currently met. Then, it is detected whether a data packet loss situation currently occurs. If a data packet loss situation currently occurs, an ACK confirmation message is sent to the client, and the ACK confirmation message includes the received end sequence number information; if a data packet loss situation currently occurs, the sequence number information of the lost data packet is determined, and an ACK confirmation message is sent to the client, and the ACK confirmation message includes the received end sequence number information and the sequence number information of the lost data packet, so that the client retransmits the lost data packet based on the sequence number information of the lost data packet. Compared to the prior art, the disclosed embodiment records the time interval since the last response to the client and determines whether the time interval has reached a preset time threshold. If the time interval has reached the preset time threshold, it is determined that the preset response condition is currently met. Only when the preset response condition is currently met will an ACK confirmation message be sent to the client, reducing the number of transmissions of protocol control ACK messages unrelated to user services, thereby reducing invalid packets in the bandwidth, improving bandwidth utilization, and increasing transmission efficiency. Furthermore, if data packet loss is detected, the sequence number information of the lost data packet is determined, and an ACK confirmation message is sent to the client. The ACK confirmation message will carry the sequence number information of the lost data packet, facilitating the client to retransmit the lost data packet.
[0077] Figure 3 A flow chart of a data packet transmission method provided in another embodiment of the present disclosure is shown as follows: Figure 3 As shown, the method includes the following steps:
[0078] S301: Receive a data packet sent by a client, where the data packet includes a starting sequence number and a data length.
[0079] Specifically, the implementation process and principle of S301 and S101 are the same and will not be described in detail here.
[0080] S302: Record multiple round-trip delays of the current transmission link, and calculate the average value and variance of the multiple round-trip delays.
[0081] In this step, the server records the round-trip delays of the current transmission link and calculates the average and variance of these delays. Round-trip delay is the time difference between when a data packet is sent and when it is received.
[0082] S303: Based on the average value and variance of the multiple round-trip delays, predict a receiving time range of a data packet corresponding to a next sequence number.
[0083] In this step, the server predicts the reception time range of the data packet corresponding to the next sequence number based on the average and variance of the multiple round-trip delays. In some embodiments, the reception time range of the data packet corresponding to the next sequence number can be predicted using a preset prediction algorithm, or using a pre-trained machine learning model, without specific limitation herein.
[0084] S304: Determine whether a data packet corresponding to the next sequence number is received within a receiving time range.
[0085] In this step, the server determines whether the data packet corresponding to the next sequence number is received within the receiving time range. If the data packet corresponding to the next sequence number is not received within the receiving time range, S305 is executed.
[0086] In some embodiments, if a data packet corresponding to the next sequence number is received within the receiving time range, it is determined that the preset response condition is not currently met.
[0087] S305: If the data packet corresponding to the next sequence number is not received within the receiving time range, it is determined that the preset response condition is currently met.
[0088] If the data packet corresponding to the next sequence number is not received within the receiving time range, the server determines that the preset response condition is currently met.
[0089] S306: If the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0090] Specifically, the implementation process and principle of S306 and S103 are the same and will not be repeated here.
[0091] The disclosed embodiment receives a data packet sent by a client, the data packet including a starting sequence number and a data length, records multiple round-trip delays of the current transmission link, calculates the average and variance of the multiple round-trip delays, and predicts the reception time range of the data packet corresponding to the next sequence number based on the average and variance of the multiple round-trip delays. Furthermore, it determines whether the data packet corresponding to the next sequence number is received within the reception time range. If the data packet corresponding to the next sequence number is not received within the reception time range, it is determined that a preset response condition is currently met. Furthermore, if the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet. Compared to the prior art, the disclosed embodiment determines whether the data packet corresponding to the next sequence number is received within the reception time range. If the data packet corresponding to the next sequence number is not received within the reception time range, it is determined that the preset response condition is currently met. Only when the preset response condition is currently met will an ACK confirmation message be sent to the client, reducing the number of transmissions of protocol control ACK messages unrelated to user services, thereby reducing invalid packets in the bandwidth, improving bandwidth utilization, and improving transmission efficiency.
[0092] Figure 6 Schematic diagram of the structure of the data packet transmission device provided in the embodiment of the present disclosure. The data packet transmission device can be the electronic device as described in the above embodiment, or the data packet transmission device can be a component or assembly in the electronic device. The data packet transmission device provided in the embodiment of the present disclosure can execute the processing flow provided in the embodiment of the data packet transmission method, such as Figure 6 As shown, the data packet transmission device 40 includes: a receiving module 41, a judgment module 42, and a sending module 43; wherein, the receiving module 41 is used to receive a data packet sent by the client, and the data packet includes a starting sequence number and a data length; the judgment module 42 is used to judge whether a preset response condition is currently met; the sending module 43 is used to send an ACK confirmation message to the client if the preset response condition is currently met, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0093] Optionally, the device further includes: a connection module 44; the connection module 44 is configured to establish a TCP connection with the client;
[0094] When establishing a TCP connection with the client, the connection module 44 is specifically configured to: respond to a connection request sent by the client, reply to the client to agree to establish the connection, and establish a TCP connection with the client.
[0095] Optionally, when the judgment module 42 judges whether the preset response condition is currently met, it is specifically used to: record the time interval from the last response to the client, and judge whether the time interval reaches the preset time threshold; if the time interval reaches the preset time threshold, it is determined that the preset response condition is currently met.
[0096] Optionally, when the judgment module 42 judges whether the preset response condition is currently met, it is specifically used to: calculate the disorder value of the data packet based on the starting sequence number of the data packet; judge whether the disorder value reaches the preset disorder value threshold; if the disorder value reaches the preset disorder value threshold, it is determined that the preset response condition is currently met.
[0097] Optionally, when the judgment module 42 judges whether the preset response condition is currently met, it is specifically used to: record multiple round-trip delays of the current transmission link, and calculate the average value and variance of the multiple round-trip delays; based on the average value and variance of the multiple round-trip delays, predict the receiving time range of the data packet corresponding to the next serial number; judge whether the data packet corresponding to the next serial number is received within the receiving time range; if the data packet corresponding to the next serial number is not received within the receiving time range, it is determined that the preset response condition is currently met.
[0098] Optionally, when the sending module 43 sends an ACK confirmation message to the client, it is specifically used to: detect whether data packet loss currently occurs; if data packet loss currently does not occur, send an ACK confirmation message to the client, and the ACK confirmation message includes the received end sequence number information; if data packet loss currently occurs, determine the sequence number information of the lost data packet, and send an ACK confirmation message to the client, and the ACK confirmation message includes the received end sequence number information and the sequence number information of the lost data packet, so that the client retransmits the lost data packet based on the sequence number information of the lost data packet.
[0099] Optionally, when the sending module 43 detects whether a data packet loss situation currently occurs, it is specifically used to: parse the received data packet to obtain the serial number information of the received data packet; perform statistics based on the serial number information of the received data packet to determine whether the serial numbers of the received data packets are continuous; if the serial numbers of the received data packets are discontinuous, it is determined that a data packet loss situation currently occurs; if the serial numbers of the received data packets are continuous, it is determined that a data packet loss situation currently occurs.
[0100] Figure 6 The data packet transmission device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0101] Figure 7This is a schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 7 , which shows a structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. Figure 7 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0102] like Figure 7 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the data packet transmission method of the embodiment described in the present disclosure. Various programs and data required for the operation of the electronic device 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0103] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0104] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart, thereby implementing the data packet transmission method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0105] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0106] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0107] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0108] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0109] Receive a data packet sent by a client, the data packet including a starting sequence number and a data length;
[0110] Determine whether the preset response conditions are currently met;
[0111] If the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet.
[0112] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0113] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0115] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0116] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0117] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0118] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0119] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0120] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A data packet transmission method, characterized in that: The method comprises: Receive a data packet sent by a client, the data packet including a starting sequence number and a data length; Determine whether the preset response conditions are currently met; If the preset response condition is currently met, an ACK confirmation message is sent to the client, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet; The determination of whether the preset response condition is currently met includes: Calculating an out-of-sequence value of the data packet based on a starting sequence number of the data packet; Determining whether the out-of-order value reaches a preset out-of-order value threshold; If the disorder value reaches a preset disorder value threshold, it is determined that the preset response condition is currently met; The sending an ACK confirmation message to the client includes: Detect whether there is data packet loss; If no data packet loss occurs, an ACK message is sent to the client, where the ACK message includes the received end sequence number information; If data packet loss occurs, the sequence number information of the lost data packet is determined, and an ACK confirmation message is sent to the client. The ACK confirmation message includes the received cutoff sequence number information and the sequence number information of the lost data packet, so that the client retransmits the lost data packet based on the sequence number information of the lost data packet.
2. The method according to claim 1, characterized in that Before receiving the data packet sent by the client, the method further includes: Establish a TCP connection with the client; Establishing a TCP connection with the client includes: In response to the connection request sent by the client, the TCP connection is established between the client and the TCP client.
3. The method according to claim 1, characterized in that The determination of whether the preset response condition is currently met includes: Record the time interval from the last response to the client, and determine whether the time interval reaches a preset time threshold; If the time interval reaches the preset time threshold, it is determined that the preset response condition is currently met.
4. The method according to claim 1, wherein The determination of whether the preset response condition is currently met includes: Record multiple round-trip delays of the current transmission link and calculate the average and variance of the multiple round-trip delays; Predicting a reception time range of a data packet corresponding to a next sequence number based on an average value and a variance of the multiple round-trip delays; Determine whether the data packet corresponding to the next sequence number is received within the receiving time range; If the data packet corresponding to the next sequence number is not received within the receiving time range, it is determined that the preset response condition is currently met.
5. The method according to claim 1, wherein The detecting whether a data packet loss currently occurs includes: Parse the received data packet to obtain the sequence number information of the received data packet; Performing statistics based on the sequence number information of the received data packets to determine whether the sequence numbers of the received data packets are continuous; If the sequence numbers of the received data packets are not continuous, it is determined that data packet loss is currently occurring; If the sequence numbers of the received data packets are continuous, it is determined that no data packet loss has occurred.
6. A data packet transmission device, characterized in that: The device comprises: A receiving module is used to receive a data packet sent by a client, wherein the data packet includes a starting sequence number and a data length; A judgment module is used to judge whether the preset response conditions are currently met; a sending module, configured to send an ACK confirmation message to the client if the preset response condition is currently met, so that the client obtains the sequence number information of the lost data packet based on the ACK confirmation message and retransmits the lost data packet; When the judgment module judges whether the preset response condition is currently met, it is specifically used to: Calculating an out-of-sequence value of the data packet based on a starting sequence number of the data packet; Determining whether the out-of-order value reaches a preset out-of-order value threshold; If the disorder value reaches a preset disorder value threshold, it is determined that the preset response condition is currently met; When the sending module sends an ACK confirmation message to the client, it is specifically used to: Detect whether there is data packet loss; If no data packet loss occurs, an ACK message is sent to the client, where the ACK message includes the received end sequence number information; If data packet loss occurs, the sequence number information of the lost data packet is determined, and an ACK confirmation message is sent to the client. The ACK confirmation message includes the received cutoff sequence number information and the sequence number information of the lost data packet, so that the client retransmits the lost data packet based on the sequence number information of the lost data packet.
7. An electronic device, characterized in that: include: Memory; processor; as well as computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Data transmission method and system and storage medium
CN114302451A