CN114390004A - Message processing method, system, device and medium - Google Patents

Message processing method, system, device and medium Download PDF

Info

Publication number
CN114390004A
CN114390004A CN202210291901.5A CN202210291901A CN114390004A CN 114390004 A CN114390004 A CN 114390004A CN 202210291901 A CN202210291901 A CN 202210291901A CN 114390004 A CN114390004 A CN 114390004A
Authority
CN
China
Prior art keywords
message
data packet
sent
length
set value
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.)
Pending
Application number
CN202210291901.5A
Other languages
Chinese (zh)
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.)
Chengdu Shulian Cloud Computing Technology Co ltd
Original Assignee
Chengdu Shulian Cloud Computing 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 Chengdu Shulian Cloud Computing Technology Co ltd filed Critical Chengdu Shulian Cloud Computing Technology Co ltd
Priority to CN202210291901.5A priority Critical patent/CN114390004A/en
Publication of CN114390004A publication Critical patent/CN114390004A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/36Flow control; Congestion control by determining packet size, e.g. maximum transfer unit [MTU]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Abstract

The invention discloses a message processing method, a system, a device and a medium, which relate to the field of data transmission and comprise the following steps: obtaining a first message to be sent from a message queue; obtaining a set value of a maximum transmission unit; calculating the quantity M of the first message to be sent needing unpacking based on the length of the first message to be sent and the set value; splitting the first message to be sent into M data packets: data packet 1 to data packet M; if the length of the data packet M is equal to the set value, sending the data packets 1 to M; if the length of the data packet M is smaller than the set value, sending the data packet 1 to the data packet M-1, judging whether the messages in the message queue meet the filling condition, if so, taking the messages out of the message queue to fill the data packet M, and sending the filled data packet M; the invention fully utilizes the load capacity agreed by MTU and improves the sending efficiency.

Description

