Message communication method and device, electronic equipment and storage medium

By processing and labeling the received message frames for abnormal types, the problem of decreased communication equipment stability and data loss caused by abnormal message frames is solved, achieving more efficient data transmission and reducing user losses.

CN117579512BActive Publication Date: 2026-11-24YUSUR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311611322.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-29
Publication Date
2026-11-24
Estimated Expiration
2043-11-29

AI Technical Summary

Technical Problem

The frequent occurrence of abnormal message frames in the existing technology leads to a decrease in the stability of communication equipment, and directly discarding abnormal message frames will result in a large amount of data loss, causing losses to users.

Method used

The received message frames are inspected to determine whether they are abnormal frames, and are processed according to the abnormality type, such as repairing missing or redundant frame headers and tails, adjusting data lengths, etc. After generating an abnormality flag, the processed frames are stored, and the decision on which frames to send to the data receiver is made according to filtering rules.

Benefits of technology

It reduces data loss, improves the stability and transmission efficiency of communication equipment, and avoids user losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117579512B_ABST
    Figure CN117579512B_ABST
Patent Text Reader

Abstract

This application provides a message communication method, apparatus, electronic device, and storage medium. The method includes: receiving multiple message frames included in a message; checking each message frame to determine whether it is an abnormal message frame; if the message frame is an abnormal message frame, processing the message frame according to the abnormality type, and storing the processed message frame through a message storage unit when the processed message frame is obtained; if the message frame is a normal message frame, storing the message frame through the message storage unit; according to the abnormality identifier included in the processed message frame, writing the storage address of the processed message frame whose abnormality identifier satisfies the filtering rules into the address set in the address storage unit, and writing the storage address of the message frame determined to be a normal message frame into the address set; and after receiving a data acquisition request for the message, sending the message frame whose corresponding storage address is located in the address set to the data receiving end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communications, and more particularly to a message communication method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the continuous improvement of communication network bandwidth and the increasing trend of inter-device communication towards multi-threading, multi-core, and multi-dimensional approaches, message communication between communication devices and between communication modules within communication devices is becoming more frequent. Consequently, the frequency of abnormal message frames has also increased significantly, greatly affecting the stability of communication devices. In related technologies, abnormal message frames are generally discarded directly to avoid adverse effects on the communication device. However, directly discarding abnormal message frames results in significant data loss, causing substantial losses for users. Summary of the Invention

[0003] In view of this, embodiments of this application provide a message communication method, apparatus, electronic device, and storage medium to solve the above problems.

[0004] According to a first aspect of the embodiments of this application, a message communication method is provided, comprising: receiving a plurality of message frames included in a message, and checking each message frame to determine whether the message frame is an abnormal message frame; if the message frame is an abnormal message frame, processing the message frame according to the abnormality type of the message frame, and storing the processed message frame through a message storage unit when the processed message frame is obtained; if the message frame is a normal message frame, storing the message frame through the message storage unit; according to the abnormality identifier included in the processed message frame, writing the storage address of the processed message frame whose abnormality identifier satisfies the filtering rules into an address set in an address storage unit, and writing the storage address of the message frame determined to be a normal message frame into the address set, wherein the abnormality identifier is used to indicate the abnormality type of the message frame; after receiving a data acquisition request for the message, sending the message frame whose corresponding storage address is located in the address set to a data receiving end according to the data acquisition request.

[0005] In one possible implementation, processing the message frame according to the exception type of the message frame includes: if the message frame lacks a frame header identifier, then discarding the message frame; and / or, if the message frame includes multiple consecutive frame header identifiers, deleting the frame header identifiers before the last frame header identifier in the message frame, and adding a first exception identifier to the message frame to obtain a processed message frame, wherein the first exception identifier is an exception identifier indicating that the message frame includes multiple consecutive frame header identifiers.

[0006] In one possible implementation, processing the message frame according to the exception type of the message frame includes: if the message frame lacks a frame tail identifier, then adding a frame tail identifier to the end of the message frame and adding a second exception identifier to the message frame to obtain a processed message frame; and / or, if the message frame includes multiple consecutive frame tail identifiers, then deleting the frame tail identifiers after the first frame tail identifier and adding a third exception identifier to the message frame to obtain a processed message frame; wherein the second exception identifier is an exception identifier indicating that the message frame lacks a frame tail identifier, and the third exception identifier is an exception identifier indicating that the message frame includes multiple consecutive frame tail identifiers.

