CN111800223B - Method, device and system for generating sending message and processing receiving message - Google Patents

Method, device and system for generating sending message and processing receiving message Download PDF

Info

Publication number
CN111800223B
CN111800223B CN201910755214.2A CN201910755214A CN111800223B CN 111800223 B CN111800223 B CN 111800223B CN 201910755214 A CN201910755214 A CN 201910755214A CN 111800223 B CN111800223 B CN 111800223B
Authority
CN
China
Prior art keywords
check code
control information
preset
received message
generating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910755214.2A
Other languages
Chinese (zh)
Other versions
CN111800223A (en
Inventor
廖恬瑜
王建东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910755214.2A priority Critical patent/CN111800223B/en
Publication of CN111800223A publication Critical patent/CN111800223A/en
Application granted granted Critical
Publication of CN111800223B publication Critical patent/CN111800223B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a method, a device and a system for generating a sending message and processing a receiving message, and relates to the technical field of computers. One embodiment of the method comprises the following steps: generating control information according to the relation between the byte number of the input data and the preset check code number; selecting a generation mode of a corresponding check code according to the value of the control information; generating a check code according to the generation mode; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card; and generating a sending message according to the input data and the check code. The implementation mode avoids the technical defects of high requirements on hardware equipment and high time cost when the check code is generated by adopting hardware and the time cost consumed when the check code is generated by adopting software in the prior art, thereby achieving the purposes of reducing the cost of generating the check code and improving the efficiency of generating the check code.

Description

Method, device and system for generating sending message and processing receiving message
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a system for generating a sending message and processing a receiving message.
Background
In the process of transmitting the message, the accuracy of the pre-transmission content in the transmission process needs to be determined. Therefore, a check code is required to be added in the process of generating the message and used for checking after the subsequent transmission; when receiving the external transmission message, the received message needs to be analyzed for further obtaining the information in the message.
In the process of sending the message, the prior art adopts a method that a CPU is used for calculating a check code of input data (namely, software is used for calculating the check code), and then the check code is combined with the input data to be transmitted; or the check code is calculated through the high-performance network card and then is combined with the input data to be transmitted. The corresponding processing mode of the received message corresponds to the transmitted message.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
1. the check code is calculated by software, so that the calculation capacity of the CPU is greatly consumed;
2. the high-performance network card is adopted to calculate the check code, so that the calculation power of a CPU is saved, but the special complex high-performance network card chip is needed to realize, and the cost is high.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method, an apparatus, and a system for generating a sending message and processing a receiving message, which can avoid the technical defects of high cost required for hardware devices and high time cost consumed when generating a check code by using software when generating the check code by using hardware in the prior art, so as to reduce the cost of generating the check code and improve the efficiency of generating the check code.
To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method for generating a transmission message, including:
generating control information according to the relation between the byte number of the input data and the preset check code number;
selecting a generation mode of a corresponding check code according to the value of the control information;
generating a check code according to the generation mode; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card;
and generating a sending message according to the input data and the check code.
Optionally, the value of the control information includes: a first control information value and a second control information value;
the first control information value is used for indicating that the number of bytes of the input data and the number of preset check codes do not have a preset relation;
the second control information value is used for indicating that a preset relation exists between the byte number of the input data and the preset check code number.
Optionally, selecting a generation mode of the corresponding check code according to the value of the control information includes:
when the value of the control information is the first control information value, a mode of generating a check code by a central processing unit is adopted;
and when the value of the control information is the second control information value, adopting a mode of generating a check code by the network card.
According to still another aspect of an embodiment of the present invention, there is provided a method for processing a received packet, including:
acquiring a receiving message;
selecting a verification mode of the received message according to the relation between the byte number in the received message and the preset verification code number; the processing mode of the received message comprises the following steps: checking by adopting a central processing unit and checking by adopting a network card;
and checking the received message according to the checking mode, and storing the received message if the received message is correct.
Optionally, selecting a verification manner of the received message according to a relationship between the number of bytes in the received message and a preset number of verification codes includes:
when the number of bytes in the received message and the number of preset check codes have a preset relation, checking the received message by adopting a network card;
when the number of bytes in the received message and the number of preset check codes do not have a preset relation, checking the received message by adopting a central processing unit.
Optionally, checking the received message according to the checking mode, and if the received message is correct, storing the received message, including:
checking the received message according to the checking mode, and generating control information according to the checking mode;
if the received message is correct, the received message and the corresponding control information are stored in a combined way;
when the verification mode is that a central processing unit is adopted for verification, the value of the control information is a first control information value; and when the checking mode is to check by adopting a network card, the value of the control information is a second control information value.
According to still another aspect of an embodiment of the present invention, there is provided a system for processing a packet, including: the central processing module and the network card module;
when the method is applied to generating a sending message, the method comprises the following steps:
the central processing module is used for generating control information according to the relation between the byte number of the input data and the preset check code number; selecting a generation mode of a corresponding check code according to the value of the control information; generating a check code when the value of the control information is the value of the first control information;
the network card module is used for generating a check code when the value of the control information is the value of the second control information; generating a sending message according to the input data and the check code;
the first control information value is used for indicating that the byte number of the input data is not an integer multiple of the preset check code number; the second control information value is used for indicating that the byte number of the input data is an integer of a preset check code number;
and/or the number of the groups of groups,
when applied to processing received messages:
the network card module is used for acquiring a received message; selecting a mode for processing the received message according to the relation between the byte number in the received message and the preset check code number; when the number of bytes in the received message is an integer multiple of the number of preset check codes, checking the received message;
the central processing module is used for checking the received message when the number of bytes in the received message is not an integer multiple of the number of preset check codes; and if the received message is correct, storing the received message.
According to still another aspect of an embodiment of the present invention, there is provided an apparatus for generating a transmission packet, including:
the control information generation module is used for generating control information according to the relation between the byte number of the input data and the preset check code number;
the check code generation mode determining module is used for selecting a generation mode of a corresponding check code according to the value of the control information;
the check code generation module is used for generating a check code according to the generation mode; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card;
and the sending message generating module is used for generating a sending message according to the input data and the check code.
According to still another aspect of an embodiment of the present invention, there is provided an apparatus for processing a received packet, including:
the receiving message acquisition module is used for acquiring a receiving message;
the received message processing mode determining module is used for selecting a verification mode of the received message according to the relation between the byte number in the received message and the preset verification code number; the processing mode of the received message comprises the following steps: checking by adopting a central processing unit and checking by adopting a network card;
and the received message storage module is used for checking the received message according to the mode, and storing the received message if the received message is correct.
According to another aspect of an embodiment of the present invention, there is provided an electronic device for processing a packet, including:
one or more processors;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method for processing a message provided by the present invention.
According to yet another aspect of an embodiment of the present invention, there is provided a computer readable medium having stored thereon a computer program, which when executed by a processor, implements the method for processing a message provided by the present invention.
One embodiment of the above invention has the following advantages or benefits:
according to the method and the device, the calculation of the check code of the message with one or more lengths is realized by adopting hardware (namely a network card) in the alternative embodiment, the check code can be generated on the CPU by utilizing software when the message with other lengths except the one or the concentrated length is required to be transmitted, and further, the technical defects that the requirement on hardware equipment is high when the check code is generated by adopting hardware in the prior art, and the time cost consumed when the check code is generated by adopting software is high are avoided, and further, the efficiency of generating the check code is improved while the cost of generating the check code is reduced.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a method for generating a send message according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a process of transmitting input data to an external network according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a main flow of processing a received message according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a detailed flow of processing a received message according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a message processing system according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of an apparatus for generating a send message according to an embodiment of the present invention;
fig. 7 is a schematic diagram of main modules of an apparatus for processing a received message according to an embodiment of the present invention;
FIG. 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 9 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The most commonly used methods for debugging check codes in the field of data communication include, but are not limited to, one of three methods, specifically: parity, hamming code, CRC cyclic redundancy check code (Cyclic Redundancy Check). When the CRC cyclic redundancy check code is used to generate the check code, the check code may be provided at the tail of the input data.
In order to increase the calculation speed of the check code, the hardware of the prior art generally adopts a parallel calculation method. Specifically, assuming that the bit width of the input data in the message is 32B, the hardware needs to set a module for calculating the check code by the hardware with the bit width of 32B. Since the length of the message itself is arbitrary, the last data bit width of the message input may be 1B-32B, so the hardware also needs to set up a module of hardware calculation check codes of 31 different data bit widths. Furthermore, in the prior art, when the check code is calculated by adopting hardware, a network card with higher performance is required, and the cost consumed by adopting the high-performance network card is higher because the structure of the high-performance network card is more complex and the cost is higher.
In the prior art, when a message is transmitted, the condition that the check code is calculated by software exists. The software calculation is to store the message in the memory corresponding to CPU and calculate the check code of the input data. However, the technical defect that the calculation of the check code by software consumes the calculation power of the CPU is generated, and the technical defect that the network transmission requirement of high bandwidth cannot be met is also generated.
According to the method and the device, the calculation of the check code of the message with one or more lengths is realized by adopting hardware (namely a network card) in the alternative embodiment, the check code can be generated on the CPU by utilizing software when the message with other lengths except the one or the concentrated length is required to be transmitted, so that the technical defects that the requirement on hardware equipment is high when the check code is generated by adopting hardware in the prior art, and the time cost consumed when the check code is generated by adopting software is high are overcome, and the technical effects that the cost of generating the check code is reduced and the efficiency of generating the check code is improved are achieved.
Specifically, fig. 1 is a schematic diagram of main flow of a method for generating a sending message according to an embodiment of the present invention, as shown in fig. 1, including:
step S101, generating control information according to the relation between the byte number of input data and the number of preset check codes;
step S102, selecting a generation mode of a corresponding check code according to the value of the control information;
step S103, generating a check code according to the generation mode; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card;
step S104, generating a sending message according to the input data and the check code.
When the CPU sends a message, the CPU is utilized to judge the generation mode of the generated check code according to the length of the byte number in the input data. Specifically, if the network card does not support the calculation of check codes with the byte number and length in the input data, calculating the check codes by using software in the CPU, splicing the check codes to the tail of the input data, and then transmitting the check codes to the network card; if the network card supports the calculation of the check code with the length, the input data is directly sent to the network card for transmission, the check code is calculated by the network card, and the check code is spliced to the tail part of the input data and then transmitted to an external network.
Through the technical means, the hardware part for realizing the steps can be simplified, namely, the hardware part can perform the operation of generating the check code partially by adopting the low-performance network card, so that the cost for generating the check code by hardware realization is reduced. The scheme saves the hardware realization cost under the condition of meeting the same network transmission bandwidth requirement.
In addition, the technical means of calculating part of check codes by the CPU solves the technical problem that the calculation pressure on the CPU is overlarge when the CPU is used for calculating all input data check codes in the prior art, and further achieves the technical effects of improving the efficiency of calculating the check codes and reducing the calculation cost. The method and the device can also achieve the technical effect of meeting the current requirement on high-bandwidth transmission by reducing the calculation amount of the CPU.
After the CPU determines the relationship between the number of bytes of the input data and the number of preset check codes, setting control information for the input data may be generated. The control information may use 0 and 1, or other preset fields to indicate that the check code is set by the network card and the check code is set by software in the CPU.
Specifically, the value of the control information may include: a first control information value and a second control information value;
the control information may include a result of determining a relationship between the number of bytes of the input data and the number of preset check codes and/or an identifier of whether the network card is required to perform check code calculation;
the first control information value is used for indicating that the number of bytes of the input data and the number of preset check codes do not have a preset relation;
the second control information value is used for indicating that a preset relation exists between the byte number of the input data and the preset check code number.
Specifically, the preset relationships include, but are not limited to: the number of bytes of the input data is an integer multiple of the number of preset check codes, and other numbers can be added after the integer multiple.
The preset check code number refers to the number of bytes preset in the system for parallel computation, for example, 32B.
When the number of bytes of the input data and the number of preset check codes have a preset relationship, the number of bytes can have multiple conditions, that is, the network card can generate check codes for one or more input data with different lengths. Because the network card adopted by the application only needs to realize the crc check of messages with several lengths, and the network card with higher performance is not needed, the application can improve the performance and simultaneously does not improve the economic cost.
Specifically, when the value of the control information is a first control information value (that is, there is no preset relation between the number of bytes of the input data and the number of preset check codes), a mode of generating the check codes by using a central processing unit is set as a mode of generating the check codes corresponding to the control information;
when the value of the control information is the second control information value (that is, a preset relation exists between the byte number of the input data and the preset check code number), the mode of generating the check code by adopting the network card is set as the generation mode of the check code corresponding to the control information.
According to the method and the device, the control information is set, so that when the software (CPU) finishes generating the check code, hardware does not need to repeatedly generate the check code; when the hardware finishes generating the check code, the software does not need to repeatedly generate the check code.
Through the technical means of software and hardware cooperation, a proper technical means for generating the input data can be selected according to the length of the input data, and further the efficiency of generating the check code is improved.
Optionally, the calculation of the small-flow input data check code is realized by software, and the calculation of the large-flow input data check code is realized by special hardware, so that the integrity of the network card function is ensured, the transmission of all the length of input data is supported, the high-bandwidth transmission requirement is met, and most of the calculation of the input data check code is completed by the network card.
Fig. 2 is a schematic diagram of a main flow of a process of transmitting input data to an external network according to an embodiment of the present invention, as shown in fig. 2, including:
s201, determining input data by using a CPU;
s202, determining the byte length of input data;
s203, determining the relation between the byte length judgment and the number of preset check codes;
s204, generating control information according to the relation; wherein when the relation is determined to be an integer multiple, the value of the control information is a first control information value, and S206 is executed; when it is determined that the relationship is not an integer multiple, the value of the control information is a second control information value, and S205 is executed;
s205, generating a check code by adopting a central processing unit, combining input data and the generated check code, transmitting the combination to a network card, and transmitting the combination to an external network by adopting a transparent transmission mode in the network card;
s206, reading input data by adopting a network card; s207 is performed;
s207, the network card judges whether the input data needs to calculate a check code according to the control information; if so, generating a check code according to the input data;
s206, generating a sending message according to the input data and the check code generated in S207, and sending the sending message to an external network.
A process for processing a received message corresponding to a method for generating a transmitted message for input data is shown in fig. 3, where fig. 3 is a schematic diagram of a main flow of processing a received message according to an embodiment of the present invention. Specifically, the method comprises the following steps:
s301, acquiring a receiving message;
s302, selecting a verification mode of the received message according to the relation between the byte number in the received message and the preset verification code number; the processing mode of the received message comprises the following steps: checking by adopting a central processing unit and checking by adopting a network card;
s303, checking the received message according to the checking mode, and storing the received message if the received message is correct.
The received message is an original message from an external network, and when the verification mode is CRC cyclic redundancy check code (Cyclic Redundancy Check), the check code can be at the tail of the original message.
The step of processing the received message corresponds to the step of generating the transmitted message.
If the input data has a preset relation with the number of the preset check codes, the preset relation with the preset check codes still exists after the check codes are added to the input data. Therefore, when receiving the message, the network card end can select the mode of processing the received message.
Specifically, selecting a verification manner of the received message according to a relationship between the number of bytes in the received message and a preset number of verification codes, including:
when the number of bytes in the received message is an integer multiple of the number of preset check codes, checking the received message by adopting a network card;
when the number of bytes in the received message is not an integer multiple of the number of preset check codes, the received message can be transmitted to a memory corresponding to the CPU in a transparent transmission mode to check the CPU, and specifically, the mode of checking the received message is to check by adopting a central processing unit.
Optionally, checking the received message according to the checking mode, and if the received message is correct, storing the received message, including:
checking the received message according to the checking mode, and generating control information according to the checking mode; the value of the control information is a first control information value and a second control information value;
when the verification mode is that a central processing unit is adopted for verification, the value of the control information is a first control information value;
when the checking mode is to check by adopting a network card, the value of the control information is a second control information value;
and if the received message is correct, combining and storing the received message and the corresponding control information.
Fig. 4 is a schematic diagram of a detailed flow of processing a received message according to an embodiment of the present invention. As shown in fig. 4, the following details of the process of processing the received message according to an embodiment include:
s401, receiving a message from an external network;
s402, selecting a verification mode of the received message according to the relation between the byte number in the received message and the preset verification code number; if the central processing unit is adopted for verification, S403 is executed, and if the network card is adopted for verification, S404 is executed;
s403, judging whether the check code in the received message is checked, if not, transmitting the received message to a memory corresponding to the CPU through a transparent transmission mode, checking the received message, if so, storing the received message, generating control information for representing a checking mode, and if not, discarding the received message;
s404, checking the received message by using a network card, if the received message is correct, storing the received message, generating control information for representing a checking mode, and storing the control information in a memory corresponding to the CPU; and if not, discarding the received message.
Fig. 5 is a schematic diagram of a message processing system according to an embodiment of the present invention. As shown in fig. 5, a system for processing a message includes: the central processing module and the network card module;
when the method is applied to generating a sending message, the method comprises the following steps:
the central processing module is used for generating control information according to the relation between the byte number of the input data and the preset check code number; selecting a generation mode of a corresponding check code according to the value of the control information; generating a check code when the value of the control information is the value of the first control information;
the network card module is used for generating a check code when the value of the control information is the value of the second control information; generating a sending message according to the input data and the check code;
the first control information value is used for indicating that the byte number of the input data is not an integer multiple of the preset check code number; the second control information value is used for indicating that the byte number of the input data is an integer of a preset check code number;
and/or the number of the groups of groups,
when applied to processing received messages:
the network card module is used for acquiring a received message; selecting a mode for processing the received message according to the relation between the byte number in the received message and the preset check code number; when the number of bytes in the received message is an integer multiple of the number of preset check codes, checking the received message;
the central processing module is used for checking the received message when the number of bytes in the received message is not an integer multiple of the number of preset check codes; and if the received message is correct, storing the received message.
Specifically, the method and the device can be also used for a network protocol ROCEv2, wherein a check field corresponding to the network protocol ROCEv2 is named ICRC, and the calculation method is similar to the crc of the Ethernet message. The module for calculating the check code and the method for calculating the check code by the cooperation of software and hardware can also be suitable for sending and receiving the rocev2 protocol message. RoCE (RDMA over Converged Ethernet) is a network protocol that allows Remote Direct Memory Access (RDMA) to be used over ethernet.
FIG. 6 is a schematic diagram of the main modules of an apparatus for generating a send message according to an embodiment of the present invention; as shown in fig. 6, there is provided an apparatus 600 for generating a transmission message, including:
a control information generating module 601, configured to generate control information according to a relationship between a byte number of input data and a preset check code number;
a check code generation mode determining module 602, configured to select a generation mode of a corresponding check code according to the value of the control information;
a check code generating module 603, configured to generate a check code according to the generating manner; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card;
a transmission message generating module 604, configured to generate a transmission message according to the input data and the check code.
Fig. 7 is a schematic diagram of main modules of an apparatus for processing a received message according to an embodiment of the present invention; as shown in fig. 7, there is provided an apparatus 700 for processing a received message, including:
a received message obtaining module 701, configured to obtain a received message;
a received message processing manner determining module 702, configured to select a verification manner of the received message according to a relationship between a number of bytes in the received message and a number of preset verification codes; the processing mode of the received message comprises the following steps: checking by adopting a central processing unit and checking by adopting a network card;
the received message storage module 703 is configured to verify a received message according to the manner, and store the received message if the received message is correct.
Fig. 8 illustrates an exemplary system architecture 800 for generating a send message, processing a receive message, or generating a send message, processing a receive message device to which embodiments of the present invention may be applied.
As shown in fig. 8, a system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves as a medium for providing communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 805 through the network 804 using the terminal devices 801, 802, 803 to receive or send messages or the like. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 801, 802, 803.
The terminal devices 801, 802, 803 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 805 may be a server providing various services, such as a background management server (by way of example only) that provides support for shopping-type websites browsed by users using the terminal devices 801, 802, 803. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for generating a sending message and processing a receiving message provided in the embodiment of the present invention is generally executed by the server 805, and accordingly, the device for generating a sending message and processing a receiving message is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 9, there is illustrated a schematic diagram of a computer system 900 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 9 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 9, the computer system 900 includes a central processing module (CPU) 901 that can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
The following components are connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 910 so that a computer program read out therefrom is installed into the storage section 908 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 909 and/or installed from the removable medium 911. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a central processing module (CPU) 901.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not in some cases limit the module itself, and for example, the transmitting module may also be described as "a module that transmits a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
generating control information according to the relation between the byte number of the input data and the preset check code number;
selecting a generation mode of a corresponding check code according to the value of the control information;
generating a check code according to the generation mode; the generation mode of the check code comprises the following steps: generating a check code by adopting a central processing unit and generating the check code by adopting a network card;
and generating a sending message according to the input data and the check code.
According to the technical scheme provided by the embodiment of the invention, the following beneficial effects can be achieved:
according to the method and the device, the calculation of the check code of the message with one or more lengths is realized by adopting hardware (namely a network card) in the alternative embodiment, the check code can be generated on the CPU by utilizing software when the message with other lengths except the one or the concentrated length is required to be transmitted, and further, the technical defects that the requirement on hardware equipment is high when the check code is generated by adopting hardware in the prior art, and the time cost consumed when the check code is generated by adopting software is high are avoided, and further, the technical effects that the cost of generating the check code is reduced and the efficiency of generating the check code is improved are achieved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. A method for generating a send message, comprising:
generating control information according to the relation between the byte number of the input data and the preset check code number; wherein, the value of the control information comprises: a first control information value and a second control information value; the first control information value is used for indicating that the number of bytes of the input data and the number of preset check codes do not have a preset relation; the second control information value is used for indicating that a preset relation exists between the byte number of the input data and the preset check code number; the preset relation is whether the byte number of the input data is an integer multiple of the preset check code number; the preset check code number is the byte number preset in the system for parallel calculation;
selecting a generation mode of a corresponding check code according to the value of the control information, wherein the generation mode comprises the following steps: when the value of the control information is the first control information value, a mode of generating a check code by a central processing unit is adopted; when the value of the control information is the second control information value, adopting a mode of generating a check code by a network card;
generating a check code according to the generation mode;
and generating a sending message according to the input data and the check code.
2. A method for processing a received message, comprising:
acquiring a receiving message;
selecting a verification mode of the received message according to the relation between the byte number in the received message and the preset verification code number, wherein the method comprises the following steps: when the number of bytes in the received message and the number of preset check codes have a preset relation, checking the received message by adopting a network card; when the number of bytes in the received message and the number of preset check codes do not have a preset relation, checking the received message by adopting a central processing unit; the preset check code number is the byte number preset in the system for parallel calculation; the preset relation is whether the number of bytes of the input data is an integer multiple of the number of preset check codes;
and checking the received message according to the checking mode, and storing the received message if the received message is correct.
3. The method according to claim 2, wherein verifying the received message according to the verification manner, and storing the received message if the received message is correct, comprises:
checking the received message according to the checking mode, and generating control information according to the checking mode;
if the received message is correct, the received message and the corresponding control information are stored in a combined way;
when the verification mode is that a central processing unit is adopted for verification, the value of the control information is a first control information value; and when the checking mode is to check by adopting a network card, the value of the control information is a second control information value.
4. A system for processing messages, comprising: the central processing module and the network card module;
when the method is applied to generating a sending message, the method comprises the following steps:
the central processing module is used for generating control information according to the relation between the byte number of the input data and the preset check code number; the preset check code number is the byte number preset in the system for parallel calculation; selecting a generation mode of a corresponding check code according to the value of the control information; wherein, the value of the control information comprises: a first control information value and a second control information value; the first control information value is used for indicating that the number of bytes of the input data and the number of preset check codes do not have a preset relation; the second control information value is used for indicating that a preset relation exists between the byte number of the input data and the preset check code number; the preset relation is whether the byte number of the input data is an integer multiple of the preset check code number; when the value of the control information is the first control information value, generating a check code by adopting a mode that a central processing unit generates the check code;
the network card module is used for generating a check code by adopting a mode of generating the check code by the network card when the value of the control information is the second control information value; generating a sending message according to the input data and the check code;
the first control information value is used for indicating that the byte number of the input data is not an integer multiple of the preset check code number; the second control information value is used for indicating that the byte number of the input data is an integer multiple of the preset check code number;
and/or the number of the groups of groups,
when applied to processing received messages:
the network card module is used for acquiring a received message; selecting a mode for processing the received message according to the relation between the byte number in the received message and the preset check code number, wherein the mode comprises the following steps: when the number of bytes in the received message and the number of preset check codes have a preset relation, checking the received message by adopting a network card; when the number of bytes in the received message and the number of preset check codes do not have a preset relation, checking the received message by adopting a central processing unit; the preset check code number is the byte number preset in the system for parallel calculation; the preset relation is whether the byte number of the input data is an integer multiple of the preset check code number; when the number of bytes in the received message is an integer multiple of the number of preset check codes, checking the received message;
the central processing module is used for checking the received message when the number of bytes in the received message is not an integer multiple of the number of preset check codes; and if the received message is correct, storing the received message.
5. An apparatus for generating a transmission message, comprising:
the control information generation module is used for generating control information according to the relation between the byte number of the input data and the preset check code number; the value of the control information comprises the following steps: a first control information value and a second control information value; the first control information value is used for indicating that the number of bytes of the input data and the number of preset check codes do not have a preset relation; the second control information value is used for indicating that a preset relation exists between the byte number of the input data and the preset check code number; the preset check code number is the byte number preset in the system for parallel calculation; the preset relation is whether the byte number of the input data is an integer multiple of the preset check code number;
the check code generation mode determining module is used for selecting a generation mode of a corresponding check code according to the value of the control information, and comprises the following steps: when the value of the control information is the first control information value, a mode of generating a check code by a central processing unit is adopted; when the value of the control information is the second control information value, adopting a mode of generating a check code by a network card;
the check code generation module is used for generating a check code according to the generation mode;
and the sending message generating module is used for generating a sending message according to the input data and the check code.
6. An apparatus for processing a received message, comprising:
the receiving message acquisition module is used for acquiring a receiving message;
the received message processing mode determining module is configured to select a verification mode of the received message according to a relationship between a byte number in the received message and a preset verification code number, where the method includes: when the number of bytes in the received message and the number of preset check codes have a preset relation, checking the received message by adopting a network card; when the number of bytes in the received message and the number of preset check codes do not have a preset relation, checking the received message by adopting a central processing unit; the preset check code number is the byte number preset in the system for parallel calculation; the preset relation is whether the number of bytes of the input data is an integer multiple of the number of preset check codes;
and the received message storage module is used for checking the received message according to the mode, and storing the received message if the received message is correct.
7. An electronic device for processing a message, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-3.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-3.
CN201910755214.2A 2019-08-15 2019-08-15 Method, device and system for generating sending message and processing receiving message Active CN111800223B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910755214.2A CN111800223B (en) 2019-08-15 2019-08-15 Method, device and system for generating sending message and processing receiving message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910755214.2A CN111800223B (en) 2019-08-15 2019-08-15 Method, device and system for generating sending message and processing receiving message

Publications (2)

Publication Number Publication Date
CN111800223A CN111800223A (en) 2020-10-20
CN111800223B true CN111800223B (en) 2023-06-23

Family

ID=72805430

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910755214.2A Active CN111800223B (en) 2019-08-15 2019-08-15 Method, device and system for generating sending message and processing receiving message

Country Status (1)

Country Link
CN (1) CN111800223B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114499757A (en) * 2022-01-07 2022-05-13 锐捷网络股份有限公司 Method and device for generating checksum and electronic equipment
CN117318892B (en) * 2023-11-27 2024-04-02 阿里云计算有限公司 Computing system, data processing method, network card, host computer and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6968492B1 (en) * 2002-03-28 2005-11-22 Annadurai Andy P Hardware-efficient CRC generator for high speed communication networks
CN102708022A (en) * 2005-12-23 2012-10-03 英特尔公司 Performing a cyclic redundancy checksum operation responsive to a user-level instruction

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4700350A (en) * 1986-10-07 1987-10-13 Douglas Phillip N Multiple phase CRC generator
US8661314B2 (en) * 2009-03-23 2014-02-25 Broadcom Corporation Method and apparatus for calculating frame check sequence
CN101902228B (en) * 2009-05-25 2012-11-28 中兴通讯股份有限公司 Rapid cyclic redundancy check encoding method and device
CN101789044B (en) * 2010-01-27 2012-03-28 武汉大学 Method of implementing cooperative work of software and hardware of genetic algorithm
CN103701566B (en) * 2013-12-18 2017-09-12 华为技术有限公司 A kind of method of calibration and device
CN105790887A (en) * 2014-12-26 2016-07-20 上海贝尔股份有限公司 Method and device for generating parallel CRC values for packets

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6968492B1 (en) * 2002-03-28 2005-11-22 Annadurai Andy P Hardware-efficient CRC generator for high speed communication networks
CN102708022A (en) * 2005-12-23 2012-10-03 英特尔公司 Performing a cyclic redundancy checksum operation responsive to a user-level instruction

Also Published As

Publication number Publication date
CN111800223A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
CN110572422A (en) Data downloading method and device
CN111800223B (en) Method, device and system for generating sending message and processing receiving message
CN103581133A (en) Method and system for transmitting responses to access requests of Web server
CN113010405A (en) Application program testing method and device
CN112905930A (en) Interface request retransmission method and device
EP4180985A1 (en) File sharing method, apparatus, and system
CN110324384B (en) Data pushing method and device
US10931791B2 (en) Method and apparatus for processing request
CN112948138A (en) Method and device for processing message
CN113452733A (en) File downloading method and device
CN109241040B (en) Data cleaning method and device
CN112667368A (en) Task data processing method and device
CN110830427A (en) Method and device for message encoding and message decoding in netty environment
CN110851194A (en) Method and device for acquiring code for realizing new interface
CN112131095B (en) Pressure testing method and device
CN111950232B (en) Method and device for automatically switching number segments
CN110019671B (en) Method and system for processing real-time message
CN112163176A (en) Data storage method and device, electronic equipment and computer readable medium
CN113132480B (en) Data transmission method, device and system
CN113242306B (en) Block chain consensus method and device
CN113852484B (en) Terminal equipment network distribution method, device, electronic equipment and computer readable medium
CN110262756B (en) Method and device for caching data
CN110011767B (en) Method and apparatus for TCP connection backup
CN112988408A (en) Multi-terminal interaction method and device
CN115422067A (en) Interface testing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant