Data message transmission method and device, electronic equipment and computer storage medium
By introducing new message formats and control messages into the VXLAN overlay network, the numbering and confirmation of data messages is achieved, and the problem of packet loss or out of order in the VXLAN tunnel is solved, which improves the reliability of transmission.
Patent Information
- Application Number
- CN202411773108.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-11
AI Technical Summary
In VXLAN overlay network, packet loss or out of order may occur during the forwarding of VXLAN Tunnel, resulting in poor transmission reliability and may cause business problems.
A data message transmission method is proposed, which realizes the number and confirmation of each data message by sending request messages, reply messages, confirmation request messages and confirmation replies to the receiving end. If a loss occurs, the lost data message will be resent.
Through the new message format and control message, each data message is numbered and confirmed, which improves the reliability of VTEP transmitting data messages in VXLAN Tunnel, and avoids business problems caused by data loss.
Smart Images

Figure CN119814672A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a data message transmission method, a data message transmission device, an electronic device and a computer-readable storage medium. Background Art
[0002] In the VXLAN (Virtual eXtensible Local Area Network) overlay network, VTEP (VXLAN Tunnel Endpoints) acts as an overlay edge device. When forwarding data packets, it will first encapsulate the VXLAN header / IP (Internet Protocol) header / MAC (Media Access Control Address) header / UDP (User Datagram Protocol) header, and then send it to the VXLAN Tunnel for transmission. After receiving the data packet, it will also strip off the outer encapsulation header, restore the original data packet, and then forward it to the destination virtual machine.
[0003] Due to the complexity of the underlay network, packet loss or disorder may occur at any time when data packets are forwarded in the VXLAN Tunnel. If the upper layer protocol does not perform error checking and does not use a reliable transport layer protocol such as TCP (Transmission Control Protocol), the reliability of the transmitted data packets is poor, which may cause business problems. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method for transmitting a data message, a device for transmitting a data message, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a method for transmitting a data message, the method comprising:
[0006] When a data message to be sent is obtained, a request message is sent to a receiving end, so that the receiving end generates a reply message in response to the request message and returns the reply message;
[0007] When the reply message is obtained, sending the to-be-sent data message to the receiving end;
[0008] When a preset condition is met, sending a confirmation request message to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message;
[0009] When the confirmation reply message is obtained, detecting whether there is a target data message that needs to be resent based on the confirmation reply message;
[0010] If so, the target data message is sent to the receiving end.
[0011] In one or more embodiments, sending the to-be-sent data message to the receiving end includes:
[0012] The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
[0013] In one or more embodiments, further comprising:
[0014] When the reply message is not obtained within the preset time period, the to-be-sent data message is sent to the receiving end using a preset second message format; the second message format does not include a sequence number identifier of the sent data message.
[0015] In one or more embodiments, when a preset condition is met, sending a confirmation request message to the receiving end includes:
[0016] When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
[0017] In one or more embodiments, the detecting whether there is a target data message that needs to be resent based on the confirmation reply message includes:
[0018] Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap;
[0019] Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap;
[0020] If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
[0021] In one or more embodiments, before obtaining the confirmation reply message, the method further includes:
[0022] The sent data packets are stored in a preset cache queue.
[0023] In one or more embodiments, sending the target data message to the receiving end includes:
[0024] Obtaining the target data message from a preset cache queue;
[0025] The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
[0026] In one or more embodiments, further comprising:
[0027] If the number of times the target data message is resent reaches a number threshold, the target data message is stopped from being sent to the receiving end.
[0028] Accordingly, an embodiment of the present invention discloses a data message transmission device, the device comprising:
[0029] An acquisition module, used for acquiring data messages to be sent;
[0030] A sending module, used to send a request message to a receiving end, so that the receiving end generates a reply message in response to the request message, and returns the reply message;
[0031] The acquisition module is further used to acquire the reply message;
[0032] The sending module is further used to send the data message to be sent to the receiving end;
[0033] The sending module is further configured to send a confirmation request message to the receiving end when a preset condition is met, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message;
[0034] The acquisition module is further used to acquire the confirmation reply message;
[0035] A detection module, detecting whether there is a target data message that needs to be resent based on the confirmation reply message;
[0036] The sending module is further configured to send the target data message to the receiving end if the target data message exists.
[0037] In one or more embodiments, the sending module is specifically used to:
[0038] The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
[0039] In one or more embodiments, the sending module is further configured to:
[0040] When the reply message is not obtained within the preset time period, the to-be-sent data message is sent to the receiving end using a preset second message format; the second message format does not include a sequence number identifier of the sent data message.
[0041] In one or more embodiments, the sending module is further configured to:
[0042] When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
[0043] In one or more embodiments, the detection module is specifically used to:
[0044] Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap;
[0045] Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap;
[0046] If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
[0047] In one or more embodiments, further comprising:
[0048] The storage module is used to store the sent data message in a preset cache queue before obtaining the confirmation reply message.
[0049] In one or more embodiments, the sending module is further configured to:
[0050] Obtaining the target data message from a preset cache queue;
[0051] The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
[0052] In one or more embodiments, further comprising:
[0053] The termination module is used to stop sending the target data message to the receiving end if the number of times the target data message is resent reaches a number threshold.
[0054] Correspondingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the various steps of the above-mentioned data message transmission method embodiment when executed by the processor.
[0055] Accordingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various steps of the above-mentioned data message transmission method embodiment are implemented.
[0056] The embodiments of the present invention include the following advantages:
[0057] In addition to changes to the message format of the standard data message of VXLAN, four new control messages are also defined. When a data message to be sent is obtained, a request message is sent to the receiving end, so that the receiving end generates a reply message in response to the request message, and returns the reply message; when the reply message is obtained, the data message to be sent is sent to the receiving end; when a preset condition is met, a confirmation request message is sent to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message; when the confirmation reply message is obtained, it is detected based on the confirmation reply message whether there is a target data message that needs to be resent; if so, the target data message is sent to the receiving end. In this way, during the transmission of data packets, each data packet can be numbered through the new packet format and control message. If data packets are lost during the transmission process, the receiving end can generate a confirmation reply message based on the number of the received data packet and send it to the sending end. The sending end can determine the number of the lost data packet based on the confirmation reply message, and then resend the lost data packet, which greatly improves the reliability of VTEP in transmitting data packets in the VXLAN Tunnel. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a flow chart of the steps of a first embodiment of a method for transmitting a data message of the present invention;
[0059] Figure 2 It is a schematic diagram of the framework of the VXLAN of the present invention;
[0060] Figure 3 It is a schematic diagram of the message format of the modified data message of the present invention;
[0061] Figure 4 It is a schematic diagram of the message format of the control message "request message" of the present invention;
[0062] Figure 5 It is a schematic diagram of the message format of the control message "reply message" of the present invention;
[0063] Figure 6 It is a schematic diagram of the message format of the control message "confirmation request message" of the present invention;
[0064] Figure 7 It is a schematic diagram of the message format of the control message "confirmation reply message" of the present invention;
[0065] Figure 8 It is a flow chart of the steps of Embodiment 2 of a method for transmitting a data message of the present invention;
[0066] Fig. 9 It is a structural block diagram of an embodiment of a data message transmission device of the present invention. DETAILED DESCRIPTION
[0067] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0068] One of the core concepts of the embodiment of the present invention is that, in addition to changing the message format of the standard data message of VXLAN, four new control messages are also defined. In this way, in the process of transmitting data messages, each data message can be numbered through the new message format and control message. If data message loss occurs during the transmission process, the receiving end can generate a confirmation reply message according to the number of the received data message and send it to the sending end. The sending end can determine the number of the lost data message according to the confirmation reply message, so as to resend the lost data message, which greatly improves the reliability of VTEP in transmitting data messages in the VXLAN Tunnel.
[0069] Reference Figure 1 , shows a flow chart of the steps of a data packet transmission method embodiment 1 of the present invention, which can be applied to VTEP in VXLAN, referring to Figure 2 , showing a schematic diagram of the VXLAN framework of the present invention, wherein any VTEP can be the sender of a data message, and the VTEP that receives the data message is the receiver, and any two VTEPs can be connected via a VXLAN Tunnel.
[0070] In the embodiment of the present invention, in addition to changing the message format of the standard data message of VXLAN, four new control messages are defined, as follows:
[0071] The message format of the changed data message is as follows: Figure 3As shown in the figure, it includes MAC header, IP header, UDP header, VXLAN header, identification header and data part. The UDP destination port number remains 4789, that is, compared with the standard data message format, a 4-byte identification header is added. The functions of the identification header are as follows, which will be described in detail later:
[0072] 1) It is mainly used to number each data message, so as to determine which data messages with identification headers are discarded in the subsequent confirmation process, and then the sender initiates retransmission; for example, the sender sends 8 messages, numbered 0 to 7. The receiver only receives the first 6 0 to 5, then the value of the identification header in the confirmation reply message is 5, and the sender expects 7. At this time, it can be determined that the data messages numbered 6 and 7 are lost;
[0073] 2) In each round of request / reply / send datagram / confirm request / confirm reply, the value of the identification header of the sent datagram should start from 0. Only when retransmitting, the value of the identification header in the datagram remains the same as before, and does not necessarily start from 0;
[0074] 3) The bitmap in the confirmation reply message sent by the receiving end is also generated based on the identification header of each message.
[0075] When both the sending end and the receiving end support the new message format, the sending end can use the changed message format to send data messages.
[0076] Control message "Request message", the message format is as follows Figure 4 As shown in the figure, it includes MAC header, IP header, UDP header, control bit and reserved bit. The UDP destination port number should be distinguished from the port number used to send data packets. The control bit can be 2Bytes, with a value of 0xFF01, and the control bit is used to identify the control message. The reserved bit can also be 2Bytes, with a value of 0, which means it is not used yet and is reserved for later use. When the sender has a data message to send, it will first initiate a request message.
[0077] Control message "Reply message", the message format is as follows Figure 5 As shown in the figure, it includes MAC header, IP header, UDP header, control bit and reserved bit. The UDP destination port number should be distinguished from the port number used to send data packets. The control bit can be 2Bytes, with a value of 0xFF02, and the control bit is used to identify the control message. The reserved bit can also be 2Bytes, with a value of 0, which means it is not used yet and is reserved for subsequent use. When the receiving end obtains the request message, it will feedback the reply message and prepare to receive the data message sent by the sending end.
[0078] Control message "Confirmation Request Message", the message format is as follows Figure 6As shown in the figure, it includes a MAC header, an IP header, a UDP header, a control bit, and a reserved bit. The UDP destination port number should be distinguished from the port number used to send the data message. The control bit can be 2 bytes, with a value of 0xFF03, and the control bit is used to identify the control message. The reserved bit can also be 2 bytes, with a value of 0, which means that it is not used yet and is reserved for subsequent use. If there is no data message to be sent, or the number of sent data messages reaches the quantity threshold, the sender can initiate a confirmation request message to the receiver, requesting the receiver to reply with a "confirmation reply message".
[0079] Control message "confirmation reply message", the message format is as follows Figure 7 As shown in the figure, it includes MAC header, IP header, UDP header, control bit, identification header and bitmap. The UDP destination port number should be distinguished from the port number used to send the data message. The control bit can be 2Bytes, with a value of 0xFF04. The control bit is used to identify the control message. The bitmap is at least 4Bytes. Each bit represents the reception status of a data message. 1 means that the data message has been received, and 0 means that the data message has not been received. If the number of data messages received by the receiving end is less than 32, the insufficient positions are filled with 1 to make up 32 bits. For example, the sending end sent a total of 24 data messages, and the receiving end received a total of 23 data messages. The last message was not received. Then the value of the bitmap is 1111111111111111111111110. Since it is less than 32 bits, the remaining 8 bits are filled with 1 to make up. The final value of the bitmap is 111111111111111111111111011111111111.
[0080] It should be noted that, in practical applications, the specific value of the control bit, the size of the control bit, the size of the reserved bit, and the size of the bitmap can all be set according to actual needs, and the embodiments of the present invention do not limit this.
[0081] Furthermore, the MAC header, IP header, UDP header and VXLAN header may all adopt the OSI (Open System Interconnect) standard, which will not be described here to avoid repetition.
[0082] The method may specifically include the following steps:
[0083] Step 101, when a data message to be sent is obtained, a request message is sent to a receiving end, so that the receiving end responds to the request message, generates a reply message, and returns the reply message.
[0084] When the sender obtains the data message to be sent (for easy distinction, it is recorded as "data message to be sent"), it can generate a request message and send the request message to the receiver. After the receiver obtains the request message, it can determine that the message is a "request message" through the value of the control bit "0xFF01", so it can generate a reply message and send the reply message to the sender.
[0085] Step 102: When the reply message is obtained, the to-be-sent data message is sent to the receiving end.
[0086] After the sender obtains the reply message sent by the receiver, it can confirm that the message is a "reply message" through the value of the control bit "0xFF02", indicating that the receiver can recognize the control message, so it can send the data message to be sent to the receiver.
[0087] After receiving the data message, the receiving end can process the data message. For example, the receiving end can forward the data message immediately, which can improve the processing efficiency of the data message; or the data message can be stored in a cache queue first, and then forwarded according to the sequence number, which can achieve sequence-preserving forwarding of the data message.
[0088] It should be noted that after the receiving end obtains the data message, the specific processing method performed on the data message can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0089] In the embodiment of the present invention, the sending of the to-be-sent data message to the receiving end includes:
[0090] The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
[0091] Specifically, since the receiving end can identify the control message, the sending end can use a preset message format (referred to as the "first message format") when sending the data message to be sent, that is, Figure 2 Since the first message format includes an identification header, that is, includes the sequence number identification of the last data message sent, after each data message is sent, the sequence number identification in the identification header can be increased by 1 until the quantity threshold is reached.
[0092] Step 103: When a preset condition is met, a confirmation request message is sent to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message and returns the confirmation reply message.
[0093] When the sender is sending a data message, if the preset conditions are met, it can stop sending the data message, generate a confirmation request message, and send the confirmation request message to the receiver. After receiving the confirmation request message, the receiver can confirm that the message is a "confirmation request message" through the value of the control bit "0xFF03", and can generate a confirmation reply message and send the confirmation reply message to the sender.
[0094] In the embodiment of the present invention, when the preset condition is met, sending a confirmation request message to the receiving end includes:
[0095] When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
[0096] Specifically, when the number of data packets sent by the sending end reaches the number threshold, the sending of data packets can be stopped, and then a confirmation request packet is generated and sent to the receiving end.
[0097] Alternatively, when the sending end has no data message to be sent, a confirmation request message may be generated and sent to the receiving end.
[0098] It should be noted that the quantity threshold of the sent data packets can be set before sending the data packets, that is, the quantity threshold can be adjusted according to actual needs, and the embodiment of the present invention does not limit the specific value of the quantity threshold.
[0099] Step 104: When the confirmation reply message is obtained, it is detected based on the confirmation reply message whether there is a target data message that needs to be resent.
[0100] When the sender obtains the confirmation reply message, it can confirm that the message is a "confirmation reply message" through the control bit value "0xFF04". Since the confirmation reply message contains an identification header and a bitmap, and the identification header and the bitmap are generated according to the situation of the receiving end receiving the data message, the sender can confirm whether there is an unreceived data message (recorded as a "target data message") at the receiving end based on the identification header and bitmap in the confirmation reply message. If so, the target data message needs to be resent.
[0101] In the embodiment of the present invention, the detecting whether there is a target data message that needs to be resent based on the confirmation reply message includes:
[0102] Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap;
[0103] Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap;
[0104] If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
[0105] Specifically, after obtaining the confirmation reply message, the sender can parse the confirmation reply message and extract the sequence number identifier (recorded as "target sequence number identifier") and the bitmap in the identification header. Since the identification header can indicate the sequence number of the last data message, it can be determined whether the last data message in the sent data message is successfully received by the receiving end according to the target sequence number identifier. If it is successfully received by the receiving end, it means that the last data message does not need to be resent, otherwise, it means that the last data message needs to be resent.
[0106] At the same time, since the padded value in the bitmap is the same as the value indicating that the data message has been received, it is necessary to distinguish the two. Since the target sequence number identifier can also indicate the total number of received data messages, the valid bits in the bitmap can be further determined based on the total number, thereby determining whether the first data message to the second to last data message in the sent data message are successfully received by the receiving end. If the first data message to the second to last data message are all successfully received by the receiving end, then it means that the first data message to the second to last data message do not need to be resent, otherwise, any data message that is not successfully received by the receiving end needs to be resent.
[0107] Therefore, if all data messages are successfully received by the receiving end, it means that no data message needs to be resent, and if at least one target data message among all data messages is not successfully received by the receiving end, it means that the target data message needs to be resent.
[0108] For example, the sender sends a total of 24 data messages, and the receiver receives only 22 data messages, among which the data messages with sequence numbers 2 and 24 are not received. Then, the sequence number of the last data message received by the receiver is "23", that is, the value in the identifier header is "23", so the generated bitmap is "1011111111111111111111111", a total of 23 bits. Since it is less than 32 bits, the remaining positions are filled with 1, and the final bitmap is "1011111111111111111111111111111111". The receiver uses the sequence number identifier and bitmap to generate a confirmation reply message.
[0109] After receiving the confirmation reply message, the sender extracts the control bit "0xFF04" and confirms it as a "confirmation reply message". Then it extracts the target sequence number identifier and bitmap. The target sequence number identifier is "23" instead of "24", which means that the last data message was not successfully received by the receiver.
[0110] Further, according to the target sequence number identifier, it can be determined that the valid bits in the bitmap are 23 bits, and bits 24 to 32 are padding bits. According to the "0" in bits 1 to 23, it can be determined that the second data message is not successfully received by the receiving end.
[0111] Therefore, it can be determined that the 2nd data message and the 24th data message need to be resent.
[0112] Step 105: If it exists, send the target data message to the receiving end.
[0113] If the target data message exists, the sender can obtain the target data message and resend it to the receiver.
[0114] In the embodiment of the present invention, the sending of the target data message to the receiving end includes:
[0115] Obtaining the target data message from a preset cache queue;
[0116] The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
[0117] Specifically, when the sending end determines that the target data message exists, the target data message can be obtained from the preset buffer queue and sent to the receiving end. At the same time, since other data messages have been successfully received by the receiving end, the other data messages can be released from the buffer queue.
[0118] Furthermore, after the target data message is resent, since it is a new sending cycle, the identification header in the target data message can be renumbered. For example, continuing with the previous example, when it is determined that the second data message and the 24th data message need to be resent, the second data message can be renumbered as "1" and the 24th data message can be renumbered as "2". Of course, it is also possible to directly resend using the original number without renumbering. In actual applications, whether renumbering is required can be set according to actual needs, and the embodiment of the present invention does not limit this. Moreover, when resending, steps 101 to 105 also need to be executed. In order to avoid repetition, they will not be repeated here.
[0119] In an embodiment of the present invention, in addition to changing the message format of the standard data message of VXLAN, four new control messages are also defined. When a data message to be sent is obtained, a request message is sent to a receiving end, so that the receiving end generates a reply message in response to the request message, and returns the reply message; when the reply message is obtained, the data message to be sent is sent to the receiving end; when a preset condition is met, a confirmation request message is sent to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message; when the confirmation reply message is obtained, it is detected based on the confirmation reply message whether there is a target data message that needs to be resent; if so, the target data message is sent to the receiving end. In this way, during the transmission of data packets, each data packet can be numbered through the new packet format and control message. If data packets are lost during the transmission process, the receiving end can generate a confirmation reply message based on the number of the received data packet and send it to the sending end. The sending end can determine the number of the lost data packet based on the confirmation reply message, and then resend the lost data packet, which greatly improves the reliability of VTEP in transmitting data packets in the VXLAN Tunnel.
[0120] Reference Figure 8 , shows a flow chart of the steps of Embodiment 2 of a data message transmission method of the present invention, which may specifically include the following steps:
[0121] Step 801, when a data message to be sent is obtained, a request message is sent to a receiving end, so that the receiving end generates a reply message in response to the request message and returns the reply message.
[0122] When the sender obtains the data message to be sent, it can generate a request message and send it to the receiver. After the receiver obtains the request message, it can determine that the message is a "request message" through the value of the control bit "0xFF01", so it can generate a reply message and send it to the sender.
[0123] Step 802: When the reply message is obtained, the to-be-sent data message is sent to the receiving end.
[0124] After the sender obtains the reply message sent by the receiver, it can confirm that the message is a "reply message" through the value of the control bit "0xFF02", indicating that the receiver can recognize the control message, so it can send the data message to be sent to the receiver.
[0125] After receiving the data message, the receiving end can process the data message. For example, the receiving end can forward the data message immediately, which can improve the processing efficiency of the data message; or the data message can be stored in a cache queue first, and then forwarded according to the sequence number, which can achieve sequence-preserving forwarding of the data message.
[0126] It should be noted that after the receiving end obtains the data message, the specific processing method performed on the data message can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0127] In the embodiment of the present invention, the sending of the to-be-sent data message to the receiving end includes:
[0128] The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
[0129] Specifically, since the receiving end can identify the control message, the sending end can use the preset first message format when sending the data message to be sent, that is, Figure 2 Since the first message format includes an identification header, that is, includes the sequence number identification of the last data message sent, after each data message is sent, the sequence number identification in the identification header can be increased by 1 until the quantity threshold is reached.
[0130] Step 803, when the reply message is not obtained within the preset time period, the to-be-sent data message is sent to the receiving end using a preset second message format; the second message format does not include a sequence number identifier of the sent data message.
[0131] Specifically, after sending the request message, the sender can start a timer, and the timer can be set to a preset time period. When the timer ends, if the sender has not received a reply message returned by the receiver, it means that the receiver cannot recognize the control message, so the preset second message format, that is, the message format of the standard data message ( Figure 2 The data message to be sent is sent to the receiving end by removing the identification header from the message format shown in the figure.
[0132] Step 804: When a preset condition is met, a confirmation request message is sent to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message and returns the confirmation reply message.
[0133] When the sender is sending a data message, if the preset conditions are met, it can stop sending the data message, generate a confirmation request message, and send the confirmation request message to the receiver. After receiving the confirmation request message, the receiver can confirm that the message is a "confirmation request message" through the value of the control bit "0xFF03", and can generate a confirmation reply message and send the confirmation reply message to the sender.
[0134] In the embodiment of the present invention, when the preset condition is met, sending a confirmation request message to the receiving end includes:
[0135] When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
[0136] Specifically, when the number of data packets sent by the sending end reaches the number threshold, the sending of data packets may be stopped, and then a confirmation request packet is generated and sent to the receiving end.
[0137] Alternatively, when the sending end has no data message to be sent, a confirmation request message may be generated and sent to the receiving end.
[0138] It should be noted that the quantity threshold of the sent data packets can be set before sending the data packets, that is, the quantity threshold can be adjusted according to actual needs, and the embodiment of the present invention does not limit the specific value of the quantity threshold.
[0139] Step 805: Store the sent data message into a preset cache queue.
[0140] Specifically, when the sender sends a data message, each sent data message can be stored in a preset cache queue in the order of sending, so that if a lost target data message is detected later, the target data message can be obtained from the cache queue.
[0141] If it is subsequently detected that the target data message does not exist, all the data messages in the cache queue can be directly released.
[0142] Step 806: When the confirmation reply message is obtained, it is detected based on the confirmation reply message whether there is a target data message that needs to be resent.
[0143] When the sender obtains the confirmation reply message, it can confirm that the message is a "confirmation reply message" through the control bit value "0xFF04". Since the confirmation reply message contains an identification header and a bitmap, and the identification header and the bitmap are generated according to the situation of the receiving end receiving the data message, the sender can confirm whether the receiving end has not received the target data message based on the identification header and bitmap in the confirmation reply message. If so, the target data message needs to be resent.
[0144] In the embodiment of the present invention, the detecting whether there is a target data message that needs to be resent based on the confirmation reply message includes:
[0145] Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap;
[0146] Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap;
[0147] If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
[0148] Specifically, after obtaining the confirmation reply message, the sender can parse the confirmation reply message and extract the target sequence number identifier and bitmap in the identification header. Since the identification header can indicate the sequence number of the last data message, it can be determined whether the last data message in the sent data message is successfully received by the receiving end according to the target sequence number identifier. If it is successfully received by the receiving end, it means that the last data message does not need to be resent, otherwise, it means that the last data message needs to be resent.
[0149] At the same time, since the padded value in the bitmap is the same as the value indicating that the data message has been received, it is necessary to distinguish the two. Since the target sequence number identifier can also indicate the total number of received data messages, the valid bits in the bitmap can be further determined based on the total number, thereby determining whether the first data message to the second to last data message in the sent data message are successfully received by the receiving end. If the first data message to the second to last data message are all successfully received by the receiving end, then it means that the first data message to the second to last data message do not need to be resent, otherwise, any data message that is not successfully received by the receiving end needs to be resent.
[0150] Therefore, if all data messages are successfully received by the receiving end, it means that no data message needs to be resent, and if at least one target data message among all data messages is not successfully received by the receiving end, it means that the target data message needs to be resent.
[0151] Step 807: If it exists, send the target data message to the receiving end.
[0152] If the target data message exists, the sender can obtain the target data message and resend it to the receiver. If the target data message does not exist, the process can be ended.
[0153] In the embodiment of the present invention, the sending of the target data message to the receiving end includes:
[0154] Obtaining the target data message from a preset cache queue;
[0155] The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
[0156] Specifically, when the sending end determines that the target data message exists, the target data message can be obtained from the preset buffer queue and sent to the receiving end. At the same time, since other data messages have been successfully received by the receiving end, the other data messages can be released from the buffer queue.
[0157] Step 808: If the number of times the target data message is resent reaches a threshold number, stop sending the target data message to the receiving end.
[0158] Specifically, before transmitting a data message, the sender can set a threshold of the number of retransmissions. When the sender retransmits the target data message, it can count the number of retransmissions of the target data message. When the number of retransmissions reaches the threshold, it can stop retransmitting the target data message to the receiver. In this way, it can be avoided that the sender retransmits the target data message indefinitely.
[0159] In an embodiment of the present invention, during the process of transmitting data packets, each data packet can be numbered through a new message format and a control message. If data packets are lost during the transmission process, the receiving end can generate a confirmation reply message according to the number of the received data packet and send it to the sending end. The sending end can determine the number of the lost data packet according to the confirmation reply message, thereby resending the lost data packet, thereby greatly improving the reliability of VTEP in transmitting data packets in the VXLAN Tunnel.
[0160] Furthermore, by setting up a cache queue, when sending data packets, the sent data packets are stored in the cache queue. When it is detected that the receiving end has not received the target data packet, the target data packet can be obtained from the cache queue and resent, thereby further improving the reliability of VTEP in transmitting data packets in the VXLAN Tunnel.
[0161] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0162] Reference Fig. 9 , shows a structural block diagram of an embodiment of a data message transmission device of the present invention, which may specifically include the following modules:
[0163] The acquisition module 901 is used to acquire the data message to be sent;
[0164] The sending module 902 is used to send a request message to the receiving end, so that the receiving end responds to the request message, generates a reply message, and returns the reply message;
[0165] The acquisition module 901 is further used to acquire the reply message;
[0166] The sending module 902 is further configured to send the data message to be sent to the receiving end;
[0167] The sending module 902 is further configured to send a confirmation request message to the receiving end when a preset condition is met, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message;
[0168] The acquisition module 901 is further used to acquire the confirmation reply message;
[0169] A detection module 903 detects whether there is a target data message that needs to be resent based on the confirmation reply message;
[0170] The sending module 902 is further configured to send the target data message to the receiving end if the target data message exists.
[0171] In the embodiment of the present invention, the sending module is specifically used for:
[0172] The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
[0173] In the embodiment of the present invention, the sending module is further used for:
[0174] When the reply message is not obtained within the preset time period, the to-be-sent data message is sent to the receiving end using a preset second message format; the second message format does not include a sequence number identifier of the sent data message.
[0175] In the embodiment of the present invention, the sending module is further used for:
[0176] When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
[0177] In the embodiment of the present invention, the detection module is specifically used to:
[0178] Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap;
[0179] Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap;
[0180] If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
[0181] In an embodiment of the present invention, it also includes:
[0182] The storage module is used to store the sent data message in a preset cache queue before obtaining the confirmation reply message.
[0183] In the embodiment of the present invention, the sending module is further used for:
[0184] Obtaining the target data message from a preset cache queue;
[0185] The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
[0186] In an embodiment of the present invention, it also includes:
[0187] The termination module is used to stop sending the target data message to the receiving end if the number of times the target data message is resent reaches a number threshold.
[0188] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0189] An embodiment of the present invention further provides an electronic device, including:
[0190] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data message transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0191] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned data message transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0192] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0193] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0194] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0195] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0196] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0197] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0198] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0199] The above is a detailed introduction to a data message transmission method and a data message transmission device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a general technician in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for transmitting a data message, characterized in that: The method comprises: When a data message to be sent is obtained, a request message is sent to a receiving end, so that the receiving end generates a reply message in response to the request message and returns the reply message; When the reply message is obtained, sending the to-be-sent data message to the receiving end; When a preset condition is met, sending a confirmation request message to the receiving end, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message; When the confirmation reply message is obtained, detecting whether there is a target data message that needs to be resent based on the confirmation reply message; If so, the target data message is sent to the receiving end.
2. The data message transmission method according to claim 1, characterized in that: The sending the to-be-sent data message to the receiving end includes: The data message to be sent is sent to the receiving end using a preset first message format; the first message format includes a sequence number identifier of the sent data message.
3. The method for transmitting data messages according to claim 1, characterized in that: Also includes: When the reply message is not obtained within the preset time period, sending the to-be-sent data message to the receiving end in a preset second message format; The second message format does not include a sequence number identifier of the sent data message.
4. The method for transmitting data messages according to claim 1, characterized in that: When the preset condition is met, sending a confirmation request message to the receiving end includes: When the number of sent data packets reaches a number threshold, or when no data packets to be sent are obtained, a confirmation request message is sent to the receiving end.
5. The method for transmitting data messages according to claim 1, characterized in that: The detecting whether there is a target data message that needs to be resent based on the confirmation reply message includes: Parsing the confirmation reply message to obtain a target sequence number identifier and a bitmap; Determine whether the last data message needs to be resent based on the target sequence number identifier, and determine whether there is a data message that needs to be resent from the first to the second to last data message based on the bitmap; If the last data message needs to be resent, and / or there is a data message that needs to be resent from the first to the second to last data messages, the data message that needs to be resent is used as the target data message.
6. The method for transmitting data messages according to claim 1, characterized in that: Before obtaining the confirmation reply message, the method further includes: The sent data packets are stored in a preset cache queue.
7. The method for transmitting data messages according to claim 1, characterized in that: The sending the target data message to the receiving end includes: Obtaining the target data message from a preset cache queue; The target data message is sent to the receiving end, and other data messages are released from the buffer queue.
8. A data message transmission device, characterized in that: The device comprises: An acquisition module, used for acquiring data messages to be sent; A sending module, used to send a request message to a receiving end, so that the receiving end generates a reply message in response to the request message, and returns the reply message; The acquisition module is further used to acquire the reply message; The sending module is further used to send the data message to be sent to the receiving end; The sending module is further configured to send a confirmation request message to the receiving end when a preset condition is met, so that the receiving end generates a confirmation reply message in response to the confirmation request message, and returns the confirmation reply message; The acquisition module is further used to acquire the confirmation reply message; A detection module, detecting whether there is a target data message that needs to be resent based on the confirmation reply message; The sending module is further configured to send the target data message to the receiving end if the target data message exists.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the data message transmission method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data message transmission method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Message sending method and device, equipment, medium and vehicle
CN120582757A