[0007] In one possible implementation, processing the message frame according to the exception type of the message frame includes: if the data length of the message frame is less than a length threshold, then adding a fourth exception identifier to the message frame to obtain a processed message frame, wherein the fourth exception identifier is an exception identifier indicating that the data length of the message frame is less than the length threshold.

[0008] In one possible implementation, processing the message frame according to the anomaly type of the message frame includes: if the data length of the message frame is greater than a length threshold, discarding the portion of the message frame after the frame header that exceeds the length threshold, and adding a frame tail identifier and a fifth anomaly identifier to the remaining portion of the message frame to obtain a processed message frame; wherein, the fifth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is greater than the length threshold.

[0009] In one possible implementation, upon obtaining a processed message frame, the processed message frame is stored in a message storage unit, including: after obtaining the processed message frame, deleting the frame header identifier and frame trailer identifier of the processed message frame to obtain a first message frame field, and storing the first message frame field in the message storage unit; and if the message frame is a normal message frame, the message frame is stored in the message storage unit, including: if the message frame is a normal message frame, deleting the frame header identifier and frame trailer identifier of the message frame to obtain a second message frame field, and storing the second message frame field in the message storage unit.

[0010] In one possible implementation, the method further includes: detecting the read / write status of the message storage unit; if the ratio of the read speed to the write speed of the message storage unit is less than a preset threshold, then discarding message frames that meet preset discard conditions.

[0011] According to a second aspect of the embodiments of this application, a message communication apparatus is provided, comprising: a receiving and judging module, configured to receive a plurality of message frames included in a message, and to check each message frame respectively to judge whether the message frame is an abnormal message frame; a first storage module, configured to, when the message frame is an abnormal message frame, process the message frame according to the abnormality type of the message frame, and, upon obtaining the processed message frame, store the processed message frame through a message storage unit; and, when the message frame is a normal message frame, store the message frame through the message storage unit. The first storage module stores the frames; the second storage module is used to write the storage addresses of the processed message frames whose exception identifiers satisfy the filtering rules into the address set in the address storage unit, and to write the storage addresses of the message frames determined to be normal message frames into the address set, wherein the exception identifier is used to indicate the exception type of the message frame; the transmission module is used to send the message frames whose corresponding storage addresses are located in the address set to the data receiving end according to the data acquisition request after receiving the data acquisition request for the message.

[0012] According to a third aspect of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, the executable instruction causing the processor to perform the method as described in any embodiment of the first aspect above.

[0013] According to a fourth aspect of the present application, a computer storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the method described in any of the embodiments of the first aspect above.

[0014] In this embodiment, after detecting abnormal message frames within a message, the message frames can be processed according to their abnormality type to obtain processed message frames that can be read normally. This avoids discarding all abnormal message frames. Subsequently, based on filtering rules, the storage addresses of which message frames in the processed message frames are written into the address set in the address storage unit. This allows these message frames to be sent to the data receiving end upon receiving a data acquisition request for the message, thereby reducing data loss during transmission and preventing significant losses for the user. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0016] Figure 1 This is a flowchart illustrating the steps of a message communication method provided in an embodiment of this application;

[0017] Figure 2 This is a schematic diagram of a process for detecting and processing message frames according to an embodiment of this application;

[0018] Figure 3 This is a schematic diagram of another process for detecting and processing message frames according to an embodiment of this application;

[0019] Figure 4 This is a schematic diagram illustrating another embodiment of the present application for detecting and processing message frames;

[0020] Figure 5 This is a schematic diagram of the data processing flow of a message communication method provided in an embodiment of this application;

[0021] Figure 6 This is a structural block diagram of a message communication device provided in an embodiment of this application;

[0022] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; Detailed Implementation

[0023] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.

[0024] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0025] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0026] A first aspect of this application provides a message communication method to solve the above-mentioned problems.

