Communication error correction method and device, computer equipment and storage medium

By performing XOR operations and reassembly on the messages at the receiving end, the communication error problem of operating machinery in harsh environments is solved, the communication error rate is reduced, and the correctness and security of data packets are improved.

CN120956383APending Publication Date: 2025-11-14SANY AUTOMOBILE HOISTING MACHINERY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410589507.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In harsh communication environments, serial communication between the operating machinery and the server is prone to errors, leading to frequent anomalies that cannot be effectively corrected by existing technologies.

Method used

The receiving end performs an XOR operation on the message to extract the data segment and checksum. If the XOR result does not match the checksum, the message is reassembled. If they match, a reply message is sent to ensure the correctness of the data packet.

Benefits of technology

It effectively solves the problems of occasional data reversal and packet merging, reduces the communication error rate, and improves the reliability and security of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956383A_ABST
    Figure CN120956383A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electronic communication, and discloses a communication error correction method and device, computer equipment and a storage medium, and the method comprises the steps: receiving a current message transmitted by a transmitting end; extracting a data segment and a check code between the start character and the end character in the current message; performing exclusive-or operation based on the data segments to obtain an exclusive-or result; and if the XOR result is detected to be inconsistent with the check code, acquiring a previous message received before the current message is received, intercepting and splicing based on the previous message and the current message to obtain a new message, and sending the new message to the server. Taking the new message as the current message and returning to the step of extracting the data segment and the check code between the starting character and the ending character in the current message; and if the XOR result is detected to be consistent with the check code, replying to the current message. According to the invention, the message content is subjected to XOR verification, and the error message is packed, so that the problems of accidental data reversal and packet sticking are effectively solved, and the error rate of communication is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic communication technology, and more specifically to communication error correction methods, devices, computer equipment, and storage media. Background Technology

[0002] In some scenarios with poor communication conditions, there is a high probability of errors in the communication between the operating machinery and the server. At present, the operating machinery does not perform verification and error correction on the serial communication data, which leads to frequent occurrences of abnormal serial communication of the whole vehicle, occasional failure to execute commands, and abnormal operation.

[0003] Currently, when performing error correction on serial communication data, related technologies often determine whether the transmitted data is valid based on predefined start characters, end characters, and data length. Data exchange is only performed when the data is valid.

[0004] However, traditional methods also have a high error rate during machine communication. This is because data can occasionally be flipped during communication, for example, a 1 becomes a 0. The data length remains the same, but the data content has changed, and the data packet must be discarded. In addition, serial communication is prone to packet merging, where the data of the next packet may be attached to the previous packet. If data length is still used for validity verification, it is very likely to result in incorrect data packet results, leading to the wrong discarding of some data packets. Summary of the Invention

[0005] In view of this, the present invention provides a communication error correction method, device, computer equipment and storage medium to solve the problem of high error rate in traditional communication methods for machinery.

[0006] In a first aspect, the present invention provides a communication error correction method applied at a receiving end, the method comprising:

[0007] Receive the current message transmitted by the sender;

[0008] Extract the data segment and checksum located between the start character and the end character in the current message. The start character and the end character are predefined.

[0009] Perform an XOR operation on the data segment to obtain the XOR result;

[0010] If the XOR result is found to be inconsistent with the check code, the previous message received before the current message is received is obtained. Based on the previous message and the current message, the message is truncated and concatenated to obtain a new message. The new message is used as the current message and the process returns to the step of extracting the data segment and check code located between the start character and the end character in the current message.

[0011] If the XOR result matches the checksum, a reply is sent to the current message.

[0012] By extracting the data segment and checksum from the current message, performing an XOR check on the data segment, and determining the correctness and validity of the current data packet, if the check fails, the previous message and the current message are reassembled to obtain a new message, and an XOR check is performed on the new message. This effectively solves the problem of occasional data reversal and packet merging, and reduces the error rate of communication.

