CN111800223A - 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
CN111800223A
CN111800223A CN201910755214.2A CN201910755214A CN111800223A CN 111800223 A CN111800223 A CN 111800223A CN 201910755214 A CN201910755214 A CN 201910755214A CN 111800223 A CN111800223 A CN 111800223A
Authority
CN
China
Prior art keywords
generating
control information
check code
received message
preset
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.)
Granted
Application number
CN201910755214.2A
Other languages
Chinese (zh)
Other versions
CN111800223B (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: generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes; selecting a generation mode corresponding to the 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 embodiment avoids the technical defects that in the prior art, the requirement on hardware equipment is high in cost when hardware is used for generating the check code, and the time cost consumed when software is used for generating the check code is high, so that the check code generating efficiency is improved while the check code generating cost is reduced.

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 transmission packet and processing a reception packet.
Background
In the transmission process of the message, the accuracy of the pre-transmission content in the transmission process needs to be determined. Therefore, a check code needs to be added in the message generation process for checking after subsequent transmission; when receiving a message transmitted from the outside, the received message needs to be analyzed for further acquiring information in the message.
In the process of sending a message, the prior art adopts a CPU to calculate a check code of input data (namely, software is adopted to calculate the check code), and then the check code is combined with the input data and transmitted; or the check code is calculated through the high-performance network card and then combined with the input data to be transmitted. The corresponding processing of the received message corresponds to the sending of the message.
In the process of implementing the 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 a CPU is greatly consumed;
2. the check code is calculated by adopting the high-performance network card, although the calculation power of a CPU is saved, the check code is realized by a special complex high-performance network card chip, and the cost is higher.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, and a system for generating a sending packet and processing a receiving packet, which can avoid the technical defects in the prior art that a requirement on hardware equipment is high in cost when a check code is generated by using hardware, and time cost consumed when a check code is generated by using software is high, thereby achieving the purpose of reducing the cost of generating the check code and improving the efficiency of generating the check code.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for generating a transmission packet, including:
generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes;
selecting a generation mode corresponding to the 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 does not have a preset relation with the number of preset check codes;
and the second control information value is used for indicating that the number of bytes of the input data has a preset relation with the number of preset check codes.
Optionally, selecting a generation manner of the corresponding check code according to the value of the control information, including:
when the value of the control information is a 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 a second control information value, a mode of generating a check code by a network card is adopted.
According to another aspect of the embodiments of the present invention, a method for processing a received packet is provided, including:
acquiring a received message;
selecting a verification mode of the received message according to the relation between the number of bytes in the received message and the number of preset verification codes; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
and checking the received message according to the checking mode, and if the received message is correct, storing the received message.
Optionally, selecting a checking mode of the received message according to a relationship between the number of bytes in the received message and a preset number of check codes includes:
when the number of bytes in the received message has a preset relationship with the number of preset check codes, checking the received message by adopting a network card;
and when the number of bytes in the received message does not have a preset relation with the number of preset check codes, checking the received message by adopting a central processing unit.
Optionally, the verifying the received packet according to the verification method, and if the received packet is correct, storing the received packet includes:
verifying the received message according to the verification mode, and generating control information according to the verification mode;
if the received message is correct, the received message and corresponding control information are combined and stored;
when the verification mode is that the central processing unit is used for verification, the value of the control information is a first control information value; and when the checking mode is to adopt a network card for checking, the value of the control information is a second control information value.
According to still another aspect of the embodiments 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 the sending message:
the central processing module is used for generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes; selecting a generation mode corresponding to the check code according to the value of the control information; when the value of the control information is the first control information value, generating a check code;
the network card module is used for generating a check code when the value of the control information is a 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 number of bytes of the input data is not an integral multiple of the number of preset check codes; the second control information value is used for indicating that the number of bytes of the input data is an integer of a preset check code number;
and/or the presence of a gas in the gas,
when the method is 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 number of bytes in the received message and the number of preset check codes; when the number of bytes in the received message is an integral 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 integral multiple of the number of preset check codes; and if the received message is correct, storing the received message.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for generating a transmission packet, including:
the control information generating module is used for generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes;
the check code generation mode determining module is used for selecting a generation mode corresponding to the check code according to the value of the control information;
the check code generating module is used for generating a check code according to the generating 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 another aspect of the embodiments of the present invention, there is provided an apparatus for processing a received packet, including:
a received message acquisition module, configured to acquire a received message;
a received message processing mode determining module, configured to select a check mode of the received message according to a relationship between the number of bytes in the received message and a preset check code number; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
and the received message storage module is used for verifying the received message according to the mode and storing the received message if the received message is correct.
According to another aspect of the embodiments of the present invention, an electronic device for processing a message is provided, including:
one or more processors;
a storage device 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 implement the method for processing a message provided by the present invention.
According to still another aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, 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:
in the optional embodiment of the application, hardware (i.e., a network card) is used for calculating the check code of the message with one or more fixed lengths, and when the message with other lengths except the one or more fixed lengths needs to be transmitted, software can be used for generating the check code on the CPU, so that the technical defects that in the prior art, when the hardware is used for generating the check code, the requirement on hardware equipment is high in cost, and the time cost consumed when the software is used for generating the check code is high are overcome, and the check code generating efficiency is improved while the check code generating cost is reduced.
Further effects of the above-mentioned non-conventional alternatives will be 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 a main flow of a method for generating a transmission message according to an embodiment of the present invention;
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;
FIG. 3 is a schematic diagram of a main flow of processing a received packet according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a detailed flow of processing a received message according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a system for processing messages according to an embodiment of the present invention;
fig. 6 is a schematic diagram of main modules of an apparatus for generating a transmission 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 packet 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 employed;
fig. 9 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as 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 error checking code in the field of data communication includes, but is not limited to, one of three main methods, specifically, three methods include: parity check, hamming code, CRC Cyclic redundancy check (Cyclic redundancy check). When the CRC cyclic redundancy check code is used to generate the check code, the check code may be set at the tail of the input data.
In order to increase the computation speed of the check code, the prior art hardware generally adopts a parallel computation 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 bit width of the last data input by the message may be 1B-32B, so that the hardware needs to set another 31 modules for calculating check codes by hardware with different data bit widths. Furthermore, in the prior art, when the check code is calculated by using hardware, a high-performance network card needs to be used, and the high-performance network card has a complex structure and high cost, so the cost consumed by using the high-performance network card is high.
In the prior art, when a message is transmitted, the check code is calculated by software. The software calculation is to store the message in the memory corresponding to the CPU and the CPU calculates the check code of the input data. However, the technical defect of consuming the calculation power of the CPU is generated by calculating the check code by using software, and the technical defect of failing to meet the network transmission requirement of high bandwidth also exists.
In the optional embodiment of the application, hardware (i.e., a network card) is used for calculating the check code of the message with one or more fixed lengths, and when the message with other lengths except the one or more fixed lengths needs to be transmitted, software can be used for generating the check code on the CPU, so that the technical defects that in the prior art, when the hardware is used for generating the check code, the requirement on hardware equipment is high in cost, and the time cost consumed when the software is used for generating the check code is high are overcome, and the technical effect of improving the efficiency of generating the check code while the cost of generating the check code is reduced is achieved.
Specifically, fig. 1 is a schematic diagram of a main flow of a method for generating a transmission packet 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 quantity of input data and the number of preset check codes;
step S102, selecting a generation mode corresponding to the check code according to the value of the control information;
step S103, generating a check code according to the generating 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 step S104, generating a sending message according to the input data and the check code.
When the CPU sends a message, the CPU is used for judging the generation mode of generating the check code according to the length of the number of bytes in the input data. Specifically, if the network card does not support the calculation of the check codes of the number length of bytes in the input data, the software in the CPU is used for calculating the check codes, and then the check codes are spliced to the tail part of the input data and then sent to the network card for transmission; 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, a hardware part for realizing the steps can be simplified, namely the hardware part adopts a low-performance network card to perform partial operation of generating the check code, and further the cost for generating the check code by hardware is reduced. The scheme saves the hardware implementation cost under the condition of meeting the requirement of the same network transmission bandwidth.
In addition, the technical means that part of the check codes are calculated by the CPU is adopted, the technical problem that in the prior art, when the CPU is adopted to calculate all the input data check codes, the calculation pressure on the CPU is overlarge is solved, and the technical effects of improving the efficiency of calculating the check codes and reducing the calculation cost are achieved. According to the method and the device, the technical effect of meeting the current requirement on high-bandwidth transmission can be achieved by reducing the calculation amount of the CPU.
When the CPU determines the relationship between the number of bytes of the input data and the number of preset check codes, it can generate the setting control information for the input data. The control information may use 0 and 1, or other preset fields to indicate that the check code is set by using the network card and the check code is set by using 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 judgment result of a relationship between the number of bytes of the input data and the number of preset check codes and/or an identifier indicating whether a 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 does not have a preset relation with the number of preset check codes;
and the second control information value is used for indicating that the number of bytes of the input data has a preset relation with the number of preset check codes.
Specifically, the preset relationship includes, but is not limited to: the number of bytes of the input data is an integral multiple of the number of preset check codes, and other numbers can be added after the integral multiple.
The preset check code number refers to the number of bytes preset in the system for parallel computation, such as 32B.
When the number of bytes of the input data has a preset relationship with the number of preset check codes, the number of bytes may have various conditions, that is, the network card may generate check codes for one or more input data with different lengths. Because the network card adopted by the method only needs to realize the crc check of the messages with several lengths, and does not need to adopt a network card with higher performance, the method can improve the performance and can 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 relationship between the number of bytes of the input data and the number of preset check codes), a mode of generating a check code by using a central processing unit is set as a mode of generating a check code corresponding to the control information;
and when the value of the control information is a second control information value (namely, a preset relation exists between the byte quantity of the input data and the number of preset check codes), setting a mode of generating the check codes by adopting a network card as a generation mode of the check codes corresponding to the control information.
By setting the control information, when the software (CPU) finishes generating the check code, the 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, the appropriate technical means for generating the input data can be selected according to the length of the input data, and the efficiency of generating the check code is further improved.
Optionally, the calculation of the input data check code with small flow is implemented in software, and the calculation of the input data check code with large flow is implemented in special hardware, so that the integrity of the function of the network card is ensured, the transmission of input data with all lengths is supported, the transmission requirement of high bandwidth 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 relationship between the byte length judgment and the number of preset check codes;
s204, generating control information according to the relation; when it is determined that the relationship is 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 using a central processing unit, combining input data with the generated check code, sending the combined check code to a network card, and sending the combined check code to an external network in a transparent transmission mode in the network card;
s206, reading input data by adopting a network card; executing S207;
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;
and S206, generating a sending message according to the input data and the check code generated in the S207, and sending the sending message to an external network.
Fig. 3 shows a received packet processing method corresponding to a method for generating a transmission packet for input data, where fig. 3 is a schematic diagram of a main flow of processing a received packet according to an embodiment of the present invention. Specifically, the method comprises the following steps:
s301, acquiring a received message;
s302, selecting a verification mode of the received message according to the relation between the number of bytes in the received message and the number of preset verification codes; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
s303, verifying the received message according to the verification 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 Check mode is a Cyclic Redundancy Check (CRC) code, the Check code may 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 relationship with the number of the preset check codes, the input data still has a preset relationship with the preset check codes after the check codes are added to the input data. Therefore, when receiving the message, the mode of processing the received message can be selected at the network card end.
Specifically, selecting the check mode of the received message according to the relationship between the number of bytes in the received message and the number of preset check codes includes:
when the number of bytes in the received message is an integral 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 integral multiple of the number of preset check codes, the received message may be transmitted to a memory corresponding to the CPU in a transparent transmission mode, and the CPU is checked, specifically, the received message is checked by using the CPU.
Optionally, the verifying the received packet according to the verification method, and if the received packet is correct, storing the received packet includes:
verifying the received message according to the verification mode, and generating control information according to the verification mode; the value of the control information is a first control information value and a second control information value;
when the verification mode is to adopt a central processing unit for verification, the value of the control information is a first control information value;
when the verification mode is to adopt a network card for verification, 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 packet according to an embodiment of the present invention. As shown in fig. 4, the following describes a process for processing a received packet in detail according to a specific embodiment, including:
s401, receiving a message from an external network;
s402, selecting a verification mode of the received message according to the relation between the number of bytes in the received message and the number of preset verification codes; 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 a CPU (central processing unit) through a transparent transmission mode, checking the received message, if so, storing the received message, and generating control information for indicating a checking mode, otherwise, discarding the received message;
s404, verifying the received message by using a network card, if the received message is correct, storing the received message, generating control information for representing a verification mode, and storing the control information in a memory corresponding to a CPU (Central processing Unit); and if not, discarding the received message.
Fig. 5 is a schematic diagram of a system for processing messages 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 the sending message:
the central processing module is used for generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes; selecting a generation mode corresponding to the check code according to the value of the control information; when the value of the control information is the first control information value, generating a check code;
the network card module is used for generating a check code when the value of the control information is a 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 number of bytes of the input data is not an integral multiple of the number of preset check codes; the second control information value is used for indicating that the number of bytes of the input data is an integer of a preset check code number;
and/or the presence of a gas in the gas,
when the method is 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 number of bytes in the received message and the number of preset check codes; when the number of bytes in the received message is an integral 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 integral multiple of the number of preset check codes; and if the received message is correct, storing the received message.
Specifically, the method can also be used for a network protocol ROCEv2, wherein a check field corresponding to the network protocol ROCEv2 is named as 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 combining software and hardware provided by the application can also be suitable for sending and receiving a rocev2 protocol message. RoCE (RDMA over converted Ethernet) is a network protocol that allows Remote Direct Memory Access (RDMA) over Ethernet.
Fig. 6 is a schematic diagram of main modules of an apparatus for generating a transmission 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 the number of bytes of the input data and the number of preset check codes;
a check code generation mode determination module 602, configured to select a generation mode of a corresponding check code according to a 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 sending message generating module 604, configured to generate a sending 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 packet according to an embodiment of the present invention; as shown in fig. 7, there is provided an apparatus 700 for processing a received packet, including:
a received message acquiring module 701, configured to acquire a received message;
a received message processing mode determining module 702, configured to select a check mode of the received message according to a relationship between the number of bytes in the received message and a preset check code number; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
the received message storage module 703 is configured to check the received message according to the above-mentioned manner, and store the received message if the received message is correct.
Fig. 8 illustrates an exemplary system architecture 800 of a method for generating a send message, a method for processing a receive message, or an apparatus for generating a send message, and a method for processing a receive message, to which embodiments of the present invention may be applied.
As shown in fig. 8, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves to provide a medium for communication links between the terminal devices 801, 802, 803 and the server 805. Network 804 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 801, 802, 803 to interact with a server 805 over a network 804 to receive or send messages or the like. The terminal devices 801, 802, 803 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 801, 802, 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 805 may be a server that provides various services, such as a back-office management server (for example only) that supports shopping-like websites browsed by users using the terminal devices 801, 802, 803. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for generating a sending message and processing a receiving message provided by 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, shown is a block diagram of a computer system 900 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 9, the computer system 900 includes a central processing module (CPU)901 that can perform various appropriate actions and processes in accordance with 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 via a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
The following components are connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and 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 necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the 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 illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program performs the above-described functions defined in the system of the present invention when executed by the central processing module (CPU) 901.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present invention, 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, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 flowchart 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 described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described 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 form a limitation on the modules themselves in some cases, and for example, the sending module may also be described as a "module sending 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 separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes;
selecting a generation mode corresponding to the 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 of the embodiment of the invention, the following beneficial effects can be achieved:
in the optional embodiment of the application, hardware (i.e., a network card) is used for calculating the check code of the message with one or more fixed lengths, and when the message with other lengths except the one or more fixed lengths needs to be transmitted, software can be used for generating the check code on the CPU, so that the technical defects that in the prior art, when the hardware is used for generating the check code, the requirement on hardware equipment is high in cost, and the time cost consumed when the software is used for generating the check code is high are overcome, and the technical effect of improving the efficiency of generating the check code is achieved while the cost of generating the check code is reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for generating a transmission message, comprising:
generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes;
selecting a generation mode corresponding to the 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.
2. The method of claim 1, wherein the values of the control information comprise: 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 does not have a preset relation with the number of preset check codes;
and the second control information value is used for indicating that the number of bytes of the input data has a preset relation with the number of preset check codes.
3. The method of claim 2, wherein selecting a generation manner of the corresponding check code according to a value of the control information comprises:
when the value of the control information is a 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 a second control information value, a mode of generating a check code by a network card is adopted.
4. A method for processing a received packet, comprising:
acquiring a received message;
selecting a verification mode of the received message according to the relation between the number of bytes in the received message and the number of preset verification codes; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
and checking the received message according to the checking mode, and if the received message is correct, storing the received message.
5. The method according to claim 4, wherein selecting the check mode of the received packet according to the relationship between the number of bytes in the received packet and the number of preset check codes comprises:
when the number of bytes in the received message has a preset relationship with the number of preset check codes, checking the received message by adopting a network card;
and when the number of bytes in the received message does not have a preset relation with the number of preset check codes, checking the received message by adopting a central processing unit.
6. The method according to claim 5, wherein the checking the received packet according to the checking method, and if the received packet is correct, storing the received packet includes:
verifying the received message according to the verification mode, and generating control information according to the verification mode;
if the received message is correct, the received message and corresponding control information are combined and stored;
when the verification mode is that the central processing unit is used for verification, the value of the control information is a first control information value; and when the checking mode is to adopt a network card for checking, the value of the control information is a second control information value.
7. A system for processing messages, comprising: the central processing module and the network card module;
when the method is applied to generating the sending message:
the central processing module is used for generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes; selecting a generation mode corresponding to the check code according to the value of the control information; when the value of the control information is the first control information value, generating a check code;
the network card module is used for generating a check code when the value of the control information is a 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 number of bytes of the input data is not an integral multiple of the number of preset check codes; the second control information value is used for indicating that the number of bytes of the input data is an integer of a preset check code number;
and/or the presence of a gas in the gas,
when the method is 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 number of bytes in the received message and the number of preset check codes; when the number of bytes in the received message is an integral 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 integral multiple of the number of preset check codes; and if the received message is correct, storing the received message.
8. An apparatus for generating a transmission message, comprising:
the control information generating module is used for generating control information according to the relation between the byte quantity of the input data and the number of the preset check codes;
the check code generation mode determining module is used for selecting a generation mode corresponding to the check code according to the value of the control information;
the check code generating module is used for generating a check code according to the generating 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.
9. An apparatus for processing a received message, comprising:
a received message acquisition module, configured to acquire a received message;
a received message processing mode determining module, configured to select a check mode of the received message according to a relationship between the number of bytes in the received message and a preset check code number; the processing mode of the received message comprises the following steps: adopting a central processing unit for checking and adopting a network card for checking;
and the received message storage module is used for verifying the received message according to the mode and storing the received message if the received message is correct.
10. An electronic device for processing messages, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
11. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
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 true CN111800223A (en) 2020-10-20
CN111800223B 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)