[0027] like Figure 1 As shown, the message communication method provided in this application includes:

[0028] S101: Receive multiple message frames included in the message, and check each message frame to determine whether the message frame is an abnormal message frame.

[0029] In this embodiment, the presence of anomalies in a message frame can be determined by detecting the frame header, frame trailer, and the amount of data contained in the message frame. It should be understood that the message frame in this application refers to a data frame, which includes a frame header, a data portion, and a frame trailer. The frame header and frame trailer may contain necessary control information, such as synchronization information, address information, and error control information; the data portion contains the message data included in the message frame. The specific structure of the message frame can be found in related technologies and will not be elaborated here.

[0030] S102: If the message frame is an abnormal message frame, the message frame is processed according to the abnormal type of the message frame, and the processed message frame is stored in the message storage unit when the processed message frame is obtained.

[0031] When an anomaly is detected in a message frame, embodiments of this application can process the message frame according to the anomaly type. For example, the message frame can be repaired according to the anomaly type so that it can be processed normally in subsequent operations. Furthermore, an anomaly flag can be added to the message frame to indicate the anomaly type. The message storage unit and the address storage unit below it can be random access memory (RAM), floppy disk, hard disk, or magneto-optical disk, or other suitable storage devices, all of which are within the protection scope of embodiments of this application.

[0032] S103: If the message frame is a normal message frame, then the message frame is stored through the message storage unit.

[0033] S104: Based on the anomaly identifiers included in the processed message frames, write the storage addresses of processed message frames whose anomaly identifiers satisfy the filtering rules into the address set in the address storage unit, and write the storage addresses of message frames determined to be normal message frames into the address set. The anomaly identifiers are used to indicate the anomaly type of the message frame.

[0034] Filtering rules can instruct which exception identifiers' corresponding message frame storage addresses should be written into the address set within the address storage unit. Since the message frame corresponding to that address is sent to the downstream data receiver when the storage address is written into the address set, filtering rules can be set to specify which exception types' processed message frames should be sent to the downstream data receiver, thereby reducing lost message data; and to specify which exception types' processed message frames should be discarded, improving message transmission efficiency. The filtering rules in this embodiment can be set according to user needs, thereby better meeting user requirements and improving user experience.

[0035] S105: Upon receiving a data acquisition request for the above message, the message frame whose corresponding storage address is located in the address set is sent to the data receiving end according to the data acquisition request.

[0036] A data acquisition request can instruct the data receiving end to receive the aforementioned message. Upon receiving the data acquisition request, the storage address written in the address set in step S104 can be read from the address storage unit, and the corresponding message frame can be read from the message storage unit according to the storage address. Then, the message frame whose corresponding storage address is located in the address set can be sent to the data receiving end. In this embodiment, the storage address of the message frame may include information such as the start address, end address, and data length of the message frame stored in the message storage unit, so that the stored message frame can be read from the message storage unit according to the storage address.

[0037] In this embodiment, after detecting abnormal message frames within a message, the message frames can be processed according to their abnormality type to obtain processed message frames that can be read normally. This avoids discarding all abnormal message frames. Subsequently, based on filtering rules, the storage addresses of which message frames in the processed message frames are written into the address set in the address storage unit. This allows these message frames to be sent to the data receiving end upon receiving a data acquisition request for the message, thereby reducing data loss during transmission and preventing significant losses for the user.

[0038] It should be understood that the message communication method provided in this application embodiment can be applied to communication devices such as switches and routers, as well as electronic terminals that can communicate such as mobile phones and computers, and other external communication modules, all of which are within the protection scope of this application embodiment.

[0039] In some optional embodiments, the message frame is processed according to the anomaly type of the message frame, including: if the message frame is missing a frame header identifier, the message frame is discarded; and / or, if the message frame includes multiple consecutive frame header identifiers, the frame header identifiers before the last frame header identifier in the message frame are deleted, and a first anomaly identifier is added to the message frame to obtain a processed message frame, wherein the first anomaly identifier is used to indicate that the message frame includes multiple consecutive frame header identifiers.