[0013] In one optional implementation, performing an XOR operation on the data segment to obtain the XOR result includes:

[0014] The data segment is divided into multiple sub-data segments of the same length arranged in order, and the length of each sub-data segment is equal to the length of the check code.

[0015] The XOR values ​​between multiple sub-data segments are calculated sequentially to obtain the XOR result.

[0016] This allows for the XOR operation on the data segment to obtain the XOR result, which can then be compared with the checksum to determine the correctness and validity of the message, effectively solving the problem of occasional data reversal.

[0017] In one optional implementation, a new message is obtained by truncating and concatenating the previous message and the current message, including:

[0018] Based on the endpoint in the previous message and the start character closest to the endpoint, the first character segment is extracted;

[0019] Based on the start point and the nearest end character in the current message, the second character segment is extracted;

[0020] The first and second character segments are concatenated to obtain a new message.

[0021] Therefore, when an XOR result is detected to be inconsistent with the checksum, the communication data is reassembled by combining the current message and the previous message, effectively solving the problem of packet merging and reducing the communication error rate.

[0022] In one optional implementation, the message consists of a start character, a data segment, a checksum, and an end character in sequence; extracting the data segment and checksum located between the start character and the end character in the current message includes:

[0023] Based on the current message, obtain the predefined start and end characters;

[0024] The first n characters between the start character and the end character are used as the data segment;

[0025] The characters located between the start character and the end character, from the (n+1)th to the (n+m)th position, are used as the check code, where m and n are both positive integers, and n is a positive integer multiple of m.

[0026] This allows for the direct extraction of data segments and checksums from the message structure, facilitating subsequent XOR verification of the message and simplifying the data processing procedure.

[0027] In one alternative implementation, replying to the current message includes:

[0028] Generate a data segment for reply based on the current message;

[0029] The data segment used for reply is divided into multiple sub-data segments arranged in order, each sub-data segment having a character length of m;

[0030] The XOR values ​​between multiple sub-data segments used for reply are calculated sequentially to obtain the check code used for reply verification. The character length of the check code is m.

[0031] The start character, the data segment used for reply, the checksum used for reply verification, and the end character are concatenated to obtain the reply message corresponding to the current message.

[0032] When the receiving end replies to the current message, it also generates a reply message according to the defined message format, so that the sending end can verify the reply message and ensure the data is standardized.

[0033] In an alternative implementation, before receiving the current message transmitted by the sender, the method further includes:

[0034] Continuously receive and save message data transmitted by the sender, and count the number of saved messages;

[0035] When the number of messages reaches the preset number, execute the step of receiving the current message transmitted by the sending end;

[0036] Retrieve the previous message received before the current message was received, including:

[0037] Based on the saved message data transmitted by the sender, the previous message received before the current message was received can be obtained.

[0038] This avoids unnecessary calculations and processing by receiving the current message from the sender only when the number of received messages reaches a preset number.

[0039] In one alternative implementation, after detecting that the XOR result is inconsistent with the checksum, the method further includes: incrementing the number of recorded error messages by one;

[0040] Before replying to the current message, the method also includes:

[0041] Determine if the number of error messages exceeds the preset number of error messages;

[0042] If the number of error messages exceeds the preset number of error messages, stop responding to the current message.

[0043] By stopping responses to the current message when the number of error messages exceeds the preset limit, the severity of the operational scenario is taken into account while ensuring the security of the communication process.

[0044] In a second aspect, the present invention provides a communication error correction device applied at a receiving end, the device comprising:

[0045] The receiving module is used to receive the current message transmitted by the sending end;

[0046] The first processing module is used to extract the data segment and checksum located between the start character and the end character in the current message, wherein the start character and the end character are predefined;

[0047] The second processing module is used to perform an XOR operation based on the data segment to obtain the XOR result.

[0048] The third processing module is used to obtain the previous message received before receiving the current message if the XOR result is detected to be inconsistent with the check code, and to perform truncation and splicing based on the previous message and the current message to obtain a new message, and to use the new message as the current message and return to the step of extracting the data segment and check code located between the start character and the end character in the current message.