Message processing method, system, device and medium
Technical Field
The present invention relates to the field of data transmission, and in particular, to a method, a system, an apparatus, and a medium for processing a packet.
Background
In the OSI (open systems interconnection) reference model, network transport layer protocols are divided into TCP and UDP. UDP (user datagram protocol) provides a method for transmitting data without establishing a connection, and has the advantage of high transmission efficiency and the disadvantage of easy data loss. The maximum length of the UDP packet is limited to 64K, and when the length of the packet is greater than 64K, the UDP packet needs to be split into a plurality of data packets to be sent respectively. The sending of the UDP message is limited by MTU (maximum transmission unit), and when the length of the UDP message is larger than the set value of MTU, the UDP message can be split into a plurality of packets to be sent respectively.
When the UDP message is larger than the MTU set value, one scheme is that the UDP message is delivered to a link layer for unpacking; another solution is that the application program splits the UDP packet into a plurality of packets smaller than the MTU setting.
Unpacking the UDP message at a link layer: the maximum length of the UDP message is 65535 bytes, and the MTU is set to be 1500 bytes. When the length of the UDP message is larger than the set length of the MTU, the UDP message at the sending end is split into a plurality of packets according to the set length of the MTU for sending; meanwhile, the receiving end receives a plurality of packets at the MTU layer, and finally the packets are assembled into a complete UDP message.
The scheme has the following defects: after the UDP packet is unpacked, the length M of the last packet may be much smaller than the set length N of the MTU, for example: m =10, N =1500, and the difference is 1490, i.e., only a small portion of the available load N is used, and the utilization efficiency is not improved.
Disclosure of Invention
The invention aims to fully utilize the load capacity agreed by MTU and improve the sending efficiency.
In order to achieve the above object, the present invention provides a method for processing a packet, where the method includes:
obtaining a first message to be sent from a message queue;
obtaining a set value of a maximum transmission unit;
calculating the number M of the first message to be sent needing unpacking based on the length of the first message to be sent and the set value, wherein M is an integer larger than 1;
splitting the first message to be sent into M data packets, which are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value;
if the length of the data packet M is equal to the set value, sending the data packets 1 to M;
if the length of the data packet M is smaller than the set value, the data packet 1 to the data packet M-1 are sent, whether the messages in the message queue meet the filling condition is judged, if yes, the messages are taken out from the message queue to be filled into the data packet M, and the filled data packet M is sent.
The principle of the invention is as follows: firstly, obtaining a first message to be sent from a message queue and obtaining a set value of a maximum transmission unit; then calculating the number M of the first message to be sent needing unpacking according to the length of the first message to be sent and the set value; then, splitting the first to-be-sent message into M data packets, which are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value; if the length of the data packet M is equal to the set value, namely the data packet M can be just completely split and has no residual data, the data packet M from the data packet 1 is sent; if the length of the data packet M is smaller than the set value, the data packet M is directly sent in a traditional mode, but the load capacity agreed by the MTU is not fully utilized, so that the resource waste is caused.
Preferably, the method determines whether the messages in the message queue satisfy the filling condition, and if so, takes out the messages from the message queue to fill the messages into the data packet M, and sends the filled data packet M, and specifically includes:
a calculation step: calculating a length K of a remaining transmission space of the maximum transmission unit based on the length of the packet M and the set value;
a judging step: judging whether a second message to be sent with the length less than or equal to K exists in the message queue; if the message to be sent exists, filling the second message to be sent to the tail of the data packet M, updating the length of the data packet M, and then returning to execute the calculating step and then executing the judging step; if not, the data packet M is sent.
When the length of the data packet M is smaller than the set value, the MTU has available a corresponding space, and the method first calculates the length K of the remaining transmission space of the maximum transmission unit, then judges whether a second message to be sent with a length smaller than or equal to K exists in the message queue, i.e., searches whether a message to be sent that can utilize the remaining transmission space still exists, if so, adds the message into the data packet, then updates the length of the remaining transmission space, then continuously searches whether a message to be sent with a suitable length can be inserted into the remaining transmission space, if so, continuously inserts the message, and if not, sends the last data packet M.
Preferably, before the step of obtaining the first message to be sent from the message queue, the method further includes: and logically sequencing the messages to be sent, and writing the sequenced messages to be sent into the message queue.
The purpose of ordering the messages to be sent is to preprocess the data sending sequence and ensure that the data received by the receiver is also the sequence sent by the sender within a certain range.
The message queue provides a function of reading in sequence, and the message sending program can sequentially obtain messages to be sent from the message queue according to the function.
Preferably, the message in the method is a UDP message, and the method sends the UDP message through a user data packet protocol.
Preferably, the length of the data packet M is P, the maximum transmission unit setting value is Q, and K = Q-P.
Preferably, after splitting the first to-be-sent packet into M data packets, the method further includes: predefining a message header for each split data packet, wherein the length of the message header is N; wherein, the 1 st byte of the message header represents the coding mode adopted by the message, the 2 nd byte of the message header represents the value of N, the 3 rd to 4 th bytes of the message header represent the data length of the message body except the message header, and the 5 th to N th bytes of the message header are used for expanding application.
Preferably, the method further comprises: after receiving the data packets 1 to M, the message receiving end processes the message headers of the data packets 1 to M, including:
analyzing the 1 st byte of the data packet to obtain the coding mode of the message;
analyzing the 2 nd byte of the data packet to obtain the length of a message header, and taking out the message header from the data packet according to the length of the message header;
analyzing the 3 rd to 4 th bytes of the message header to obtain the length of the message body, and removing the message body from the data packet according to the length of the message body;
and analyzing the 5 th-N bytes of the message header to obtain the extended application data.
The main purpose of the header is to provide a brief description of the subsequent body of the message, which may have the meaning of the art or the meaning of the service. By introducing the message header, for the message receiving end, convenience can be provided for the processing of subsequent message bodies by analyzing the content of the message header.
The invention also provides a message processing system, which comprises:
a first obtaining unit, configured to obtain a first message to be sent from a message queue;
a second obtaining unit for obtaining a setting value of a maximum transmission unit;
a calculating unit, configured to calculate, based on the length of the first to-be-sent message and the set value, a number M of the first to-be-sent messages that need to be unpacked, where M is an integer greater than 1;
a splitting unit, configured to split the first to-be-sent message into M data packets, where the M data packets are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value;
a first sending unit, configured to send a data packet 1 to a data packet M if the length of the data packet M is equal to the set value;
and the filling unit is used for sending the data packet 1 to the data packet M-1 if the length of the data packet M is smaller than the set value, judging whether the messages in the message queue meet the filling condition, taking out the messages from the message queue to fill the data packet M if the messages in the message queue meet the filling condition, and sending the filled data packet M.
The invention also provides a message processing device, which comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, and is characterized in that the steps of the message processing method are realized when the processor executes the computer program.
The invention also provides a computer-readable storage medium, which stores a computer program, characterized in that the computer program realizes the steps of the message processing method when being executed by a processor.
One or more technical schemes provided by the invention at least have the following technical effects or advantages:
the invention can fully utilize the load capacity agreed by MTU and improve the sending efficiency.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention;
fig. 1 is a schematic flow chart of a message processing method;
FIG. 2 is a schematic diagram of a packet header grouping process;
FIG. 3 is a schematic diagram of a header unpacking process;
fig. 4 is a schematic diagram of the components of the message processing system.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflicting with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described and thus the scope of the present invention is not limited by the specific embodiments disclosed below.
It should be understood that "system", "device", "unit" and/or "module" as used herein is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, other words may be substituted by other expressions if they accomplish the same purpose.
As used in this specification and the appended claims, the terms "a," "an," "the," and/or "the" are not intended to be inclusive in the singular, but rather are intended to be inclusive in the plural, unless the context clearly dictates otherwise. In general, the terms "comprises" and "comprising" merely indicate that steps and elements are included which are explicitly identified, that the steps and elements do not form an exclusive list, and that a method or apparatus may include other steps or elements.
Flow charts are used in this description to illustrate operations performed by a system according to embodiments of the present description. It should be understood that the preceding or following operations are not necessarily performed in the exact order in which they are performed. Rather, the various steps may be processed in reverse order or simultaneously. Meanwhile, other operations may be added to the processes, or a certain step or several steps of operations may be removed from the processes.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart of a message processing method, where an embodiment of the present invention provides a message processing method, where the method includes:
obtaining a first message to be sent from the message queue, if the message queue includes: a message to be sent 1, a message to be sent 2, a message to be sent 3, a message to be sent n;
obtaining a set value of the maximum transmission unit, wherein the specific set value can be flexibly set according to actual needs, and the set value is 3;
calculating the quantity M of the first message to be sent needing unpacking based on the length of the first message to be sent and the set value, wherein M is an integer larger than 1, the first message to be sent is a message 1 to be sent, and the length of the message 1 to be sent is 10;
splitting the first message to be sent into M data packets, which are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value, and the lengths are data packets 1 to M-3;
if the length of the data packet M is equal to the set value, sending the data packets 1 to M;
if the length of the data packet M is smaller than the set value, the data packet 1 to the data packet M-1 are sent, whether the messages in the message queue meet the filling condition is judged, if yes, the messages are taken out from the message queue to be filled into the data packet M, and the filled data packet M is sent.
At this time, the data packet is split into 4 data packets, which are respectively data packet 1 to data packet 4, wherein the length of data packet 4 is 1 less than the set value 3, then the message can be taken out from the message queue and filled into data packet 4, and the filled data packet 4 is sent.
The real-time mode of the invention is described in detail below in terms of unpacking and packing, respectively:
step 1: and carrying out logic sequencing on the messages to be sent. The multiple messages to be sent generally have a logical sequence, which may be time sequence, self-sequence number sequence, or other conditions. The purpose of ordering the messages to be sent is to preprocess the data sending sequence and ensure that the data received by the receiver is also the sequence sent by the sender within a certain range.
Step 2: and (4) writing the messages to be sent which are sequenced according to the step (1) into a message queue. The message queue provides a function of reading in sequence, and the message sending program can sequentially obtain messages to be sent from the message queue according to the function.
And step 3: and the message sending program takes out the first message to be sent from the queue.
Step 3.1: and acquiring an MTU set value.
Step 3.2: and calculating the number of the packets to be split according to the length of the message to be sent and the MTU set value, and splitting the packets into a plurality of data packets. The calculation method of the number of the split packets may be as follows: assuming that the length of the UDP message is 4096 bytes, the MTU is set to 1500. The number of unpacks is equal to 4096/1500=2.73 rounded to 2, and when the remainder is not 0, the result is incremented by 1, i.e. the number of unpacks is 3.
Step 3.3: judging the length of the last split data packet, and if the length of the last split data packet is equal to the length of the MTU set value, sending all split data packets through the step 4; and if the length is smaller than the length of the MTU set value, jumping to the step 5.
And 4, step 4: and sending a plurality of split packets through UDP.
And 5: and (3) when the length of the last data packet after splitting in the step (3.3) is smaller than the set value of the MTU, screening the next message to be sent from the queue to be sent, filling the message to the tail of the packet, and skipping to the step (4) for sending.
Screening and filling logic: and 3.3, the length of the last data packet after splitting is assumed to be P, and the set value of the MTU is Q. The available space length K = Q-P. Screening messages with the message length L being less than or equal to K from a queue to be sent, selecting the 1 st message to fill the tail of the packet when the messages with the message length L being less than or equal to K exist, simultaneously recalculating the value P (new value) = P (old value) + L, Q = K-P (new value), and repeating the step of screening from the queue; and when the message with the L less than or equal to K does not exist, the last data packet is directly sent.
Referring to fig. 2, the packet header grouping method is:
if the message to be sent needs to be unpacked, a message header needs to be predefined for each split packet. The length of the message header is N, and dynamic expansion is supported.
The 1 st byte of the message header indicates that the message adopts large-end or small-end coding. The encoding appoints the encoding processing mode of the subsequent message starting from the 2 nd byte of the message header.
The 2 nd byte of the message header represents the specific value of the message header N, i.e. clearly identifies the length of the message header.
The 3 rd to 4 th bytes of the message header indicate the data length of the message body except the message header, namely the byte number of the message body.
And 5-N bytes of a message header are used as an extended application.
Referring to fig. 3, the packet header unpacking method is:
unpacking the message header is the process of parsing after the receiving end receives the data packet.
And analyzing the 1 st byte of the data packet, and judging whether the message adopts large-end or small-end coding.
And analyzing the 2 nd byte of the data packet, judging the length of the message header, and taking out the complete message header from the whole data packet according to the length.
And analyzing the 3 rd to 4 th bytes of the message header, judging the length of the message body, and taking out the complete message body from the whole data packet according to the length.
And analyzing the 5 th byte to the N th byte of the message header as the extended application.
The purpose of packet and unpacking of the message header is as follows: the main purpose of the header is to provide a brief description of the subsequent body of the message, which may have the meaning of the art or the meaning of the service. By introducing the message header, for the message receiving end, convenience can be provided for the processing of subsequent message bodies by analyzing the content of the message header.
The message header definition in the invention has the following technical meanings:
1. in the network transmission process of the message, two situations of Big Endian (Big Endian) and Little Endian (Little Endian) exist. Through the 1 st byte of the message header, whether the subsequent data of the message adopts big-end byte order or small-end byte order can be represented. After receiving the message, the receiving end can judge the byte order through the 1 st byte of the message header, and has the capability of adaptively processing the big-end byte order message and the small-end byte order message.
2. The length of the header can be obtained through the 2 nd byte of the header. The message header supports non-fixed length and has the capability of dynamic expansion. According to the length, the memory space with the specified length can be allocated for the subsequent message header processing, and the allocation of invalid space is avoided.
3. The length of the message body can be obtained through 3-4 bytes of the message header. The purpose thereof is in accordance with the above point 2.
When a UDP protocol is adopted for message sending, the message can be grouped and unpacked according to the MTU, the size of each packet is a fixed value, and the actual data length of the last data packet after the unpacking may be smaller than the fixed length, so that the situation that the space of the packet is not effectively utilized is caused. When large data volume messaging is involved, the aforementioned drawbacks lead to an increase in the number of message transmissions, with a consequent increase in time and a decrease in efficiency. For example, assume that the MTU value is 1500, the length of the message to be sent is 1600, and the number of the messages to be sent is 10. Each message needs to be unpacked into 2 data packets, wherein the length of one data packet is 1500, the length of the other data packet is 100, the 10 messages account for 20 data packets, and the sending times are 20 times.
By filling effective data in the last split data packet, the space of the packet is fully utilized, the times of message sending are reduced, and the sending efficiency is improved.
For example, assume that the MTU value is 1500, the length of the message to be sent is 1600, and the number of the messages to be sent is 10. By the filling means, the length of each packet is 1500, the length of the last packet is 1000, 11 data packets are counted, and the transmission times are 11 times.
After the UDP packet adopts the unpacking scheme, the same header protocol needs to be defined at the sending end and the receiving end, and the integrity processing of the packet can be realized on the basis. The message header adopts a variable length mechanism, and the core of the variable length mechanism is that the 1 st byte defines encoding, the 2 nd byte defines the length of the message header, the 3 rd to 4 th bytes define the length of the message body, and the 5 th to N th bytes can be used as an extension of application.
Example two
Referring to fig. 4, fig. 4 is a schematic diagram of a packet processing system, and a second embodiment of the present invention provides a packet processing system, where the system includes:
a first obtaining unit, configured to obtain a first message to be sent from a message queue;
a second obtaining unit for obtaining a setting value of a maximum transmission unit;
a calculating unit, configured to calculate, based on the length of the first to-be-sent message and the set value, a number M of the first to-be-sent messages that need to be unpacked, where M is an integer greater than 1;
a splitting unit, configured to split the first to-be-sent message into M data packets, where the M data packets are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value;
a first sending unit, configured to send a data packet 1 to a data packet M if the length of the data packet M is equal to the set value;
and the filling unit is used for sending the data packet 1 to the data packet M-1 if the length of the data packet M is smaller than the set value, judging whether the messages in the message queue meet the filling condition, taking out the messages from the message queue to fill the data packet M if the messages in the message queue meet the filling condition, and sending the filled data packet M.
EXAMPLE III
A third embodiment of the present invention provides a message processing apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the message processing method when executing the computer program.
Example four
A fourth embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the message processing method are implemented.
The processor may be a Central Processing Unit (CPU), or other general-purpose processor, a digital signal processor (digital signal processor), an Application Specific Integrated Circuit (Application Specific Integrated Circuit), an off-the-shelf programmable gate array (field programmable gate array) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be used for storing the computer programs and/or modules, and the processor may implement various functions of the message processing apparatus in the invention by operating or executing data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, at least one magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
The message processing device, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of implementing the embodiments of the present invention may also be stored in a computer readable storage medium through a computer program, and when the computer program is executed by a processor, the computer program may implement the steps of the above-described method embodiments. Wherein the computer program comprises computer program code, an object code form, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying said computer program code, a recording medium, a usb-disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, a point carrier signal, a telecommunications signal, a software distribution medium, etc. It should be noted that the computer readable medium may contain content that is appropriately increased or decreased as required by legislation and patent practice in the jurisdiction.
While the invention has been described with respect to the basic concepts, it will be apparent to those skilled in the art that the foregoing detailed disclosure is only by way of example and not intended to limit the invention. Various modifications, improvements and adaptations to the present description may occur to those skilled in the art, although not explicitly described herein. Such modifications, improvements and adaptations are proposed in the present specification and thus fall within the spirit and scope of the exemplary embodiments of the present specification.
Also, the description uses specific words to describe embodiments of the description. Reference throughout this specification to "one embodiment," "an embodiment," and/or "some embodiments" means that a particular feature, structure, or characteristic described in connection with at least one embodiment of the specification is included. Therefore, it is emphasized and should be appreciated that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, some features, structures, or characteristics of one or more embodiments of the specification may be combined as appropriate.
Moreover, those skilled in the art will appreciate that aspects of the present description may be illustrated and described in terms of several patentable species or situations, including any new and useful combination of processes, machines, manufacture, or materials, or any new and useful improvement thereof. Accordingly, aspects of this description may be performed entirely by hardware, entirely by software (including firmware, resident software, micro-code, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data block," module, "" engine, "" unit, "" component, "or" system. Furthermore, aspects of the present description may be represented as a computer product, including computer readable program code, embodied in one or more computer readable media.
The computer storage medium may comprise a propagated data signal with the computer program code embodied therewith, for example, on baseband or as part of a carrier wave. The propagated signal may take any of a variety of forms, including electromagnetic, optical, etc., or any suitable combination. A computer storage medium may be any computer-readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code located on a computer storage medium may be propagated over any suitable medium, including radio, cable, fiber optic cable, RF, or the like, or any combination of the preceding.
Computer program code required for the operation of various portions of this specification may be written in any one or more programming languages, including an object oriented programming language such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C + +, C #, VB.NET, Python, and the like, a conventional programming language such as C, Visual Basic, Fortran 2003, Perl, COBOL 2002, PHP, ABAP, a dynamic programming language such as Python, Ruby, and Groovy, or other programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any network format, such as a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet), or in a cloud computing environment, or as a service, such as a software as a service (SaaS).
Additionally, the order in which the elements and sequences of the process are recited in the specification, the use of alphanumeric characters, or other designations, is not intended to limit the order in which the processes and methods of the specification occur, unless otherwise specified in the claims. While various presently contemplated embodiments of the invention have been discussed in the foregoing disclosure by way of example, it is to be understood that such detail is solely for that purpose and that the appended claims are not limited to the disclosed embodiments, but, on the contrary, are intended to cover all modifications and equivalent arrangements that are within the spirit and scope of the embodiments herein. For example, although the system components described above may be implemented by hardware devices, they may also be implemented by software-only solutions, such as installing the described system on an existing server or mobile device.
Similarly, it should be noted that in the preceding description of embodiments of the present specification, various features are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure aiding in the understanding of one or more of the embodiments. This method of disclosure, however, is not intended to imply that more features than are expressly recited in a claim. Indeed, the embodiments may be characterized as having less than all of the features of a single embodiment disclosed above.
For each patent, patent application publication, and other material, such as articles, books, specifications, publications, documents, etc., cited in this specification, the entire contents of each are hereby incorporated by reference into this specification. Except where the application history document does not conform to or conflict with the contents of the present specification, it is to be understood that the application history document, as used herein in the present specification or appended claims, is intended to define the broadest scope of the present specification (whether presently or later in the specification) rather than the broadest scope of the present specification. It is to be understood that the descriptions, definitions and/or uses of terms in the accompanying materials of this specification shall control if they are inconsistent or contrary to the descriptions and/or uses of terms in this specification.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A message processing method is characterized by comprising the following steps:
obtaining a first message to be sent from a message queue;
obtaining a set value of a maximum transmission unit;
calculating the number M of the first message to be sent needing unpacking based on the length of the first message to be sent and the set value, wherein M is an integer larger than 1;
splitting the first message to be sent into M data packets, which are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value;
if the length of the data packet M is equal to the set value, sending the data packets 1 to M;
if the length of the data packet M is smaller than the set value, the data packet 1 to the data packet M-1 are sent, whether the messages in the message queue meet the filling condition is judged, if yes, the messages are taken out from the message queue to be filled into the data packet M, and the filled data packet M is sent.
2. The method according to claim 1, wherein determining whether the packets in the message queue satisfy the filling condition, if yes, taking out the packets from the message queue to fill in the data packet M, and sending the filled data packet M, specifically includes:
a calculation step: calculating a length K of a remaining transmission space of the maximum transmission unit based on the length of the packet M and the set value;
a judging step: judging whether a second message to be sent with the length less than or equal to K exists in the message queue; if the message to be sent exists, filling the second message to be sent to the tail of the data packet M, updating the length of the data packet M, and then returning to execute the calculating step and then executing the judging step; if not, the data packet M is sent.
3. The message processing method according to claim 1, wherein before the step of obtaining the first message to be sent from the message queue, the method further comprises: and logically sequencing the messages to be sent, and writing the sequenced messages to be sent into the message queue.
4. The message processing method according to claim 1, wherein the message in the method is a UDP message, and the method sends the UDP message through a user datagram protocol.
5. The message processing method according to claim 2, wherein the length of the data packet M is P, the maximum transmission unit setting value is Q, and K = Q-P.
6. The message processing method according to claim 1, wherein after splitting the first message to be sent into M data packets, the method further comprises: predefining a message header for each split data packet, wherein the length of the message header is N; wherein, the 1 st byte of the message header represents the coding mode adopted by the message, the 2 nd byte of the message header represents the value of N, the 3 rd to 4 th bytes of the message header represent the data length of the message body except the message header, and the 5 th to N th bytes of the message header are used for expanding application.
7. The message processing method according to claim 6, wherein the method further comprises: after receiving the data packets 1 to M, the message receiving end processes the message headers of the data packets 1 to M, including:
analyzing the 1 st byte of the data packet to obtain the coding mode of the message;
analyzing the 2 nd byte of the data packet to obtain the length of a message header, and taking out the message header from the data packet according to the length of the message header;
analyzing the 3 rd to 4 th bytes of the message header to obtain the length of the message body, and removing the message body from the data packet according to the length of the message body;
and analyzing the 5 th-N bytes of the message header to obtain the extended application data.
8. A message processing system, the system comprising:
a first obtaining unit, configured to obtain a first message to be sent from a message queue;
a second obtaining unit for obtaining a setting value of a maximum transmission unit;
a calculating unit, configured to calculate, based on the length of the first to-be-sent message and the set value, a number M of the first to-be-sent messages that need to be unpacked, where M is an integer greater than 1;
a splitting unit, configured to split the first to-be-sent message into M data packets, where the M data packets are respectively: data packets 1 to M, wherein the lengths of the data packets 1 to M-1 are all equal to the set value;
a first sending unit, configured to send a data packet 1 to a data packet M if the length of the data packet M is equal to the set value;
and the filling unit is used for sending the data packet 1 to the data packet M-1 if the length of the data packet M is smaller than the set value, judging whether the messages in the message queue meet the filling condition, taking out the messages from the message queue to fill the data packet M if the messages in the message queue meet the filling condition, and sending the filled data packet M.
9. A message processing apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the message processing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the message processing method according to any one of claims 1 to 7.
CN202210291901.5A 2022-03-24 2022-03-24 Message processing method, system, device and medium Pending CN114390004A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210291901.5A CN114390004A (en) 2022-03-24 2022-03-24 Message processing method, system, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210291901.5A CN114390004A (en) 2022-03-24 2022-03-24 Message processing method, system, device and medium

Publications (1)

Publication Number Publication Date
CN114390004A true CN114390004A (en) 2022-04-22

Family

ID=81204805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210291901.5A Pending CN114390004A (en) 2022-03-24 2022-03-24 Message processing method, system, device and medium

Country Status (1)

Country Link
CN (1) CN114390004A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979040A (en) * 2022-05-07 2022-08-30 成都数之联科技股份有限公司 UDP message writing method, system, device and medium
CN115941675A (en) * 2023-03-14 2023-04-07 成都数联云算科技有限公司 UDP (user Datagram protocol) large file message sending method, system, device and medium
CN117279041A (en) * 2023-11-20 2023-12-22 武汉星纪魅族科技有限公司 Data transmission method, data reception method, data transmission device, data reception medium, and program product

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079805A (en) * 2006-05-25 2007-11-28 华为技术有限公司 Transmission method and system of multi-queue packet data
CN101729088A (en) * 2009-11-30 2010-06-09 西安空间无线电技术研究所 Data transmission method based on AOS encoding
US20100150062A1 (en) * 2008-09-12 2010-06-17 Telefonaktiebolaget Lm Ericsson (Publ) Packet Indicator for RLC Protocol
WO2012162949A1 (en) * 2011-08-17 2012-12-06 华为技术有限公司 Packet reassembly and resequence method, apparatus and system
US20180219984A1 (en) * 2015-07-17 2018-08-02 Sanechips Technology Co., Ltd. Packet slicing method and apparatus, and computer-readable medium
CN111030985A (en) * 2019-10-29 2020-04-17 视联动力信息技术股份有限公司 Data packet sending method and device
CN113141520A (en) * 2020-01-17 2021-07-20 北京达佳互联信息技术有限公司 Video stream transmission method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079805A (en) * 2006-05-25 2007-11-28 华为技术有限公司 Transmission method and system of multi-queue packet data
US20100150062A1 (en) * 2008-09-12 2010-06-17 Telefonaktiebolaget Lm Ericsson (Publ) Packet Indicator for RLC Protocol
CN101729088A (en) * 2009-11-30 2010-06-09 西安空间无线电技术研究所 Data transmission method based on AOS encoding
WO2012162949A1 (en) * 2011-08-17 2012-12-06 华为技术有限公司 Packet reassembly and resequence method, apparatus and system
US20180219984A1 (en) * 2015-07-17 2018-08-02 Sanechips Technology Co., Ltd. Packet slicing method and apparatus, and computer-readable medium
CN111030985A (en) * 2019-10-29 2020-04-17 视联动力信息技术股份有限公司 Data packet sending method and device
CN113141520A (en) * 2020-01-17 2021-07-20 北京达佳互联信息技术有限公司 Video stream transmission method and device, electronic equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979040A (en) * 2022-05-07 2022-08-30 成都数之联科技股份有限公司 UDP message writing method, system, device and medium
CN114979040B (en) * 2022-05-07 2024-02-20 成都数之联科技股份有限公司 UDP message writing method, system and device and medium
CN115941675A (en) * 2023-03-14 2023-04-07 成都数联云算科技有限公司 UDP (user Datagram protocol) large file message sending method, system, device and medium
CN115941675B (en) * 2023-03-14 2023-05-05 成都数联云算科技有限公司 UDP large file message sending method, system and device and medium
CN117279041A (en) * 2023-11-20 2023-12-22 武汉星纪魅族科技有限公司 Data transmission method, data reception method, data transmission device, data reception medium, and program product

Similar Documents

Publication Publication Date Title
CN114390004A (en) Message processing method, system, device and medium
CN109426574A (en) Distributed computing system, data transmission method and device in distributed computing system
US11917038B2 (en) Methods and apparatus to compress packets in a computing environment
US20190356717A1 (en) Multimedia file processing
US10075501B2 (en) Method and device for processing web requests
CN109977822B (en) Data supply method, model training method, device, system, equipment and medium
US8990422B1 (en) TCP segmentation offload (TSO) using a hybrid approach of manipulating memory pointers and actual packet data
CN115349121A (en) Method and device for processing stateful service
CN115037814B (en) TCP/UDP checksum determining method based on FPGA hardware acceleration
CN112230956A (en) Artificial intelligence model updating method, system, electronic equipment and storage medium
CN110740138A (en) Data transmission method and device
CN114095760B (en) Data transmission method and data transmission device thereof
CN114710692B (en) Multimedia file processing method and device
CN110247939A (en) The high-performance combination frame realized using multi-level buffer technology
CN113556292B (en) Audio playing method and system of IP network
CN106933826B (en) Data preprocessing method and device
CN116361254B (en) Image storage method, apparatus, electronic device, and computer-readable medium
CN114827312B (en) Method and device for self-adapting delay and throughput rate requirement in intelligent network card/DPU
CN107562442B (en) Method and device for reading data
CN114567413B (en) Data storage method and device
CN112597082B (en) Bus data transmission method and electronic equipment
CN114615348B (en) UDP GSO-based data transmission method, device, computer equipment and storage medium
CN113556247B (en) Multi-layer parameter distributed data transmission method, device and readable medium
CN113726688A (en) Congestion control method and device and electronic equipment
CN116597817A (en) Audio recognition method, device and storage 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20220422