[0040] The Start Of Header (SOH) is a marker character located at the beginning of the frame header in a message frame, and the End Of Transmission (EOT) is a marker character located at the end of the frame. They are used to mark the start and end points of the message frame, respectively. Specific methods for setting the SOH and EOT can be found in related technologies and will not be elaborated upon here; all are within the protection scope of the embodiments in this application.

[0041] like Figure 2 As shown in this embodiment, after receiving the message frame, a frame header identifier detection can be performed on the message frame. If the message frame lacks a frame header identifier, the message frame is discarded; if the message frame includes multiple consecutive frame header identifiers, redundant frame header identifiers can be removed and a first anomaly identifier can be added to obtain the processed message frame. Specifically, removing redundant frame header identifiers involves deleting the frame header identifiers before the last one, retaining only the last one among the consecutive frame header identifiers.

[0042] Since the lack of a frame header identifier makes it impossible to determine the start position of the frame, it is impossible to parse the frame correctly based on its header. In this embodiment, when it is determined that a frame is missing a frame header identifier, the frame can be discarded directly without further storage or transmission. This not only improves the efficiency of message transmission but also avoids message parsing errors caused by the missing frame. If it is determined that a frame contains multiple consecutive frame header identifiers, the redundant identifiers can be deleted, thus correcting the abnormal situation of multiple consecutive frame header identifiers and allowing subsequent data retention within the frame, reducing data loss. Furthermore, this embodiment can also mark the abnormal type of a frame containing multiple consecutive frame header identifiers using a first anomaly identifier. This first anomaly identifier allows for easy and convenient identification of the abnormal situation in subsequent processes, improving the efficiency of frame inspection.

[0043] In some optional embodiments, the message frame is processed according to the anomaly type of the message frame, including: if the message frame is missing a frame tail identifier, then a frame tail identifier is added to the end of the message frame, and a second anomaly identifier is added to the message frame to obtain a processed message frame; and / or, if the message frame includes multiple consecutive frame tail identifiers, then the frame tail identifiers after the first frame tail identifier are deleted, and a third anomaly identifier is added to the message frame to obtain a processed message frame; wherein, the second anomaly identifier is an anomaly identifier indicating that the message frame is missing a frame tail identifier, and the third anomaly identifier is an anomaly identifier indicating that the message frame includes multiple consecutive frame tail identifiers.

[0044] like Figure 3 As shown in this embodiment, after receiving the message frame, a frame end identifier detection can be performed on the message frame. If the message frame lacks a frame end identifier, a second anomaly identifier and a frame end identifier can be added to the end of the message frame; if the message frame includes multiple consecutive frame end identifiers, redundant frame end identifiers can be removed and a third anomaly identifier can be added to obtain the processed message frame. Specifically, removing redundant frame end identifiers involves deleting the frame end identifiers after the first frame end identifier in the frame end identifier list, retaining only the first frame end identifier among the consecutive frame end identifiers.

[0045] In this embodiment, when it is determined that a message frame is missing a frame tail identifier, a frame tail identifier is added to the end of the message frame to correct the abnormal situation of the message frame lacking a frame tail identifier. When it is determined that a message frame includes multiple consecutive frame header identifiers, redundant frame tail identifiers can be deleted to correct the abnormal situation of the message frame including multiple consecutive frame header identifiers. This allows the processed message frames corresponding to these two types of abnormalities to be retained in subsequent processes, thereby reducing data loss. Furthermore, this embodiment can also use a second abnormality identifier to mark the abnormal type of a message frame lacking a frame tail identifier, and a third abnormality identifier to mark the abnormal type of a message frame including multiple consecutive frame tail identifiers. This allows for easy and convenient identification of these two abnormal situations in subsequent processes using the second and third abnormality identifiers, improving the efficiency of message frame inspection.

[0046] In some optional embodiments, the message frame is processed according to the anomaly type, including: if the data length of the message frame is less than a length threshold, a fourth anomaly identifier is added to the message frame to obtain a processed message frame, wherein the fourth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is less than the length threshold. And / or, if the data length of the message frame is greater than the length threshold, the portion of the message frame exceeding the length threshold after the frame header identifier is discarded, and a frame tail identifier and a fifth anomaly identifier are added to the remaining portion of the message frame to obtain a processed message frame; wherein the fifth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is greater than the length threshold.

[0047] like Figure 4 As shown in this embodiment, after receiving the message frame, the data length of the message frame can be detected. If the data length of the message frame is less than the length threshold, the message frame can be temporarily left undeleted, and a fourth anomaly flag can be added to the message frame to obtain a processed message frame. If the data length of the message frame is greater than the length threshold, the message frame can be shortened, for example, by discarding / deleting the portion of the message frame exceeding the length threshold after the frame header flag. Then, a frame tail flag and a fifth anomaly flag can be added to the remaining portion of the message frame to obtain a processed message frame. The aforementioned length threshold can be determined based on the maximum number of bytes that the device can transmit at one time during message transmission. For example, the length threshold can be less than the maximum number of bytes so that the data length of the processed message frame after adding the fifth anomaly flag and the frame tail flag does not exceed the maximum number of bytes.

[0048] In this embodiment, when it is determined that the data length of a message frame is less than the length threshold, the message frame can be temporarily left undeleted, and a fourth anomaly flag can be added to the message frame to obtain a processed message frame for later use. When it is determined that the data length of a message frame is greater than the length threshold, the portion of the message frame exceeding the length threshold after the frame header flag can be discarded, reducing the data within the message frame to obtain a processed message frame, which can then be transmitted normally. Therefore, this embodiment can retain the processed message frames corresponding to these two types of anomalies, thereby reducing data loss. Furthermore, this embodiment can also mark the anomaly type of message frame with a data length less than the length threshold using the fourth anomaly flag, and the anomaly type of message frame with a data length greater than the length threshold using the fifth anomaly flag. This allows for easy and convenient identification of these two anomalies in subsequent processes, improving the efficiency of message frame inspection.

[0049] In some optional embodiments, when the processed message frame is obtained, the processed message frame is stored in the message storage unit, including: after obtaining the processed message frame, deleting the frame header identifier and frame trailer identifier of the processed message frame to obtain the first message frame field, and storing the first message frame field in the message storage unit.

[0050] Furthermore, if the message frame is a normal message frame, the message frame is stored in the message storage unit, including: if the message frame is a normal message frame, the frame header identifier and frame trailer identifier of the message frame are deleted to obtain the second message frame field, and the second message frame field is stored in the message storage unit.

[0051] It should be understood that, in the process of sending the message frame whose corresponding storage address is located in the address set to the data receiving end according to the data acquisition request, the frame header identifier and frame trailer identifier can be re-added to the first message frame field and the second message frame field to obtain the previously processed message frame and the message frame determined to be a normal message frame, so as to send the processed message frame and the message frame determined to be a normal message frame to the data receiving end.

[0052] In this embodiment of the application, when storing processed message frames and normal message frames, the frame header identifier and frame tail identifier of the processed message frames and normal message frames can be deleted, so as to save the storage space occupied by the processed message frames and normal message frames and improve the utilization rate of the message storage unit.

[0053] To facilitate understanding of the message processing flow in the embodiments of this application, the following refers to... Figure 5 The following is an optional embodiment illustrating the method provided in this application.

[0054] like Figure 5 As shown, after receiving a message frame, the message frame undergoes frame inspection, which may include frame header identifier detection, frame tail identifier detection, and data length detection. If an abnormal message frame is detected, abnormal frame processing can be performed, including frame header abnormality processing, frame tail abnormality processing, and frame length abnormality processing. It should be understood that frame header abnormalities include missing frame header identifiers and multiple consecutive frame header identifiers; frame tail abnormalities include missing frame tail identifiers and multiple consecutive frame tail identifiers; and frame length abnormalities include data lengths less than or greater than a length threshold. After obtaining the processed message frame, a storage address is generated for the processed message frame.

[0055] If the message frame is determined to be a normal message frame through message frame detection, a storage address can be directly generated for that message frame.

[0056] After generating the storage address, the message frames can be stored according to the storage address. That is, the processed message frames and the message frames determined to be normal message frames are stored into the message storage unit according to the storage address. It should be understood that the storage address in this application embodiment is the storage address corresponding to the storage area within the message storage unit. Also, storage address filtering is performed according to the filtering rules. That is, the storage address of the message frame determined to be normal message frame is selected, and the storage address of the processed message frame whose abnormality identifier meets the filtering rules is selected according to the filtering rules.

[0057] After filtering the message frame addresses, the selected storage addresses can be used for address storage. Specifically, the storage addresses of message frames that are determined to be normal message frames are written into the address set in the address storage unit, and the storage addresses of processed message frames whose exception identifiers meet the filtering rules are written into the address set in the address storage unit.

[0058] Upon receiving a data acquisition request for the message, the system can retrieve the storage address from the address set in the address storage unit according to the data acquisition request, and retrieve the stored data from the message storage unit according to the obtained storage address, thereby obtaining the message frame corresponding to the storage address. The obtained message frame is then sent to the data receiving end indicated by the data acquisition request. Specific implementation methods of this application embodiment can be referred to the above embodiments, and will not be repeated here.

[0059] As an optional implementation, the message communication method provided in this application embodiment may further include: detecting the read / write status of the message storage unit; if the ratio of the read speed of the message storage unit to the write speed of the message storage unit is less than a preset threshold, then message frames that meet the preset discard conditions are discarded.

[0060] The preset discard conditions are used to indicate which type of message frames to discard. For example, message frames with long data lengths can be discarded, or certain abnormal message frames can be discarded, thereby reducing the amount of data that the message storage unit needs to store. It should be understood that the method provided in this application embodiment may include detecting the data length of message frames to identify message frames with long data lengths. When discarding message frames that meet the preset discard conditions, the discarding can be done before storing the message frames that meet the preset discard conditions into the message storage unit, or it can be done after storing the message frames that meet the preset discard conditions into the message storage unit, by discarding the storage address of the message frames that meet the preset discard conditions. Both are within the protection scope of this application embodiment. The preset threshold can be set according to the read / write capability of the message storage unit to enable the storage unit to maintain a fast read / write speed.

[0061] It should be noted that in some optional embodiments, the packet traffic size can also be detected. If the packet traffic exceeds a traffic threshold, the packet frames that meet the above-mentioned preset discard conditions will be discarded. The traffic threshold can also be set according to the read and write capabilities of the packet storage unit, so that the storage unit can maintain a fast read and write speed.

[0062] During message transmission, excessive message traffic is frequently encountered. Excessive traffic reduces the read speed of the message storage unit, significantly impacting transmission efficiency. This embodiment detects the read / write status of the message storage unit. When the ratio of the read speed to the write speed is less than a preset threshold, message frames meeting preset discard conditions are discarded before storing the address in the address storage unit. This reduces subsequent read operations on the message storage unit, improving read speed and mitigating the impact of excessive message traffic on transmission efficiency. Furthermore, by setting preset discard conditions, selectively discarding certain message frames instead of all frames increases transmission flexibility and reduces data loss.

[0063] According to a third aspect of the embodiments of this application, such as Figure 6 As shown, a message communication device is provided, comprising:

[0064] The receiving judgment module 601 is used to receive multiple message frames included in the message, and to check each message frame to determine whether the message frame is an abnormal message frame.

[0065] The first storage module 602 is used to process the message frame according to the abnormal type when the message frame is an abnormal message frame, and to store the processed message frame through the message storage unit when the processed message frame is obtained; and to store the message frame through the message storage unit when the message frame is a normal message frame.

[0066] The second storage module 603 is used to write the storage address of the processed message frame whose exception identifier satisfies the filtering rules into the address set in the address storage unit, and to write the storage address of the message frame determined to be a normal message frame into the address set, wherein the exception identifier is used to indicate the exception type of the message frame.

[0067] The transmission module 604 is used to send the message frame whose corresponding storage address is located in the address set to the data receiving end after receiving a data acquisition request for a message.

[0068] In some optional embodiments, the first storage module is used to discard the message frame when the message frame lacks a frame header identifier; and / or, when the message frame includes multiple consecutive frame header identifiers, delete the frame header identifiers before the last frame header identifier in the message frame and add a first anomaly identifier to the message frame to obtain a processed message frame, wherein the first anomaly identifier is an anomaly identifier indicating that the message frame includes multiple consecutive frame header identifiers.