[0049] The fourth processing module is used to reply to the current message if the XOR result is found to match the checksum.

[0050] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the communication error correction method of the first aspect or any corresponding embodiment described above.

[0051] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the communication error correction method of the first aspect or any corresponding embodiment thereof.

[0052] The beneficial effects of this invention are as follows:

[0053] By extracting the data segment and checksum from the current message, performing an XOR check on the data segment, and determining the correctness and validity of the current data packet, if the check fails, the previous message and the current message are reassembled to obtain a new message, and an XOR check is performed on the new message. This effectively solves the problem of occasional data reversal and packet merging, and reduces the error rate of communication. Attached Figure Description

[0054] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0055] Figure 1 This is a flowchart illustrating a communication error correction method according to an embodiment of the present invention;

[0056] Figure 2 This is a flowchart illustrating another communication error correction method according to an embodiment of the present invention;

[0057] Figure 3 This is a schematic diagram illustrating the structure of a message data packet according to an embodiment of the present invention;

[0058] Figure 4 This is a schematic diagram of a current message and a previous message packet according to an embodiment of the present invention;

[0059] Figure 5 This is a structural block diagram of a communication error correction device according to an embodiment of the present invention;

[0060] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0062] During communication, data may occasionally be flipped, for example, 1 becomes 0. The data length remains the same, but the data content has changed, and the data packet should be discarded. In addition, serial communication may experience packet merging, where the data of the next packet may be attached to the previous packet. If the validity is still checked using the data length, it is very likely that the data packet will be incorrect, causing some data packets to be discarded incorrectly.

[0063] Therefore, embodiments of the present invention provide a communication method that performs XOR verification on received messages, and reassembles erroneous packets when the verification fails, thereby verifying and reassembling communication data and reducing the error rate of communication.

[0064] According to an embodiment of the present invention, a communication error correction method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0065] This embodiment provides a communication error correction method, which can be used at the receiving end of receiving communication data, such as a server, operating machinery, etc. Figure 1 This is a flowchart of a communication error correction method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0066] Step S101: Receive the current message transmitted by the sending end.

[0067] For example, the receiving end can be the server where the server is located or the client where the operating machinery is located. When the server is the sending end, then the client is the receiving end; when the client is the sending end, then the server is the receiving end. This embodiment of the invention is described with the server as the receiving end.

[0068] Specifically, because the operating environment of the machinery is relatively harsh, each message sent by the client may not be complete and valid. Therefore, the server does not verify and execute the message as soon as it receives it from the client. Instead, it verifies the message sent by the client after saving a certain number of messages, thereby avoiding useless calculations and processing.

[0069] In some optional implementations, the receiving end (server) continuously receives and saves the message data transmitted by the sending end (client), counts the number of saved messages, and when the number of messages reaches a preset number, it then receives the current message transmitted by the sending end (client). The preset number of messages can be 20, but can be set according to operational requirements; this invention is not limited to this.

[0070] Step S102: Extract the data segment and checksum located between the start character and the end character in the current message. The start character and the end character are predefined.

[0071] Specifically, the message consists of a start character, a data segment, a checksum, and an end character in sequence. The start character and the end character are predefined character segments, such as starting with 'ADAD' and ending with 'BCBC'. The data segment is a character segment containing valid communication data content, and the checksum is a character segment calculated based on the data segment for verification.

[0072] For example, the start and end characters can be obtained by matching queries in the message, and then the data segment and checksum can be obtained by the number of predefined data segments and checksums in the message.

[0073] In some alternative implementations, the receiver and sender can each define their own start and end characters to facilitate differentiation between the sender and receiver of a message.

[0074] Step S103: Perform an XOR operation on the data segment to obtain the XOR result.

