Message transmission method, electronic equipment and readable storage medium
By using application messages carrying sequence numbers and order-preserving request/response messages in message transmission, the problems of cumbersome TCP protocol transmission and poor versatility are solved, and simplified and complete message transmission is achieved.
Patent Information
- Application Number
- CN202510567243.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-09-26
AI Technical Summary
In existing networking scenarios, the message transmission process based on the TCP protocol is cumbersome and has poor versatility, and cannot take into account both the simplification and integrity of the message transmission process.
By sending application messages carrying message sequence numbers during transmission and using sequence-preserving request and response messages to ensure transmission integrity, including carrying first and second identifiers to indicate the sequence numbers of sent messages, the complete transmission of messages is ensured.
It simplifies the message transmission process without relying on the TCP protocol, while ensuring the integrity of the transmission. It is suitable for various terminal devices and servers.
Smart Images

Figure CN120711097A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communications, and specifically relates to a message transmission method, an electronic device, and a readable storage medium. Background Art
[0002] Currently, in networking scenarios, clients often send application messages, such as log messages, to servers.
[0003] To ensure reliable transmission of application messages, related technologies often use the Transmission Control Protocol (TCP) for message transmission. However, TCP-based message transmission requires additional signaling interactions such as handshakes and handshakes, making message transmission more cumbersome. Summary of the Invention
[0004] The embodiments of the present application provide a message transmission method, an electronic device, and a readable storage medium, which can solve the problem that related technologies cannot take into account both the simplification of the message transmission process and the integrity of the message transmission.
[0005] In a first aspect, an embodiment of the present application provides a message transmission method, including: The first transmission direction sends at least one application message to the second transmission direction, each of the application messages carrying a message sequence number; The first transmission direction sends an order preservation request message to the second transmission direction, the order preservation request message carrying a first identifier and a second identifier, the first identifier indicating a message sequence number of a first sent application message in the at least one application message, and the second identifier indicating a message sequence number of a last sent application message in the at least one application message; The first transmission party receives the sequence preservation response message transmitted by the second transmission party; The order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message.
[0006] In a second aspect, an embodiment of the present application provides a message transmission method, including: The second transmission party receives at least one target application message, where the at least one target application message is at least a portion of the at least one application message sent by the first transmission party to the second transmission party, and each of the target application messages carries a message sequence number; The second transmission party records a message sequence number carried by each of the at least one target application message; The second transmission party receives the order preservation request message sent by the first transmission party, where the order preservation request message carries a first identifier and a second identifier, where the first identifier indicates a message sequence number of a first sent application message in the at least one application message, and the second identifier indicates a message sequence number of a last sent application message in the at least one application message; The second transmission party transmits an order-preserving response message to the first transmission party based on the recorded target message sequence number; The order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a program or instruction, and when the program or instruction is executed by the processor, the method described in the first aspect or the second aspect is implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the method described in the first aspect or the second aspect is implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in the first aspect or the second aspect when executed by a processor.
[0010] In an embodiment of the present application, the first transmission direction sends at least one application message to the second transmission direction, and each of the application messages carries a message sequence number; the first transmission direction sends an order-preserving request message to the second transmission direction, and the order-preserving request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message; the first transmission direction receives the order-preserving response message transmitted by the second transmission direction; wherein the order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message. In this way, there is no need to rely on the TCP protocol for message transmission. On the basis of solving the cumbersome problems brought by the TCP protocol for message transmission, the transmission integrity of the at least one application message can be ensured through the first identifier and the second identifier in the order-preserving request message and the order-preserving response message, which can solve the problem that the related technology cannot take into account both the simplification of the message transmission process and the integrity of the message transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 This is a flow chart of a message transmission method provided by an embodiment of the present application; Figure 2This is a schematic diagram of a message header structure of an IPv4-compliant message provided in an embodiment of the present application; Figure 3 This is a schematic diagram of a message header structure of an IPv6-compliant message provided in an embodiment of the present application; Figure 4 This is a schematic diagram of an implementation environment of a message transmission method provided in an embodiment of the present application; Figure 5 This is a schematic diagram of the data structure of the payload portion of an order preservation request message provided in an embodiment of the present application; Figure 6 This is a schematic diagram of an example of the payload portion of an order preservation request message provided in an embodiment of the present application; Figure 7 This is a flowchart of another message transmission method provided by an embodiment of the present application; Figure 8 This is a schematic diagram of an example of the payload portion of a secondary sequence preservation request message provided in an embodiment of the present application; Figure 9 This is a flowchart of another message transmission method provided by an embodiment of the present application; Figure 10 This is a communication interaction diagram of a message transmission process provided by an embodiment of the present application; Figure 11 This is a communication interaction diagram of another message transmission process provided by an embodiment of the present application; Figure 12 This is a schematic diagram of a TCP-based message transmission process in the related art; Figure 13 This is a structural block diagram of a message transmission system provided by an embodiment of the present application; Figure 14 This is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0013] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0014] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort shall fall within the scope of protection of the present invention.
[0015] Currently, message transmission is typically implemented using either the User Datagram Protocol (UDP) or TCP. UDP-based message transmission is unreliable, while TCP-based message transmission is reliable. Therefore, to achieve reliable message transmission, TCP-based message transmission is often used. However, TCP-based message transmission is cumbersome, and many message receiving devices do not support TCP, making it less versatile.
[0016] The message transmission method provided in the embodiment of the present application does not require the use of the TCP protocol for message transmission, can take into account both the simplification of the message transmission process and the integrity of the message transmission, and can solve the problems of the above-mentioned TCP-based message transmission method being relatively cumbersome and having poor versatility.
[0017] The message transmission method provided in the embodiment of the present application is applied to the message reliability transmission technology. The integrity of the message transmission between the first transmission party and the second transmission party can be ensured by sending an order-preserving request message from the first transmission direction to the second transmission party and transmitting an order-preserving response message from the second transmission direction to the first transmission party.
[0018] The message transmission method provided in the embodiments of the present application can be executed by a target device, wherein the target device can be a terminal device such as a desktop computer, a laptop computer, a mobile phone, a tablet computer, or a server, such as an independent physical server, a server cluster composed of multiple servers, and a cloud server capable of cloud computing. For example, the first transmission party in the embodiments of the present application can be one of the client and the server, and the second transmission party in the embodiments of the present application can be the other of the client and the server. The client can be a terminal device, and the server can be a server. In other words, the first transmission party can be a terminal device, and the second transmission party can be a server.
[0019] The message transmission method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0020] See Figure 1 , Figure 1 This is a flow chart of a message transmission method provided by an embodiment of the present application. Figure 1 As shown, the method includes the following steps: Step 110: The first transmission party sends at least one application message to the second transmission party, each of the application messages carries a message sequence number.
[0021] In this embodiment of the present application, the first transmission party is a message sender, the second transmission party is a message receiver, and the application message may be a UDP-compliant message. A message is the basic unit of data transmission in network communications, and the application message may be a message associated with an application, such as a log message. The application message may include messages with various functions, such as content data messages (used to transmit content data such as webpage content), security messages (used to implement encrypted or authenticated communication), and routing protocol messages (used to exchange routing information).
[0022] When a first transmission direction transmits a message to a second transmission direction, multiple application messages are typically transmitted continuously. Each application message sent by the first transmission direction to the second transmission direction may carry a message sequence number. The message sequence number is used to specifically indicate one application message among the at least one application message. For example, if message sequence number 5 indicates application message 1, then when the first transmission direction sends an application message carrying message sequence number 5 to the second transmission direction, it can be determined that the first transmission direction has sent application message 1 to the second transmission direction.
[0023] Furthermore, the message sequence numbers carried by multiple consecutively transmitted application messages can be consecutive message sequence numbers. For example, if three consecutively transmitted application messages are sequenced in transmission order as application message 1, application message 2, and application message 3, message sequence number 5 indicates application message 1, message sequence number 6 indicates application message 2, and message sequence number 7 indicates application message 3. In this case, after the second transmitting party receives application message 1, application message 2, and application message 3 transmitted by the first transmitting party, it can determine the transmission order of the application messages based on the message sequence numbers carried by the application messages.
[0024] In the embodiment of the present application, there are multiple ways of carrying the message sequence number in the application message. The various ways of carrying the message sequence number will be described separately below.
[0025] In one embodiment of the present application, the application message is a message that complies with Internet Protocol Version 4 (IPV4), and the message header of the application message includes an identification field; the message sequence number carried by the application message is set in the identification field.
[0026] In the embodiments of this application, please refer to Figure 2 , Figure 2 This is a schematic diagram of a message header structure of an IPv4-compliant message provided in an embodiment of the present application. Figure 2 Each row in is used to represent 4 bytes. Figure 2As shown in the figure, the message header of an IPv4-compliant message may include the following fields: Version, Internet Header Length (IHL), Type of Service, Total Length, Identification, Flags, Fragment Offset, Time to Live, Protocol, Header Checksum, Source Address, Destination Address, Options, and Padding. The message header of an IPv4-compliant message consists of a fixed portion (20 bytes) and an optional portion (0-40 bytes). Among them, the fixed part includes the above-mentioned version field (4 bits), the above-mentioned header length field (4 bits), the above-mentioned service type field (8 bits), the total length field (16 bits), the identification field (16 bits), the flag field (3 bits), the fragment offset field (13 bits), the lifetime field (8 bits), the protocol field (8 bits), the header checksum field (16 bits), the source Internet Protocol address (32 bits) and the destination Internet Protocol field (32 bits); the optional part includes the above-mentioned option field and the padding field. The option field is generally 0 to 40 bytes and is used to implement special functions (such as record routing, timestamp, etc.). The padding field is used to ensure that the option field is aligned to 4 bytes.
[0027] In an embodiment of the present application, the Identification field in the message header of an IPv4-compliant message can be used to carry the message sequence number. That is, if the application message is an IPv4-compliant message, the message sequence number corresponding to the application message can be set in the Identification field in the message header of the application message, thereby allowing the application message to carry the message sequence number. This carrying method can fully utilize the existing fields in IPv4, achieve compatibility with IPv4, and does not affect the network transmission of the application message.
[0028] In one embodiment of the present application, the application message is an IPV4-compliant message, and the message header of the application message includes an option field; the message sequence number carried by the application message is set in the option field.
[0029] In an embodiment of the present application, for application messages that comply with IPV4, in addition to setting the message sequence number corresponding to the application message in the identification field of the message header of the application message, the message sequence number corresponding to the application message can also be set in the options field of the message header of the application message, thereby making full use of the existing fields in IPV4, achieving compatibility with IPV4, and allowing the application message to carry the message sequence number.
[0030] In one embodiment of the present application, the application message is a message compliant with Internet Protocol Version 6 (IPV6). The message header of the application message includes a flow label field. The message sequence number carried by the application message is set in the flow label field. This method of carrying the message sequence number fully utilizes existing fields in IPV6, achieving compatibility with IPV6 without affecting the network transmission of the application message.
[0031] In the embodiments of this application, please refer to Figure 3 , Figure 3 This is a schematic diagram of a message header structure of an IPv6-compliant message provided in an embodiment of the present application. Figure 3 Each line in the header represents 4 bytes. The header of the IPv6-compliant message is fixed at 40 bytes, with no variable option fields or padding fields. Figure 3 As shown in the figure, the message header that complies with the IPV6 message header includes the following fields: Version (Version), fixed to 4 bits; Traffic Class (Traffic Class), fixed to 8 bits; Flow Label (Flow Label), fixed to 20 bits; Payload Length (Payload Length), fixed to 16 bits; Next Header (Next Header), fixed to 8 bits; Hop Limit (HopLimit), fixed to 8 bits; Source Internet Protocol Address (Source Address), fixed to 128 bits; Destination Internet Protocol Address (Destination Address), fixed to 128 bits.
[0032] The flow label field is used to identify packets belonging to the same data flow. For IPv6-compliant application packets, the application packet's sequence number can be set in the flow label field of the packet header, thereby allowing the application packet to carry the sequence number. This fully utilizes the existing fields in the application layer protocol header to carry the sequence number, improving the convenience of packet transmission.
[0033] For application messages that comply with IPv6, the message sequence number can be set in the flow label field of the message header of the application message, or in the next header field of the message header of the application message. In one embodiment of the present application, the application message is an IPv6-compliant message, and the message header of the application message includes a next header field; the message sequence number carried by the application message is set in the next header field. In this way, existing fields in IPv6 can be fully utilized to achieve compatibility with IPv6 without affecting the network transmission of the application message.
[0034] In one embodiment of the present application, the application message header includes a designated header and a Generic Routing Encapsulation (GRE) header. The GRE header includes a sequence number field. The message sequence number carried by the application message is set in the sequence number field of the GRE header. The designated header is either an IPv4-compliant header or an IPv6-compliant header. Because the sequence number field in the GRE header can be multiple bytes, for example, four bytes, these multiple bytes can be fully utilized to mark a larger number of messages.
[0035] In an embodiment of the present application, the GRE protocol is a tunneling protocol used to encapsulate any network layer protocol within another network layer protocol for transmission. GRE encapsulation adds a GRE header and an outer IP header to the original data packet. The original data packet here can be an original message encapsulated using a specified header. The specified header can be any one of an IPv4-compliant header, an IPv6-compliant header, and a Multi-Protocol Label Switching (MPLS)-compliant header.
[0036] The length of the GRE header is not fixed; the basic GRE header is 4 bytes. Optional fields in the GRE header include a sequence number field, which can be used to control message order and prevent message reordering. For application messages encapsulated using the GRE header, the message sequence number can be set in the sequence number field of the GRE header.
[0037] Embodiments of the present application may also utilize a sequence number field inherent to an application layer protocol to accommodate a message sequence number carried by an application message, wherein the application layer protocol, for example, is a network flow (Netflow) protocol. In one embodiment of the present application, the message header of the application message includes an application layer protocol header; the application layer protocol header includes a sequence number field, and the message sequence number carried by the application message is set in the sequence number field of the application layer protocol header.
[0038] In an embodiment of the present application, an application message encapsulated using an application layer protocol exists. The application layer protocol header of such an application message includes a sequence number field. The sequence number field of the application layer protocol header of the application message can be directly used to carry the message sequence number, thereby enabling the application message to carry the message sequence number. This carrying method can fully utilize the existing fields in the application layer protocol header to carry the message sequence number, thereby improving the convenience of message transmission. Moreover, the sequence number field in the application layer protocol header may already contain a sequence number. In some embodiments of the present application, this existing sequence number can be directly used as the message sequence number.
[0039] In some embodiments of the present application, the first transmission party is one of the client and the server, and the second transmission party is the other. For example, in a specific embodiment, the first transmission party is the client, and the second transmission party is the first server, that is, the client can send at least one application message to the first server. In some cases, there may also be a second server. In this case, before the client sends at least one application message to the first server, the client can send the at least one application message to the second server; the client sends the order-preserving request message to the second server; when the client does not receive the order-preserving response message transmitted by the second server within a preset time period, it determines that the second server is not in place. Among them, one of the first server and the second server is the main server, and the other of the first server and the second server is the backup server.
[0040] In an embodiment of the present application, both the first server and the second server can be message receivers. The first server and the second server can serve as backup for each other. For example, the second server can be the main server and the first server can be the backup server; or, the first server can be the main server and the second server can be the backup server. When sending at least one application message, the client can give priority to sending the at least one application message to the second server and send an order preservation request message to the second server. When the second server is in a state of being in place, the client can receive an order preservation response message fed back by the second server within a preset time period. Therefore, if the client does not receive the order preservation response message transmitted by the second server within a preset time period, it can be considered that the second server is not in a state at this time. When the second server is not in a state, the client can resend the at least one application message to the first server. Wherein, the second server is in a state of being in place, that is, the second server is in an online state, and the second server is not in a state, that is, the second server is in an offline state.
[0041] In one embodiment of the present application, the application message may include a log message, the client may include a log sending device, and the first server and the second server may both be log collection devices for receiving log messages. The first server and the second server may be backup for each other, the second server may be the main log collection device, and the first server may be the backup log collection device. Figure 4 , Figure 4 This is a schematic diagram of an implementation environment of a message transmission method provided in an embodiment of the present application. Figure 4 As shown, the log sending device can send application messages to the main log collection device and the backup log collection device. When the main log collection device is in place, the log sending device can transmit log messages to the main log collection device. When the main log collection device is not in place, the log sending device can transmit log messages to the backup log collection device.
[0042] Step 120: The first transmission direction sends an order preservation request message to the second transmission direction, and the order preservation request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message.
[0043] In an embodiment of the present application, the first transmission party may periodically send a sequence preservation request message to the second transmission party. Alternatively, in the process of the first transmission party sending at least one application message to the second transmission party, the first transmission party may count the number of application messages sent, and when it is determined that the number of application messages sent to the second transmission party is greater than or equal to the preset number of messages, it may stop sending application messages to the second transmission party and send a sequence preservation request message to the second transmission party, and the preset number of messages may be an integer greater than 1. The sequence preservation request message is used to confirm to the second transmission party whether the received application message is missing, and the sequence preservation request message may carry a first identifier and a second identifier, the first identifier indicates the message sequence number of the first application message sent in the at least one application message, and the second identifier indicates the message sequence number of the last application message sent in the at least one application message, so that the second transmission party can confirm whether there is any message omission in this message transmission.
[0044] After receiving the order preservation request message, the second transmission party can determine whether the application message received by the second transmission party is complete based on the first identifier and the second identifier carried by the order preservation request message and the message sequence number carried in the received application message, and thus feedback the order preservation response message to the first transmission party. For example, the message sequence number indicated by the first identifier carried by the order preservation request message is 14, and the message sequence number indicated by the second identifier is 18. In theory, the second transmission party receives 5 application messages with message sequence numbers from 14 to 18. If the message sequence numbers carried by the multiple application messages actually received by the second transmission party are 14, 15, 16, 17 and 18, the second transmission party can determine that the application message received in this message transmission is complete.
[0045] In one embodiment of the present application, the sequence preservation request message includes a payload portion, the payload portion includes first information and second information, and the first information and the second information both include a type field, a length field, and a value field.
[0046] In an embodiment of the present application, the order-preserving request message may be a message compliant with the Internet Control Message Protocol (ICMP) or UDP. The order-preserving request message may include a payload portion, which may be composed of multiple type segments. Specifically, the payload portion includes first information and second information, each of which includes a type field, a length field, and a value field.
[0047] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the data structure of the payload portion of an order preservation request message provided in an embodiment of the present application. The first information and the second information included in the payload portion may include: Figure 5 The type field, length field, and value field shown in FIG. The type field may be 2 bytes long, and the length field may be 2 bytes long. The value field may include one or more message sequence numbers, each of which may be 4 bytes long. Therefore, the value field may be n bytes, where n is a multiple of 4. The length of the value field is variable.
[0048] The type field included in the first information indicates the first type used for the first identifier, that is, the identifier type used to indicate the message sequence number of the first sent application message. The length field of the first information indicates the byte length occupied by the first information, that is, the sum of the length of the type field, the length of the length field, and the length of the value field in the first information. The value field of the first information indicates the value of the first identifier, that is, the message sequence number of the first sent application message indicated by the first identifier.
[0049] The type field of the second information indicates the second type used for the second identifier, that is, the identifier type used to indicate the message sequence number of the last transmitted application message. The length field of the second information indicates the byte length occupied by the second information, that is, the sum of the length of the type field, the length of the length field, and the length of the value field in the second information. The value field of the second information indicates the value of the second identifier, that is, the identifier type of the message sequence number of the last transmitted application message indicated by the second identifier.
[0050] For example, see Figure 6 , Figure 6 This is a schematic diagram of an example of the payload portion of an order preservation request message provided in an embodiment of the present application. Figure 6 As shown, the value of the type field is 1, which indicates the first type, the value of the length field is 8, and the value of the value field is 100, that is, the value of the first identifier is 100. The value of the type field is 2, which indicates the second type, the value of the length field is 8, and the value of the value field is 130, that is, the value of the second identifier is 130. Figure 6 The first identifier carried by the illustrated sequence preservation request message indicates that the message sequence number of the first sent application message is 100, and the second identifier carried indicates that the message sequence number of the last sent application message is 130, that is, the first transmission direction sends 31 application messages with message sequence numbers between 100-130 to the second transmission party.
[0051] Step 130: The first transmission party receives the order-preserving response message transmitted by the second transmission party; wherein the order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message.
[0052] In an embodiment of the present application, the sequence-preserving response message is used to indicate the integrity of the application message received by the second transmission party. In the case that the sequence-preserving response message received by the first transmission party indicates that the application message received by the second transmission party is complete, it can be determined that the second transmission party has received at least one application message sent by the first transmission party. In the case that the sequence-preserving response message received by the first transmission party indicates that the application message received by the second transmission party is incomplete, the first transmission party may resend at least one application message to the second transmission party, or resend the missing application message to the second transmission party, and the missing application message is the application message in the at least one application message that the second transmission party has not received. Through the sequence-preserving response message and the missing application message retransmission mechanism, it can be ensured that the second transmission party has completely received the at least one application message.
[0053] In one embodiment of the present application, the sequence preservation response message includes a payload portion, the payload portion includes third information, and the third information indicates that there is no missing application message between the first sent application message and the last sent application message.
[0054] In an embodiment of the present application, similar to the sequence preservation request message, the sequence preservation response message may also include a payload portion, wherein the payload portion includes third information for indicating the absence of application messages received by the second transmission party. In the case where the second transmission party determines that it has received complete application messages between the first application message sent and the last application message sent, the third information included in the payload portion of the sequence preservation response message fed back by the second transmission direction to the first transmission party may indicate that there are no missing application messages between the first application message sent and the last application message sent.
[0055] In one embodiment of the present application, the third information may be composed of a type field and a length field. The type field of the third information may be used to indicate the fourth type of the third information, and the fourth type is a type in which no missing application message exists. The length field of the third information may be used to indicate the byte length occupied by the third information. In this case, the first transmission party may determine that there is no missing application message between the first sent application message and the last sent application message when the type field of the third information included in the received sequence preservation response message indicates the fourth type, that is, the second transmission party receives a complete application message.
[0056] Optionally, in another embodiment, the type field of the third information may indicate a third type for a third identifier, that is, an identifier type for indicating a message sequence number of a missing application message between the first sent application message and the last sent application message. The third identifier indicates a message sequence number of a missing application message between the first sent application message and the last sent application message. If there is no missing application message between the first sent application message and the last sent application message, the third information consists only of a type field and a length field. If there is a missing application message between the first sent application message and the last sent application message, the third information may further include a numerical field in addition to the type field and the length field.
[0057] In this case, the first transmission party can determine that there is no missing application message between the first sent application message and the last sent application message when the third information included in the received sequence preservation response message consists only of the type field and the length field, that is, the second transmission party receives the complete application message, thereby ensuring the integrity of the message transmission between the first transmission party and the second transmission party.
[0058] In an embodiment of the present application, the first transmission direction sends at least one application message to the second transmission direction, and each of the application messages carries a message sequence number; the first transmission direction sends an order-preserving request message to the second transmission direction, and the order-preserving request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message; the first transmission direction receives the order-preserving response message transmitted by the second transmission direction; wherein the order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message. In this way, there is no need to rely on the TCP protocol for message transmission. On the basis of solving the cumbersome problems brought by the TCP protocol for message transmission, the transmission integrity of the at least one application message can be ensured through the first identifier and the second identifier in the order-preserving request message and the order-preserving response message, which can solve the problem that the related technology cannot take into account both the simplification of the message transmission process and the integrity of the message transmission.
[0059] Please refer to Figure 7 , Figure 7 This is a flow chart of another message transmission method provided by an embodiment of the present application. Figure 7 As shown, the method includes the following steps: Step 710: The first transmission party sends at least one application message to the second transmission party, each of the application messages carries a message sequence number.
[0060] Step 720: The first transmission direction sends an order preservation request message to the second transmission direction, and the order preservation request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message.
[0061] In one embodiment of the present application, the first transmission party is a client, and the second transmission party is a first server; before the client sends at least one application message to the first server, the method further includes: the client sends the at least one application message to the second server; the client sends the order preservation request message to the second server; when the client does not receive the order preservation response message transmitted by the second server within a preset time period, it determines that the second server is in an absent state. Wherein, one of the first server and the second server is a primary server, and the other of the first server and the second server is a backup server.
[0062] In an embodiment of the present application, after the client sends an order preservation request message to the second server, a target mapping table can be established. The target mapping table includes: the address of the second server, the first identifier, the second identifier and the target information, and the target information indicates the message sequence number of the missing application message. That is, the target mapping table is used to store the following mapping relationship: <second server address, message sequence number of the first application message sent, message sequence number of the last application message sent, message sequence number of the missing application message>. Since the missing status of the application message is unknown at this time, the message sequence number of the missing application message in the above mapping relationship can be empty.
[0063] After determining that the second server is not in place, the client can send the at least one application message to the first server, and at the same time update the mapping relationship stored in the above-mentioned target mapping table to: <first server address, message sequence number of the first application message sent, message sequence number of the last application message sent, message sequence number of the missing application message>.
[0064] Step 730: The first transmission party receives the sequence preservation response message transmitted by the second transmission party; wherein, the sequence preservation response message carries a third identifier, and the third identifier indicates the message sequence number of the missing application message between the first sent application message and the last sent application message.
[0065] In an embodiment of the present application, after the second transmission party receives the order preservation request message sent by the first transmission party, the second transmission party can determine the message sequence number of the missing application message between the first sent application message and the last sent application message based on the first identifier and the second identifier carried in the order preservation request message and the message sequence number carried in the received application message. For example, the message sequence number of the application message indicated by the first identifier carried by the order preservation request message is 15, and the message sequence number of the application message indicated by the second identifier is 20. The second transmission party actually receives 5 application messages with message sequence numbers of 15, 16, 17, 19 and 20 respectively. Then, the second transmission party can determine that the application message with message sequence number 18 is the missing application message, and can send an order preservation response message carrying a third identifier for indicating the application message with message sequence number 18 to the first transmission party.
[0066] In one embodiment of the present application, similar to the sequence preservation request message, the sequence preservation response message may include a payload part, the payload part includes third information, and the third information includes a type field, a length field and a value field. The type field of the third information indicates the third type used for the third identifier, that is, the identifier type used to indicate the message sequence number of the missing application message between the first sent application message and the last sent application message. The length field of the third information indicates the byte length occupied by the third information, that is, the sum of the length of the type field, the length of the length field and the length of the value field contained in the third information. The value field of the third information indicates the value of the third identifier, that is, the message sequence numbers of all missing application messages between the first sent application message and the last sent application message.
[0067] Step 740: The first transmission party sends the missing application message to the second transmission party based on the third identifier carried in the sequence preservation response message, where the missing application message carries a message sequence number.
[0068] In an embodiment of the present application, the number of missing application messages may be one or more. In conjunction with the above example, after receiving the sequence preservation response message carrying the third identifier indicating the application message with message sequence number 18, the first transmission party may resend the application message with message sequence number 18 to the second transmission party, thereby ensuring that the second transmission party completely receives all application messages between the first sent application message and the last sent application message.
[0069] In one embodiment of the present application, before the first transmission party receives the sequence preservation response message transmitted by the second transmission party, the first transmission party determines that the second transmission party is in a position state, and updates the target information in the target mapping table based on the third identifier carried by the sequence preservation response message. The target mapping table includes: the address of the second transmission party, the first identifier, the second identifier, and the target information; the target information indicates the message sequence number of the missing application message.
[0070] In an embodiment of the present application, before the first transmission party receives the sequence preservation response message, the missing application message is unknown, and the target information of the target mapping table may be empty. After the first transmission party receives the sequence preservation response message, the message sequence number of the missing application message may be determined based on the third identifier carried by the sequence preservation response message. Then, the target information in the target mapping table may be updated to obtain the following mapping relationship: <address of the second transmission party, message sequence number of the first application message sent, message sequence number of the last application message sent, message sequence number of the missing application message>.
[0071] In one embodiment of the present application, after sending the missing application message to the second transmission party, a secondary order preservation request message may be sent to the second transmission party to ensure whether the second transmission party has received all the missing application messages, and the first transmission party receives the secondary order preservation response message transmitted by the second transmission party. The content of the secondary order preservation request message may be consistent with the content of the order preservation request message in step 720, that is, the secondary order preservation request message may carry a first identifier and a second identifier. Alternatively, the secondary order preservation request message may carry a third identifier, and the third identifier indicates the message sequence number of the missing application message between the first sent application message and the last sent application message.
[0072] Similar to the sequence preservation response message, the secondary sequence preservation response message is used to indicate whether the second transmission party still has missing application messages that have not been received. That is, after sending the missing application message to the second transmission party, the second transmission party may receive all the missing application messages, or may only receive some of the missing application messages. The secondary sequence preservation response message may carry a third identifier, and the third identifier indicates the message sequence number of the missing application message between the first sent application message and the last sent application message; or, the secondary sequence preservation response message may include a payload part, and the payload part includes third information, and the third information indicates that there is no missing application message between the first sent application message and the last sent application message.
[0073] In some embodiments of the present application, the secondary order preservation request message includes a payload portion, the payload portion includes third information, and the third information includes a type field, a length field, and a value field. The type field of the third information indicates the type used for the third identifier, that is, the third type, the length field of the third information indicates the byte length occupied by the third information, and the value field of the third information indicates the value of the third identifier. The type field of the third information can take one of the first value, the second value, and the third value, the first value indicates the first type, the second value indicates the second type, and the third value indicates the third type. The first value can be 1, the second value can be 2, and the third value can be 3.
[0074] Specifically, when the secondary order preservation request message carries the first identifier and the second identifier, the content of the secondary order preservation request message may be as follows: Figure 6As shown, the payload part of the secondary order preservation request message includes first information for carrying a first identifier and second information for carrying a second identifier. The type field of the first information is 1, which is used to indicate the first type, the length field of the first information is 8 bytes, and the numerical field of the first information is the message sequence number of the first sent application message, that is, 100. The type field of the second information is 2, which is used to indicate the second type, the length field of the second information is 8 bytes, and the numerical field of the second information is the message sequence number of the last sent application message, that is, 130. In the case where the secondary order preservation request message carries a third identifier, you can refer to Figure 8 , Figure 8 The payload part of the secondary order preservation request message provided in the embodiment of the present application is a schematic diagram of an example. The payload part of the secondary order preservation request message includes a type field, a length field and a value field, such as Figure 8 As shown, the type field of the payload part of the secondary sequence preservation request message is 3, which is used to indicate the third type. The length field of the payload part can be 20 bytes. The value field of the payload part can include the message sequence numbers of four missing messages, which are 103, 105, 118 and 125 respectively.
[0075] In an embodiment of the present application, after the first transmission party receives the order preservation response message transmitted by the second transmission party, the first transmission party may send the missing application message to the second transmission party based on the third identifier carried by the order preservation response message, thereby ensuring that the second transmission party can completely receive all application messages between the first sent application message and the last sent application message, further ensuring the integrity of the complete message transmission.
[0076] Please refer to Figure 9 , Figure 9 This is a flow chart of another message transmission method provided by an embodiment of the present application. Figure 9 As shown, the method can be performed by the second transmitting party, including the following steps: Step 910: The second transmission party receives at least one target application message, where the at least one target application message is at least a part of at least one application message sent by the first transmission party to the second transmission party, and each of the target application messages carries a message sequence number.
[0077] In an embodiment of the present application, after a first transmission direction sends at least one application message to a second transmission direction, the second transmission direction may receive at least one target application message, where the at least one target application message is at least a portion of the at least one application message sent by the first transmission direction to the second transmission direction. In other words, the at least one target application message may be the same as the at least one application message, meaning that the second transmission direction may have received the at least one application message in its entirety. Alternatively, the second transmission direction may have received only a portion of the at least one application message, with the received portion being the at least one target application message.
[0078] Similar to the method of carrying the message sequence number in the application message, the method of carrying the message sequence number in the target application message can also include the following methods. Each carrying method is not described in detail here. Please refer to the previous description for details. The method of carrying the message sequence number in the target application message can be the same as the method of carrying the message sequence number in the application message, or a different method can be used.
[0079] In one embodiment of the present application, the target application message is an IPV4-compliant message, and the message header of the target application message includes an identification field; the message sequence number carried by the target application message is set in the identification field.
[0080] In one embodiment of the present application, the target application message is an IPV4-compliant message, and the message header of the target application message includes an option field; the message sequence number carried by the target application message is set in the option field.
[0081] In one embodiment of the present application, the target application message is a message that complies with Internet Protocol version 6, and the message header of the target application message includes a flow label field; the message sequence number carried by the target application message is set in the flow label field.
[0082] In one embodiment of the present application, the target application message is a message that complies with Internet Protocol version 6, and the message header of the target application message includes a next header field; the message sequence number carried by the target application message is set in the next header field.
[0083] In one embodiment of the present application, the header of the target application message includes a designated header and a Generic Routing Encapsulation (GRE) header, the GRE header including a sequence number field; the message sequence number carried by the target application message is set in the sequence number field of the GRE header. The designated header is either a header compliant with Internet Protocol version 4 or a header compliant with Internet Protocol version 6.
[0084] In one embodiment of the present application, the message header of the target application message includes an application layer protocol header; the application layer protocol header includes a sequence number field, and the message sequence number carried by the target application message is set in the sequence number field of the application layer protocol header.
[0085] Step 920: The second transmission party records the message sequence number carried by each of the at least one target application message.
[0086] Since each of the at least one target application message may carry a message sequence number, the second transmission party may determine the message sequence number carried by each of the at least one target application message and record it.
[0087] Step 930: The second transmission party receives the order preservation request message sent by the first transmission party, and the order preservation request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message.
[0088] In one embodiment of the present application, the sequence preservation request message includes a payload part, the payload part includes first information and second information, and the first information and the second information both include a type field, a length field and a value field; wherein, the type field of the first information indicates the first type used for the first identifier; the length field of the first information indicates the byte length occupied by the first information; the value field of the first information indicates the value of the first identifier; the type field of the second information indicates the second type used for the second identifier; the length field of the second information indicates the byte length occupied by the second information; the value field of the second information indicates the value of the second identifier.
[0089] In the embodiment of the present application, the introduction of the order preservation request message can be found in the description of step 120 above, which will not be repeated here.
[0090] Step 940: The second transmission party transmits an order preservation response message to the first transmission party based on the recorded target message sequence number; wherein the order preservation request message and the order preservation response message are used to ensure the transmission integrity of the at least one application message.
[0091] In an embodiment of the present application, the second transmission party may determine whether the recorded target message sequence number includes the message sequence numbers of all messages between the first application message sent and the last application message sent. In the case that the recorded target message sequence number includes the message sequence numbers of all messages between the first application message sent and the last application message sent, it can be determined that there is no missing application message between the first application message sent and the last application message sent, and the second transmission direction feeds back to the first transmission party an order-preserving response message indicating that there is no missing application message between the first application message sent and the last application message sent.
[0092] Specifically, the sequence preservation response message includes a payload portion, the payload portion includes third information, and the third information indicates that there is no missing application message between the first sent application message and the last sent application message.
[0093] In one embodiment of the present application, the third information consists of a type field and a length field, wherein the type field of the third information indicates the third type used for the third identifier; and the length field of the third information indicates the byte length occupied by the third information.
[0094] In an embodiment of the present application, when the recorded target message sequence number does not include the message sequence numbers of all messages between the first sent application message and the last sent application message, it can be determined that there are missing application messages between the first sent application message and the last sent application message. The second transmission party can then determine a third identifier based on the recorded target message sequence number, and the third identifier indicates the message sequence number of the missing application message between the first sent application message and the last sent application message. The second transmission party records the third identifier, and the second transmission direction transmits a sequence preservation response message carrying the third identifier to the first transmission party.
[0095] In order to ensure the integrity of message transmission, in one embodiment of the present application, after the second transmission direction transmits the sequence preservation response message carrying the third identifier to the first transmission party, the second transmission party receives the missing application message sent by the first transmission party, and the missing application message carries the message sequence number; after receiving all missing application messages indicated by the third identifier, the second transmission party deletes the third identifier.
[0096] In one embodiment of the present application, the sequence preservation response message includes a payload portion, the payload portion includes third information, and the third information includes a type field, a length field, and a value field. The type field of the third information indicates the third type used for the third identifier; the length field of the third information indicates the byte length occupied by the third information, and the value field of the third information indicates the value of the third identifier. For the content of the sequence preservation response message, please refer to the previous description and will not be elaborated here.
[0097] In an embodiment of the present application, the second transmission party receives at least one target application message, which is at least a part of at least one application message sent from the first transmission party to the second transmission party, and each of the target application messages carries a message sequence number; the second transmission party records the message sequence number carried by each of the target application messages in the at least one target application message; the second transmission party receives the order preservation request message sent by the first transmission party, and the order preservation request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message; the second transmission party transmits an order preservation response message to the first transmission party based on the recorded target message sequence number; wherein, the order preservation request message and the order preservation response message are used to ensure the transmission integrity of the at least one application message. In this way, there is no need to rely on the TCP protocol for message transmission. On the basis of solving the cumbersome problems brought by the TCP protocol message transmission, the transmission integrity of the at least one application message can be ensured through the first identifier and the second identifier in the order-preserving request message and the order-preserving response message, which can solve the problem that related technologies cannot take into account both the simplification of the message transmission process and the integrity of the message transmission.
[0098] The message transmission method provided in the embodiment of the present application may involve a client, a first server, and a second server. In this case, the client may be a log sending device, the first server may be a backup log collection device, and the second server may be a main log collection device. When the main log collection device is in place, the client can complete the message transmission process with the second server. When the main log collection device is not in place and the backup log collection device is in place, the client can complete the message transmission process with the first server.
[0099] The message transmission process will be further described in detail below by way of example. It should be understood that in the following examples, the application message is a log message, the first transmission party is a log sending device, and the second transmission party is a log collecting device. These are all examples, not limitations. Figure 10 and Figure 11, Figure 10 This is a communication interaction diagram of a message transmission process provided by an embodiment of the present application. Figure 11 This is a communication interaction diagram of another message transmission process provided in an embodiment of the present application.
[0100] like Figure 10 As shown, the log sending device can send log messages carrying message sequence numbers based on the UDP protocol to the main log collecting device, that is, Figure 10 Step 1001 in the above. The initial value of the message sequence number can be randomly selected. Each time a log message is sent to the main log collection device, the message sequence number carried by the log message is increased by 1. If the log message itself does not have a message sequence number, the log sending device can generate a sequence number. The generated sequence number can be carried in, for example, an identification field that conforms to the IPv4 header. In this way, the network transmission of the log message is not affected. If the application layer protocol header of the log message already carries a sequence number field, the value of this sequence number field can be directly used as the message sequence number without the need to generate an additional sequence number.
[0101] In step 1002, after receiving a log message, the primary log collection device may record the message sequence number of the received log message. In step 1003, the log sending device may send a sequence preservation request message to the primary log collection device, either periodically or when the number of sent log messages reaches a fixed number of sent log messages. This message may conform to protocols such as ICMP or UDP and carry the message sequence number of the first sent log message (denoted as the sent first sequence number A1) and the message sequence number of the last sent log message (denoted as the sent last sequence number B1). In step 1004, the log sending device may establish a mapping of <log collection device address, sent first sequence number, sent last sequence number, and message sequence number of missing messages>, where the log collection device address may be the address of the primary log collection device, i.e., the address of the second server.
[0102] In step 1005, the main log collection device, after receiving the order-keeping request message, records the message sequence number of the missing message according to the first sequence number A1 and the tail sequence number B1 that have been sent. Wherein, step 1004 and step 1005 can be performed in no particular order, for example, can be performed simultaneously. Then in step 1006, the main log collection device can feed back the order-keeping response message to the log sending device, and the described order-keeping response message can carry the message sequence number of the missing message. In step 1007, after the log sending device receives the order-keeping response message, the main log collection device can be set to the in-position state, and update the mapping <log collection device address, the first sequence number that has been sent, the tail sequence number that has been sent, the message sequence number of the missing message>.
[0103] In step 1008, the log sending device can resend all missing log messages carrying message sequence numbers to the main log collection device. After sending all missing log messages, in step 1010, the log sending device can send a sequence preservation request message to the main log collection device, wherein the sequence preservation request message carries the sent first sequence number A1 and the sent tail sequence number B1 (or only carries the missing sequence number). In this process, in step 1009, the main log collection device can receive the missing log message resent by the log sending device, and record the message sequence number of the received log message, and delete the message sequence number of the received log message from the message sequence number of the previously recorded missing log message. Wherein steps 1009 and 1010 can be performed in any order, for example, can be performed simultaneously.
[0104] In step 1011, after receiving the order-preserving request message, the main log collection device sends an order-preserving response message to the main log collection device. If the main log collection device has received all the missing log messages, the order-preserving response message has no content to carry, which is used to indicate that there is no missing log message. If the main log collection device still has missing log messages that have not been received, the order-preserving response message carries the message sequence number of the missing log message, and the log sending device can send the missing log message to the main log collection device again. After receiving the order-preserving response message, the log sending device can update the mapping <log collection device address, sent first sequence number, sent last sequence number, message sequence number of the missing message> in step 1012.
[0105] By step 1001-step 1012, the transmission of the journal message with the message sequence number between the first sequence number A1 and the tail sequence number B1 can be completed. Then, the journal sending device can continue to send the journal message after the tail sequence number B1 to the main log collection device. As shown in steps 1013-step 1017, in step 1013, the journal sending device sends the journal message after the tail sequence number B1 to the main log collection device. In step 1014, the main log collection device, after receiving the journal message, can record the message sequence number of the received journal message and delete the message sequence number of the journal message before the tail sequence number received before. In step 1015, the log sending device sends an order preservation request message to the main log collection device at a fixed time or when the number of log messages sent reaches a fixed number of sent logs. The order preservation request message carries the sent first sequence number A2 and the sent last sequence number B2, where A2 can be numerically equal to B1+1. In step 1016, the mapping <log collection device address, sent first sequence number, sent last sequence number, message sequence number of the missing message> is updated. After receiving the order preservation request message, if the main log collection device determines that there are no missing log messages in this message transmission, in step 1017, it can feedback to the log sending device an order preservation response message with no content, or a missing log message in this message transmission, and the order preservation response message carries the message sequence number of the missing log message.
[0106] like Figure 11 As shown, the following describes the message transmission process when the primary log collection device is not in place and the backup log collection device is in place.
[0107] Figure 11 In the absent state for the main log collection device, and the standby log collection device is in the present state. In step 1102, the log sending device sends the log message carrying message sequence number based on the UDP protocol to the main log collection device. In step 1104, the log sending device is timing or when the number of log messages sent reaches the fixed number of sent logs, sends a maintenance order request message to the main log collection device. The maintenance order request message can conform to protocols such as ICMP or UDP. The maintenance order request message carries the first sequence number and the tail sequence number that have been sent. In step 1106, the log sending device can update the mapping <log collection device address, the first sequence number that has been sent, the tail sequence number that has been sent, the message sequence number of the missing message>. Here, the log collection device address can be the main log collection device address, i.e. the second server address. If the log sending device does not receive the maintenance order response message sent by the main log collection device when it times out, in step 1108, the main log collection device is put out of position.
[0108] In step 1110, the log sending device may resend the log message between the sent first sequence number and the sent last sequence number to the standby log collecting device. During this period, after the standby log collecting device receives the log message, it records the message sequence number of the received log message. In step 1112, the log sending device sends an order preservation request message to the standby log collecting device at a fixed time or when the number of log messages sent reaches a fixed number of sent logs, and the order preservation request message carries the sent first sequence number and the sent last sequence number. After receiving the order preservation request message, the standby log collecting device may feed back an order preservation response message to the log sending device in step 1114. If the standby log collecting device does not have any missing log message that it has not received, the order preservation response message has no content to carry; if the standby log collecting device does have any missing log message that it has not received, the order preservation response message carries the message sequence number of the missing log message. After receiving the sequence preservation response message fed back by the backup log collection device, the log sending device sets the log collection device to the in-place state in step 1116, and updates the mapping of <log collection device address, first sequence number sent, last sequence number sent, message sequence number of missing message>. Here, the log collection device address can be the backup log collection device address, that is, the first server address mentioned above.
[0109] Please refer to Figure 12 , Figure 12 This is a schematic diagram of a TCP-based message transmission process in related technology. Figure 12 As shown in the figure, the TCP-based message transmission process requires a three-way handshake, namely Figure 12 After the handshake, the sender sends data packets to the receiver, as shown in 4, 6, and 8. Each data packet sent is assigned a sequence number, and the sequence number increases by 1 every time a byte is sent. For example, when executing Figure 12 In the message transmission process shown in Figure 4, the sender sends a 1000-byte data message to the receiver. The sequence number of this data message starts at 0 and increases by 1000 after the data message is sent. After receiving this data message, the receiver sends an acknowledgment character (ACK). In this case, the acknowledgment character can be 1000, indicating that the receiver expects to receive a data message with sequence number 1000 next time.
[0110] The receiver can send ACK for each data packet, such as Figure 12 5, 7, and 9 in FIG. If the receiver receives multiple data packets continuously (such as Figure 12 10, 11, 12, 13, and 14 in FIG), or only the last data message (i.e. Figure 1214) sends an ACK to indicate that the data message shown in 14 and the data message received before the data message have been successfully received, for example Figure 12 After the data transmission is completed, the sender and receiver will wave four times to disconnect, as shown in Figure 15. Figure 12 16, 17, 18 and 19 shown in FIG.
[0111] exist Figure 12 During the transmission of the messages shown in 10, 11, 12, 13, and 14, if the sender continuously sends the data messages shown in 10, 11, 12, 13, and 14, and the receiver only receives the data messages shown in 10 and 14, since the last consecutive data message received by the receiver is the data message shown in 10, the receiver can first feedback an ACK for the data message shown in 10 to the sender. Since the data messages shown in 11, 12, and 13 have not arrived, the receiver will continue to wait for these messages and will not send ACKs for the data messages shown in 11, 12, and 13 because the sequence numbers of the data messages are discontinuous.
[0112] To notify the sender of missing packets, the receiver sends multiple ACKs to the sender, acknowledging the data packet shown in 10. These repeated ACKs are called duplicate ACKs. After receiving three or more duplicate ACKs, the sender determines that the intervening data packets (i.e., packets shown in 11, 12, and 13) are lost and immediately retransmits them to the receiver. This mechanism is called fast retransmit.
[0113] Compared with the above-mentioned TCP-based data transmission process, the setting of the message sequence number in the embodiment of the present application is different. In the embodiment of the present application, the message sequence number of the application message is increased by 1 for each application message sent, while the increase in the sequence number of the message sent in the TCP-based data transmission is based on the length of the last message sent. In addition, the TCP-based data transmission process has an additional handshake stage, a wave stage, multiple packet-by-packet confirmation signaling interactions, and multiple confirmation signaling interactions when messages are missing, which is more cumbersome. Moreover, TCP-based data transmission performs TCP segmentation reassembly in order to synthesize log messages, which not only affects performance, but also makes it impossible to intuitively see the log content through the message. In addition, when the recipient exchanges the main and standby devices, the sender needs to re-establish a link with the standby device, which may cause the log message to be lost.
[0114] The message transmission method provided in the embodiment of the present application can reduce signaling interaction while ensuring the integrity of the log message. It does not require the use of a large amount of cache for segmentation and reassembly, which affects performance. The correctness of the log content can be intuitively seen through the log message, making it easier for the message recipient to use.
[0115] It should also be understood that the message transmission method provided in the embodiments of the present application can have the following beneficial effects: First, it can ensure the integrity of message transmission. Second, the message receiver (the second transmission party) does not need to support TCP. Third, heartbeat detection can be implemented between the message sender (the first transmission party) and the message receiver.
[0116] See Figure 13 , Figure 13 This is a structural block diagram of a message transmission system provided by an embodiment of the present application. Figure 13 As shown, an embodiment of the present application provides a message transmission system 1300 , and the message transmission system 1300 includes: a first transmission party 1310 and a second transmission party 1320 .
[0117] The first transmission party 1310 is configured to send at least one application message to the second transmission party, each application message carrying a message sequence number; and send an order preservation request message to the second transmission party, the order preservation request message carrying a first identifier and a second identifier, the first identifier indicating the message sequence number of the first sent application message in the at least one application message, and the second identifier indicating the message sequence number of the last sent application message in the at least one application message; The first transmission party 1310 is further configured to receive an order preservation response message transmitted by the second transmission party; wherein the order preservation request message and the order preservation response message are used to ensure the transmission integrity of the at least one application message; The second transmission party 1320 is configured to receive at least one target application message, where the at least one target application message is at least a portion of the at least one application message sent by the first transmission party to the second transmission party, each of the target application messages carrying a message sequence number; and record the message sequence number carried by each of the target application messages in the at least one target application message; The second transmission party 1320 is further configured to receive the order preservation request message sent by the first transmission party, and transmit an order preservation response message to the first transmission party based on the recorded target message sequence number.
[0118] In an embodiment of the present application, the first transmission direction sends at least one application message to the second transmission direction, and each of the application messages carries a message sequence number; the first transmission direction sends an order-preserving request message to the second transmission direction, and the order-preserving request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first sent application message in the at least one application message, and the second identifier indicates the message sequence number of the last sent application message in the at least one application message; the first transmission direction receives the order-preserving response message transmitted by the second transmission direction; wherein the order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message. In this way, there is no need to rely on the TCP protocol for message transmission. On the basis of solving the cumbersome problems brought by the TCP protocol for message transmission, the transmission integrity of the at least one application message can be ensured through the first identifier and the second identifier in the order-preserving request message and the order-preserving response message, which can solve the problem that the related technology cannot take into account both the simplification of the message transmission process and the integrity of the message transmission.
[0119] The message transmission system provided in the embodiment of the present application can implement each process implemented in the above method embodiment. To avoid repetition, it will not be repeated here.
[0120] See Figure 14 , Figure 14 This is a structural block diagram of an electronic device provided in an embodiment of the present application. Figure 14As shown, an embodiment of the present application also provides an electronic device 1400. The electronic device 1400 includes: a processor 1410 and a memory 1420, and the memory 1420 stores a program or instruction, and when the program or instruction is executed by the processor 1410, it implements the steps of any of the methods described above. For example, when the program is executed by the processor 1410, the following process is implemented: the first transmission direction sends at least one application message to the second transmission direction, and each of the application messages carries a message sequence number; the first transmission direction sends an order preservation request message to the second transmission direction, and the order preservation request message carries a first identifier and a second identifier, the first identifier indicates the message sequence number of the first application message sent in the at least one application message, and the second identifier indicates the message sequence number of the last application message sent in the at least one application message; the first transmission direction receives the order preservation response message transmitted by the second transmission direction; wherein, the order preservation request message and the order preservation response message are used to ensure the transmission integrity of the at least one application message. In this way, there is no need to rely on the TCP protocol for message transmission. On the basis of solving the cumbersome problems brought by the TCP protocol message transmission, the transmission integrity of the at least one application message can be ensured through the first identifier and the second identifier in the order-preserving request message and the order-preserving response message, which can solve the problem that related technologies cannot take into account both the simplification of the message transmission process and the integrity of the message transmission.
[0121] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of each embodiment of the message transmission method are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0122] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0123] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0124] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0125] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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 device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0126] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of this application.
[0127] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A message transmission method, characterized in that: include: The first transmission direction sends at least one application message to the second transmission direction, each of the application messages carrying a message sequence number; The first transmission direction sends an order preservation request message to the second transmission direction, the order preservation request message carrying a first identifier and a second identifier, the first identifier indicating a message sequence number of a first sent application message in the at least one application message, and the second identifier indicating a message sequence number of a last sent application message in the at least one application message; The first transmission party receives the sequence preservation response message transmitted by the second transmission party; The order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message.
2. The method according to claim 1, characterized in that The sequence preservation request message includes a payload portion, the payload portion includes first information and second information, and the first information and the second information both include a type field, a length field, and a value field; The type field of the first information indicates the first type for the first identifier; the length field of the first information indicates the byte length occupied by the first information; and the value field of the first information indicates the value of the first identifier. The type field of the second information indicates the second type used for the second identifier; the length field of the second information indicates the byte length occupied by the second information; and the value field of the second information indicates the value of the second identifier.
3. The method according to claim 1, characterized in that The sequence preservation response message carries a third identifier, where the third identifier indicates a message sequence number of a missing application message between the first sent application message and the last sent application message; After the first transmitting party receives the sequence preservation response message transmitted by the second transmitting party, the method further includes: The first transmission party sends the missing application message to the second transmission party based on the third identifier carried in the sequence preservation response message, where the missing application message carries a message sequence number.
4. The method according to claim 1, wherein The sequence preservation response message includes a payload portion, the payload portion includes third information, and the third information indicates that there is no missing application message between the first sent application message and the last sent application message.
5. The method according to claim 3, characterized in that After the first transmitting party receives the sequence preservation response message transmitted by the second transmitting party, the method further includes: The first transmission party determines that the second transmission party is in a position state, and updates the target information in the target mapping table based on the third identifier carried by the sequence preservation response message; The target mapping table includes: the address of the second transmission party, the first identifier, the second identifier and the target information; the target information indicates the message sequence number of the missing application message.
6. The method according to any one of claims 1 to 5, characterized in that The application message is a message that complies with Internet Protocol Version 4; The message header of the application message includes an identification field, and the message sequence number carried by the application message is set in the identification field; or the message header of the application message includes an option field, and the message sequence number carried by the application message is set in the option field.
7. The method according to any one of claims 1 to 5, characterized in that The application message is a message that complies with Internet Protocol Version 6; The message header of the application message includes a flow label field, and the message sequence number carried by the application message is set in the flow label field; or, the message header of the application message includes a next header field, and the message sequence number carried by the application message is set in the next header field.
8. The method according to any one of claims 1 to 5, characterized in that The message header of the application message includes a designated header and a general routing encapsulation (GRE) header, and the GRE header includes a sequence number field; the message sequence number carried by the application message is set in the sequence number field of the GRE header; The designated header is any one of a header that complies with Internet Protocol version 4 and a header that complies with Internet Protocol version 6.
9. The method according to any one of claims 1 to 5, characterized in that The message header of the application message includes an application layer protocol header; the application layer protocol header includes a sequence number field, and the message sequence number carried by the application message is set in the sequence number field of the application layer protocol header.
10. The method according to any one of claims 1 to 5, characterized in that The first transmission party is a client, and the second transmission party is a first server; Before the client sends at least one application message to the first server, the method further includes: The client sends the at least one application message to the second server; The client sends the order preservation request message to the second server; If the client does not receive the sequence preservation response message transmitted by the second server within a preset time period, determining that the second server is in an absent state; One of the first server and the second server is a primary server, and the other of the first server and the second server is a backup server.
11. A message transmission method, characterized in that: include: The second transmission party receives at least one target application message, where the at least one target application message is at least a portion of the at least one application message sent by the first transmission party to the second transmission party, and each of the target application messages carries a message sequence number; The second transmission party records a message sequence number carried by each of the at least one target application message; The second transmission party receives the order preservation request message sent by the first transmission party, where the order preservation request message carries a first identifier and a second identifier, where the first identifier indicates a message sequence number of a first sent application message in the at least one application message, and the second identifier indicates a message sequence number of a last sent application message in the at least one application message; The second transmission party transmits an order-preserving response message to the first transmission party based on the recorded target message sequence number; The order-preserving request message and the order-preserving response message are used to ensure the transmission integrity of the at least one application message.
12. The method according to claim 11, characterized in that The second transmission party transmits the sequence preservation response message to the first transmission party based on the recorded target message sequence number, including: The second transmitting party determines a third identifier based on the recorded target message sequence number, where the third identifier indicates a message sequence number of a missing application message between the first sent application message and the last sent application message; The second transmitting party records the third identifier; The second transmission party transmits the sequence preservation response message carrying the third identifier to the first transmission party.
13. The method according to claim 12, characterized in that After the second transmission party transmits the sequence preservation response message carrying the third identifier to the first transmission party, the method further includes: The second transmission party receives the missing application message sent by the first transmission party, where the missing application message carries a message sequence number; After receiving all missing application messages indicated by the third identifier, the second transmitting party deletes the third identifier.
14. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or an instruction, and when the program or the instruction is executed by the processor, the method according to any one of claims 1 to 13 is implemented.
15. A readable storage medium, characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the method according to any one of claims 1 to 13 is implemented.
16. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 13 when the computer program is executed by a processor.