Cited By (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
CN117318892A (en) * 2023-11-27 2023-12-29 阿里云计算有限公司 Computing system, data processing method, network card, host computer and storage medium

Citations (8)

* 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
US6968492B1 (en) * 2002-03-28 2005-11-22 Annadurai Andy P Hardware-efficient CRC generator for high speed communication networks
CN101789044A (en) * 2010-01-27 2010-07-28 武汉大学 Method of implementing cooperative work of software and hardware of genetic algorithm
US20100241936A1 (en) * 2009-03-23 2010-09-23 Teknovus, Inc. Method and apparatus for calculating frame check sequence
US20120102382A1 (en) * 2009-05-25 2012-04-26 Zte Corporation Method and Device for Fast Cyclic Redundancy Check Coding
CN102708022A (en) * 2005-12-23 2012-10-03 英特尔公司 Performing a cyclic redundancy checksum operation responsive to a user-level instruction
CN103701566A (en) * 2013-12-18 2014-04-02 华为技术有限公司 Check method and check device
CN105790887A (en) * 2014-12-26 2016-07-20 上海贝尔股份有限公司 Method and device for generating parallel CRC values for packets

Patent Citations (8)

* 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
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
US20100241936A1 (en) * 2009-03-23 2010-09-23 Teknovus, Inc. Method and apparatus for calculating frame check sequence
US20120102382A1 (en) * 2009-05-25 2012-04-26 Zte Corporation Method and Device for Fast Cyclic Redundancy Check Coding
CN101789044A (en) * 2010-01-27 2010-07-28 武汉大学 Method of implementing cooperative work of software and hardware of genetic algorithm
CN103701566A (en) * 2013-12-18 2014-04-02 华为技术有限公司 Check method and check device
CN105790887A (en) * 2014-12-26 2016-07-20 上海贝尔股份有限公司 Method and device for generating parallel CRC values for packets

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
栗文彬,罗二平,申浩广: "《军队卫生装备基础知识》", 31 December 2013 *
肖艳艳等: "基于FPGA的CRC算法的串行和并行实现", 《合肥工业大学学报(自然科学版)》 *

Cited By (3)

* 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
CN117318892A (en) * 2023-11-27 2023-12-29 阿里云计算有限公司 Computing system, data processing method, network card, host computer and storage medium
CN117318892B (en) * 2023-11-27 2024-04-02 阿里云计算有限公司 Computing system, data processing method, network card, host computer and storage medium

Also Published As

Publication number Publication date
CN111800223B (en) 2023-06-23

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
CN113010405A (en) Application program testing method and device
CN112905930A (en) Interface request retransmission method and device
EP4180985A1 (en) File sharing method, apparatus, and system
CN112084042A (en) Message processing method and device
CN110324384B (en) Data pushing method and device
CN112948138A (en) Method and device for processing message
CN114979295A (en) Gateway management method and device
CN112688982B (en) User request processing method and device
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN110019671B (en) Method and system for processing real-time message
CN112163176A (en) Data storage method and device, electronic equipment and computer readable medium
CN113722193A (en) Method and device for detecting page abnormity
CN113132480B (en) Data transmission method, device and system
CN113360815A (en) Request retry method and device
CN113852484B (en) Terminal equipment network distribution method, device, electronic equipment and computer readable medium
CN113766437B (en) Short message sending method and device
CN110262756B (en) Method and device for caching data
CN111950232B (en) Method and device for automatically switching number segments
CN113656104A (en) Data processing method and device
CN115422067A (en) Interface testing method and device
CN112988408A (en) Multi-terminal interaction method and device
CN117692399A (en) Message uploading method and device
CN114064314A (en) Service message processing method, system, electronic device and computer readable medium

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