[0075] Specifically, the data segment is XORed, and the XOR result is compared with the extracted check code. If they do not match, step S104 is executed; if they match, step S105 is executed.

[0076] Step S104: If the XOR result is found to be inconsistent with the check code, the previous message received before the current message is received is obtained, and the previous message and the current message are truncated and concatenated to obtain a new message. The new message is then used as the current message and the process returns to step S102.

[0077] Specifically, if the calculated XOR result is inconsistent with the extracted checksum, it indicates that the message data corresponding to the current message surrounds an erroneous packet. The current message and the previous message are reassembled to obtain a new message. The new message is then subjected to XOR verification, thereby reassembling and verifying the communication data and reducing the communication error rate.

[0078] Step S105: If the XOR result is found to match the checksum, then reply to the current message.

[0079] Specifically, after each detected mismatch between the XOR result and the checksum, the receiving end increments the recorded error message count by one. Before replying to the current message, the receiving end checks whether the error message count exceeds a preset error message count. If it does, it stops replying to the current message. For example, the preset error message count can be 3, but this embodiment of the invention is not limited to this.

[0080] In theory, the client and server use a question-and-answer approach. However, considering the harsh working environment of the machinery and the potential for data packet errors, for example, once communication begins, even if the client sends three consecutive erroneous data packets, the server will still reply with the latest valid data packet. But if the client sends more than three consecutive erroneous data packets, the server will stop replying. This approach takes into account both the harshness of the working environment and the security of the communication process.

[0081] The communication error correction method provided in this embodiment extracts the data segment and checksum from the current message, performs XOR check on the data segment to determine the correctness and validity of the current data packet. If the check fails, the previous message and the current message are reassembled to obtain a new message, and XOR check is performed on the new message. This effectively solves the problem of occasional data reversal and packet merging, and reduces the error rate of communication.

[0082] This embodiment provides a communication error correction method, which can be used at the receiving end of receiving communication data, such as a server, operating machinery, etc. Figure 2 This is a flowchart of a communication error correction method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0083] Step S201: Receive the current message transmitted by the sending end. For details, please refer to [link to relevant documentation]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.

[0084] Step S202: Extract the data segment and checksum located between the start character and the end character in the current message. The start character and the end character are predefined.

[0085] Specifically, the message consists of a start character, a data segment, a checksum, and an end character in sequence, and step S202 above includes:

[0086] Step a1: Based on the current message, obtain the predefined start character and end character.

[0087] Step a2: Take the first n characters between the start character and the end character as the data segment.

[0088] Step a3: Use the characters from position n+1 to position n+m between the start character and the end character as the check code.

[0089] Where m and n are both positive integers, and n is a positive integer multiple of m. For example, the value of m is 4.

[0090] For example, such as Figure 3As shown, the server receives 20 message data packets sent by the client. Each data packet consists of a start character field, a data field, a check field, and an end character field. Therefore, according to the defined message format, the checksum and the data field containing valid communication data in the data packet can be obtained.

[0091] This allows for the direct extraction of data segments and checksums from the message structure, facilitating subsequent XOR verification of the message and simplifying the data processing procedure.

[0092] Step S203: Perform an XOR operation on the data segment to obtain the XOR result.

[0093] Specifically, step S203 includes:

[0094] Step S2031: The data segment is divided into multiple sub-data segments with the same character length arranged in order. The length of the sub-data segments is equal to the character length of the check code.

[0095] For example, if the character length of the verification code is m, then the data segment is divided into multiple sub-data segments with a character length of m, ensuring that the XOR result calculated based on the data segments can be compared with the extracted verification code.

[0096] Step S2032: Calculate the XOR values ​​between multiple sub-data segments in sequence to obtain the XOR result.

[0097] For example, starting from the first sub-data segment, the current sub-data segment is bitwise XORed with the next sub-data segment to obtain the current XOR value. The current XOR value is then sequentially XORed with the subsequent sub-data segments to update the current XOR value. This process continues until the last sub-data segment is XORed with the last sub-data segment. Finally, the updated current XOR value is used as the XOR result.