[0069] In some optional embodiments, the first storage module is used to add a frame tail identifier to the end of the message frame and add a second exception identifier to the message frame when the message frame is missing a frame tail identifier, thereby obtaining a processed message frame; and / or, when the message frame includes multiple consecutive frame tail identifiers, delete the frame tail identifiers after the first frame tail identifier and add a third exception identifier to the message frame, thereby obtaining a processed message frame; wherein, the second exception identifier is an exception identifier indicating that the message frame is missing a frame tail identifier, and the third exception identifier is an exception identifier indicating that the message frame includes multiple consecutive frame tail identifiers.

[0070] In some optional embodiments, the first storage module is used to add a fourth anomaly identifier to the message frame when the data length of the message frame is less than the length threshold, so as to obtain a processed message frame, wherein the fourth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is less than the length threshold.

[0071] In some optional embodiments, the first storage module is used to discard the portion of the message frame after the frame header that exceeds the length threshold when the data length of the message frame is greater than the length threshold, and to add a frame tail identifier and a fifth anomaly identifier to the remaining portion of the message frame to obtain the processed message frame; wherein, the fifth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is greater than the length threshold.

[0072] In some optional embodiments, the first storage module is further configured to, after obtaining the processed message frame, delete the frame header identifier and frame trailer identifier of the processed message frame to obtain a first message frame field, and store the first message frame field through the message storage unit; after determining that the message frame is a normal message frame, delete the frame header identifier and frame trailer identifier of the message frame to obtain a second message frame field, and store the second message frame field through the message storage unit.

[0073] In some optional embodiments, the message communication device further includes a read / write detection module for detecting the read / write status of the message storage unit. If the ratio of the read speed of the message storage unit to the write speed of the message storage unit is less than a preset threshold, then message frames that meet the preset discard conditions are discarded.

[0074] The message communication device provided in this application embodiment is based on the same inventive concept as the aforementioned message communication method embodiment and can achieve the same effect. For the specific implementation process, please refer to the description in the aforementioned data storage method embodiment, which will not be repeated here.

[0075] According to a third aspect of the embodiments of this application, an electronic device is also provided. Specifically, see below: (Refer to...) Figure 7 This document illustrates a schematic diagram of an electronic device according to an embodiment of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device.

[0076] like Figure 7 As shown, the electronic device may include: a processor 702, a communications interface 704, a memory 706, and a communications bus 708.

[0077] in:

[0078] The processor 702, communication interface 704, and memory 706 communicate with each other via communication bus 708.

[0079] Communication interface 704 is used to communicate with other electronic devices or servers.

[0080] The processor 702 is used to execute program 710, which can specifically execute the relevant steps in the above-described message communication method embodiment.

[0081] Specifically, program 710 may include program code that includes computer operation instructions.

[0082] The processor 702 may be a CPU, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The smart device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0083] Memory 706 is used to store program 710. Memory 706 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0084] Program 710 may include multiple computer instructions. Specifically, program 710 can cause processor 702 to execute the operations corresponding to the message communication method described in any of the foregoing multiple method embodiments through multiple computer instructions.

[0085] The specific implementation of each step in program 710 can be found in the corresponding steps and units described in the above method embodiments, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.

[0086] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in any of the foregoing method embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk.

[0087] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of this application can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this application.

[0088] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.

[0089] The above embodiments are only used to illustrate the embodiments of this application, and are not intended to limit the embodiments of this application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of this application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of this application, and the patent protection scope of the embodiments of this application should be defined by the claims.

Claims

1. A message communication method, characterized in that, include: The received message includes multiple message frames, and each message frame is checked to determine whether the message frame is an abnormal message frame. If the message frame is an abnormal message frame, the message frame is processed according to the abnormal type of the message frame, and the processed message frame is stored in the message storage unit when the processed message frame is obtained. If the message frame is a normal message frame, then the message frame is stored in the message storage unit; Based on the anomaly identifier included in the processed message frame, the storage address of the processed message frame whose anomaly identifier satisfies the filtering rules is written into the address set in the address storage unit, and the storage address of the message frame determined to be a normal message frame is written into the address set, wherein the anomaly identifier is used to indicate the anomaly type of the message frame. Upon receiving a data acquisition request for the message, the data frame whose corresponding storage address is located in the address set is sent to the data receiving end according to the data acquisition request.

2. The message communication method according to claim 1, characterized in that, The step of processing the message frame according to the exception type of the message frame includes: If the message frame lacks a frame header identifier, the message frame is discarded; and / or, If the message frame includes multiple consecutive frame header identifiers, then the frame header identifiers before the last frame header identifier in the message frame are deleted, and a first anomaly identifier is added to the message frame to obtain a processed message frame, wherein the first anomaly identifier is an anomaly identifier indicating that the message frame includes multiple consecutive frame header identifiers.

3. The message communication method according to claim 1, characterized in that, The step of processing the message frame according to the exception type of the message frame includes: If the message frame lacks a frame tail identifier, then a frame tail identifier is added to the end of the message frame, and a second anomaly identifier is added to the message frame to obtain the processed message frame; and / or, If the message frame includes multiple connected frame tail identifiers, then delete the frame tail identifiers after the first frame tail identifier in the frame tail identifiers, and add a third anomaly identifier to the message frame to obtain the processed message frame. The second anomaly identifier is an anomaly identifier indicating that the message frame is missing a frame tail identifier, and the third anomaly identifier is an anomaly identifier indicating that the message frame includes multiple consecutive frame tail identifiers.

4. The message communication method according to claim 1, characterized in that, The step of processing the message frame according to the exception type of the message frame includes: If the data length of the message frame is less than the length threshold, a fourth anomaly identifier is added to the message frame to obtain a processed message frame. The fourth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is less than the length threshold.

5. The message communication method according to claim 1, characterized in that, The step of processing the message frame according to the exception type of the message frame includes: If the data length of the message frame is greater than the length threshold, the portion of the message frame after the frame header that exceeds the length threshold is discarded, and a frame tail identifier and a fifth anomaly identifier are added to the remaining portion of the message frame to obtain the processed message frame; wherein, the fifth anomaly identifier is an anomaly identifier indicating that the data length of the message frame is greater than the length threshold.

6. The message communication method according to any one of claims 2-5, characterized in that, Upon obtaining the processed message frame, the processed message frame is stored in the message storage unit, including: After obtaining the processed message frame, the frame header identifier and frame tail identifier of the processed message frame are deleted to obtain the first message frame field, and the first message frame field is stored in the message storage unit. Furthermore, if the message frame is a normal message frame, it is stored in the message storage unit, including: If the message frame is a normal message frame, the frame header identifier and frame trailer identifier of the message frame are deleted to obtain the second message frame field, and the second message frame field is stored in the message storage unit.

7. The message communication method according to any one of claims 6, characterized in that, The method further includes: The read / write status of the message storage unit is detected. If the ratio of the read speed to the write speed of the message storage unit is less than a preset threshold, then message frames that meet the preset discard conditions are discarded.

8. A message communication device, characterized in that, include: The receiving and judging module is used to receive multiple message frames included in the message, and to check each message frame to determine whether the message frame is an abnormal message frame. The first storage module is used to process the message frame according to the abnormal type of the message frame when the message frame is an abnormal message frame, and to store the processed message frame through the message storage unit when the processed message frame is obtained. When the message frame is a normal message frame, the message frame is stored in the message storage unit; The second storage module is used to write the storage address of the processed message frame whose abnormality identifier satisfies the filtering rules into the address set in the address storage unit, and to write the storage address of the message frame determined to be a normal message frame into the address set, wherein the abnormality identifier is used to indicate the abnormality type of the message frame. The transmission module is used to send the message frame whose corresponding storage address is located in the address set to the data receiving end after receiving a data acquisition request for the message.

9. An electronic device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the method as described in any one of claims 1-7.

10. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for processing messages

    CN101594305A

  • Exception handling method and system for network processor

    CN102238062A