[0098] This allows for the XOR operation on the data segment to obtain the XOR result, which can then be compared with the checksum to determine the correctness and validity of the message, effectively solving the problem of occasional data reversal.

[0099] Step S204: If the XOR result is found to be inconsistent with the check code, the previous message received before the current message is received is obtained, and the previous message and the current message are truncated and concatenated to obtain a new message. The new message is then used as the current message and the process returns to step S202.

[0100] Specifically, step S204 includes:

[0101] Step S2041: If the XOR result is found to be inconsistent with the checksum, then the previous message received before the current message is received is obtained.

[0102] Specifically, before executing step S201, the receiving end continuously receives and saves the message data transmitted by the sending end. For example... Figure 4 As shown, if the verification of the current Nth message data packet fails (the XOR result is inconsistent with the checksum), the previous message received before receiving the current message is retrieved from the saved message data to obtain the N-1th message data packet.

[0103] Step S2042: Based on the end point in the previous message and the start character closest to the end point, extract the first character segment. Based on the start point in the current message and the end character closest to the start point, extract the second character segment. Concatenate the first character segment and the second character segment to obtain a new message. Use the new message as the current message and return to step S202.

[0104] For example, see again Figure 4 The first character segment is the content between the start character closest to the end in the (N-1)th message data packet and the end character. The second character segment is the content between the start character and the end character closest to the start in the Nth message data packet. The first and second character segments are combined to form a new message.

[0105] Therefore, when an XOR result is detected to be inconsistent with the checksum, the communication data is reassembled by combining the current message and the previous message, effectively solving the problem of packet merging and reducing the communication error rate.

[0106] Step S205: If the XOR result is found to match the checksum, then reply to the current message.

[0107] Specifically, step S205 includes:

[0108] Step b1: Generate a data segment for reply based on the current message.

[0109] Step b2 involves dividing the data segment used for reply into multiple sequentially arranged sub-data segments for reply, each sub-data segment having a character length of m.

[0110] Step b3: Calculate the XOR values ​​between multiple sub-data segments used for reply in sequence to obtain the check code used for reply verification. The character length of the check code is m.

[0111] Step b4: Concatenate the start character, the data segment used for reply, the checksum used for reply verification, and the end character to obtain the reply message corresponding to the current message.

[0112] Specifically, when the receiving end replies to the current message, it also generates a reply message according to the defined message format, so that the sending end can verify the reply message and ensure the data is standardized.

[0113] The communication error correction method provided in this embodiment extracts the data segment and checksum from the current message through the message structure, which facilitates XOR verification of the data segment to determine the correctness and validity of the current data packet. This effectively solves the problem of occasional data rollover. If the verification fails, the previous message and the current message are reassembled to obtain a new message. XOR verification is then performed on the new message, which effectively solves the problem of data packet merging and reduces the error rate of communication.

[0114] The communication error correction method of the present invention will be described in detail below with reference to a specific application example. This specific application example is applied to a communication system consisting of a server and a client, taking the client as the sender and the server as the receiver as an example. The application example includes the following steps:

[0115] Step 1: Define the start and end characters for the server and client.

[0116] Step 2: When sending a message, the server performs an XOR operation on the first n characters from the start character to the end character, and fills the nth, n+1th, n+2th, and n+3rd characters with the XOR result as the checksum. Similarly, when sending a message, the client performs an XOR operation on the first n characters from the start character to the end character, and fills the nth, n+1th, n+2th, and n+3rd characters with the XOR result as the checksum.

[0117] Step 3, taking the server side as an example, the server receives the message sent by the client, performs an XOR check on the message by extracting the data segment and checksum in the message to determine whether the message is correct or not. If it is a correct message, the message command is executed. The server saves the messages sent by the client, saving the latest 20 messages. If the server determines that the current message sent by the client is an abnormal message, it finds the previous message sent by the client, extracts the content A after the nearest start character of the previous message and extracts the content B before the nearest end character of the current message. A+B form a new data packet, and the data packet is judged to be correct or not. If it is correct, the message command is executed.

[0118] Theoretically, the client and server use a question-and-answer mechanism. However, considering the harsh working environment of the machinery and the potential for data packet errors, once communication begins, even if the client sends three consecutive erroneous data packets, the server will still reply with the latest valid data packet. But if the client sends more than three consecutive erroneous data packets, the server will no longer reply with data packets.

[0119] By performing XOR verification on valid communication data and reassembling erroneous packets, the error rate of communication is reduced.

[0120] This embodiment also provides a communication error correction device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0121] This embodiment provides a communication error correction device, such as... Figure 5 As shown, it includes:

[0122] The receiving module 501 is used to receive the current message transmitted by the sending end;

[0123] The first processing module 502 is used to extract the data segment and check code located between the start character and the end character in the current message, wherein the start character and the end character are predefined;

[0124] The second processing module 503 is used to perform an XOR operation based on the data segment to obtain the XOR result.

[0125] The third processing module 504 is used to obtain the previous message received before receiving the current message if the XOR result is detected to be inconsistent with the check code, and to perform truncation and splicing based on the previous message and the current message to obtain a new message, and to use the new message as the current message and return to the step of extracting the data segment and check code located between the start character and the end character in the current message.

[0126] The fourth processing module 505 is used to reply to the current message if the XOR result is found to match the check code.

[0127] In some optional implementations, the message consists of a start character, a data segment, a checksum, and an end character in sequence; the first processing module 502 is further configured to:

[0128] Based on the current message, obtain the predefined start and end characters;

[0129] The first n characters between the start character and the end character are used as the data segment;

[0130] The characters located between the start character and the end character, from the (n+1)th to the (n+m)th position, are used as the check code, where m and n are both positive integers, and n is a positive integer multiple of m.

[0131] In some optional implementations, the second processing module 503 is further configured to:

[0132] The data segment is divided into multiple sub-data segments of the same length arranged in order, and the length of each sub-data segment is equal to the length of the check code.

[0133] The XOR values ​​between multiple sub-data segments are calculated sequentially to obtain the XOR result.

[0134] In some optional implementations, before receiving the current message transmitted by the sending end, the device is further configured to: continuously receive and save the message data transmitted by the sending end, and count the number of saved messages; when the number of messages reaches a preset number, execute the step of receiving the current message transmitted by the sending end; the third processing module 504 is further configured to: obtain the previous message received before receiving the current message based on the saved message data transmitted by the sending end.

[0135] In some optional implementations, the third processing module 504 is further configured to:

[0136] Based on the end point in the previous message and the start character closest to the end point, the first character segment is extracted; based on the start point in the current message and the end character closest to the start point, the second character segment is extracted; the first and second character segments are concatenated to obtain a new message.

[0137] In some optional implementations, the fourth processing module 505 is further configured to:

[0138] Generate a data segment for reply based on the current message;

[0139] The data segment used for reply is divided into multiple sub-data segments arranged in order, each sub-data segment having a character length of m;

[0140] The XOR values ​​between multiple sub-data segments used for reply are calculated sequentially to obtain the check code used for reply verification. The character length of the check code is m.

[0141] The start character, the data segment used for reply, the checksum used for reply verification, and the end character are concatenated to obtain the reply message corresponding to the current message.

[0142] In some optional implementations, the third processing module 504 is further configured to increment the number of recorded error messages by one after detecting that the XOR result is inconsistent with the checksum; the fourth processing module 505 is further configured to:

[0143] Determine if the number of error messages exceeds the preset number of error messages;

[0144] If the number of error messages exceeds the preset number of error messages, stop responding to the current message.

[0145] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0146] In this embodiment, the communication error correction device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0147] This invention also provides a computer device having the above-described features. Figure 5 The communication error correction device shown.

[0148] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 6 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 6 Take a processor 10 as an example.

[0149] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0150] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0151] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0152] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0153] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0154] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0155] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0156] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A communication error correction method, characterized in that, Applied to the receiving end, the method includes: Receive the current message transmitted by the sender; Extract the data segment and checksum located between the start character and the end character in the current message, where the start character and the end character are predefined; Perform an XOR operation on the data segment to obtain the XOR result; If the XOR result is found to be inconsistent with the check code, the previous message received before the current message is received is obtained, and the previous message and the current message are truncated and concatenated to obtain a new message. The new message is used as the current message and the process returns to the step of extracting the data segment and check code located between the start character and the end character in the current message. If the XOR result is found to match the checksum, a reply is sent to the current message.

2. The method according to claim 1, characterized in that, The step of performing an XOR operation based on the data segment to obtain the XOR result includes: The data segment is divided into multiple sub-data segments of the same character length arranged in sequence, and the length of each sub-data segment is equal to the character length of the check code. The XOR values ​​between the multiple sub-data segments are calculated sequentially to obtain the XOR result.

3. The method according to claim 2, characterized in that, The process of extracting and concatenating the previous message and the current message to obtain a new message includes: Based on the endpoint in the previous message and the start character closest to the endpoint, the first character segment is extracted; Based on the start point and the nearest end character in the current message, the second character segment is extracted; The first and second character segments are concatenated to obtain a new message.

4. The method according to claim 1, characterized in that, The message consists of a start character, a data segment, a checksum, and an end character in sequence; the step of extracting the data segment and checksum located between the start character and the end character in the current message includes: Based on the current message, obtain the predefined start character and end character; The first n characters between the start character and the end character are taken as the data segment; The characters located between the start character and the end character, from the (n+1)th to the (n+m)th position, are used as the check code, where m and n are both positive integers, and n is a positive integer multiple of m.

5. The method according to claim 4, characterized in that, The reply to the current message includes: Generate a data segment for reply based on the current message; The data segment used for reply is divided into multiple sub-data segments for reply arranged in order, and the character length of each sub-data segment is m; The XOR values ​​between multiple sub-data segments used for reply are calculated sequentially to obtain a check code used for reply verification, wherein the character length of the check code is m; The start character, the data segment used for reply, the checksum used for reply verification, and the end character are concatenated to obtain the reply message corresponding to the current message.

6. The method according to claim 1, characterized in that, Before receiving the current message transmitted by the sender, the method further includes: Continuously receive and save message data transmitted by the sender, and count the number of saved messages; When the number of messages reaches a preset number, the step of receiving the current message transmitted by the sending end is executed; The step of obtaining the previous message received before receiving the current message includes: Based on the saved message data transmitted by the sending end, the previous message received before the current message was received is obtained.

7. The method according to claim 1 or 6, characterized in that, After detecting that the XOR result is inconsistent with the checksum, the method further includes: incrementing the number of recorded error messages by one; Before replying to the current message, the method further includes: Determine if the number of error messages exceeds the preset number of error messages; If the number of error messages exceeds the preset number of error messages, stop responding to the current message.

8. A communication error correction device, characterized in that, Applied to the receiving end, the device includes: The receiving module is used to receive the current message transmitted by the sending end; The first processing module is used to extract the data segment and checksum located between the start character and the end character in the current message, wherein the start character and the end character are predefined; The second processing module is used to perform an XOR operation based on the data segment to obtain the XOR result. The third processing module is used to obtain the previous message received before receiving the current message if the XOR result is detected to be inconsistent with the check code, and to perform truncation and splicing based on the previous message and the current message to obtain a new message, and to use the new message as the current message and return to the step of extracting the data segment and check code located between the start character and the end character in the current message. The fourth processing module is used to reply to the current message if the XOR result is detected to be consistent with the check code.

9. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the communication error correction method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the communication error correction method according to any one of claims 1 to 7.