CN117527714A - Method, device, equipment and storage medium for reading data message - Google Patents

Method, device, equipment and storage medium for reading data message Download PDF

Info

Publication number
CN117527714A
CN117527714A CN202410010685.1A CN202410010685A CN117527714A CN 117527714 A CN117527714 A CN 117527714A CN 202410010685 A CN202410010685 A CN 202410010685A CN 117527714 A CN117527714 A CN 117527714A
Authority
CN
China
Prior art keywords
data message
reading
data
placement position
messages
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
CN202410010685.1A
Other languages
Chinese (zh)
Other versions
CN117527714B (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.)
Baike Data Technology Shenzhen Co ltd
Original Assignee
Baike Data Technology Shenzhen 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 Baike Data Technology Shenzhen Co ltd filed Critical Baike Data Technology Shenzhen Co ltd
Priority to CN202410010685.1A priority Critical patent/CN117527714B/en
Publication of CN117527714A publication Critical patent/CN117527714A/en
Application granted granted Critical
Publication of CN117527714B publication Critical patent/CN117527714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for reading a data message. According to the method, the current sequencing queue and the sequenced queue are preset, when the data messages are read, the data messages in the sequenced queue are read first, when the data messages in the sequenced queue do not meet the reading requirement, the data messages in the current sequencing queue are read, and the data messages which are sequenced in the current queuing sequence are detected when the current queuing sequence messages are read, so that the data messages in the sequenced queue are read, the data messages are sequenced in the same step mode through the current queuing sequence, and the data messages stored in the front part of the current sequencing queue are read, and meanwhile, the data messages are sequenced through the rear part of the data messages, so that the data message reading and the data message reading can be synchronously performed, the data message reading efficiency of the sequence preservation can be improved, and the response efficiency of the data message reading operation can be improved.

Description

Method, device, equipment and storage medium for reading data message
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for reading a data packet.
Background
UDP (user datagram protocol) technology has been widely adopted for its practical and reliable properties. Compared with TCP (Transmission control protocol), UDP protocol omits the process of establishing connection and dismantling connection, cancels a retransmission checking mechanism, greatly improves the real-time performance of data communication, simultaneously UDP multicast can simultaneously send data from a data acquisition end to a plurality of distributed servers for main/standby distributed operation, and the main/standby distributed processing of multiple nodes not only improves the data processing capacity, but also avoids single node faults from influencing the normal operation of the whole system, and greatly improves the capacity and reliability of the data processing of the whole system.
When data transmission is performed through the UDP protocol, the condition of disorder and packet loss of the data message exists. In order to avoid the influence of disorder of the data messages, it is common to reorder the data messages first and then read the ordered data messages. However, it is common to perform data message ordering and then respond to the read operation, which results in that the read operation of the data message needs to wait for the data message ordering to be completed, and the response efficiency of the read operation of the data message is affected.
There is thus a need for improvements and improvements in the art.
Disclosure of Invention
The technical problem to be solved by the application is to provide a method, a device, equipment and a storage medium for reading data messages aiming at the defects of the prior art.
In order to solve the above technical problems, a first aspect of the present application provides a method for reading a data packet, where the method for reading a data packet includes:
responding to a reading instruction of the data message, and reading the data message from a preset ordered queue, wherein the ordered queue is used for storing the data message which is ordered;
when the read data message does not meet the reading requirement corresponding to the reading instruction, checking whether a first placement position of a preset current ordering queue is used for placing the data message, wherein the current ordering queue is used for ordering the received message data;
when the data message is placed, reading a continuous data message sequence taking the data message of the first placement position as a starting data message;
when the data message is not placed, reading the vacant duration of the first placement position;
when the idle time length does not reach the preset time length, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time length reaches the preset time length;
when the idle time length reaches the preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message or not.
The method for reading the data message comprises the step of storing message pointers of the data message in the ordered queue and the current ordered queue.
According to the method for reading the data messages, the current sequencing queue corresponds to the message sequence number section, and the message sequence number section slides along with the reading of the data messages of the current sequencing queue.
The method for reading the data message, wherein after the reading the continuous data message sequence using the data message of the first placement position as the initial data message, the method further comprises:
selecting a target placement position adjacent to the placement position of the last data message in the continuous data message sequence from the current sequencing queue;
and taking the target placement position as the first placement position of the current sequencing queue, and re-executing the step of checking whether the preset first placement position of the current sequencing queue places the data message or not when the read data message does not meet the reading requirement corresponding to the reading instruction.
The method for reading the data message, wherein the reading the empty duration of the first placement position specifically includes:
and reading the message quantity of the data messages contained in the current sequencing queue, and taking the message quantity as the idle time length corresponding to the first placement position.
The method for reading the data message, wherein when the data message is placed, the step of reading the continuous data message sequence taking the data message at the first placement position as the initial data message specifically comprises the following steps:
when placing data messages, selecting a continuous data message sequence taking the data message of the first placement position as a starting message, and acquiring the message number of the continuous data message sequence;
when the number of the messages and the read data messages do not meet the reading requirement, reading the continuous data message sequence;
when the number of the messages and the read data messages meet the reading requirement, determining the number of the messages to be read according to the reading requirement and the read data messages, reading the number of the messages to be read from the continuous data message sequence according to the front-to-back sequence, and placing the data messages which are not read in the continuous data message sequence in an ordered queue.
The method for reading the data message further comprises the following steps:
when the data messages read from the ordered queue meet the reading requirement, the data messages of the number of the requirement messages are read from the ordered sequence according to the number of the requirement messages corresponding to the reading requirement and the front-to-back order.
The second aspect of the present application provides a data packet reading device, where the data packet reading device includes:
the response module is used for responding to a reading instruction of the data message and reading the data message from a preset ordered queue, wherein the ordered queue is used for storing the data message which is ordered;
the checking module is used for checking whether the data message is placed at the first placement position of the preset current ordering queue or not when the read data message does not meet the reading requirement corresponding to the reading instruction, wherein the current ordering queue is used for ordering the received message data;
the acquisition module is used for reading a continuous data message sequence taking the data message at the first placement position as a starting data message when the data message is placed;
the reading module is used for reading the vacant duration of the first placement position when the data message is not placed;
the waiting module is used for controlling the reading operation corresponding to the reading instruction to enter a waiting state when the idle time does not reach the preset time, until a data message corresponding to the first placement position is received or the idle time reaches the preset time;
and the control module is used for taking the placement position after the first placement position as the first placement position when the idle time reaches the preset time, and rechecking whether the first placement position places the data message.
A third aspect of the present application provides a computer readable storage medium storing one or more programs executable by one or more processors to implement steps in a method of reading a data message as described in any one of the above.
A fourth aspect of the present application provides a terminal device, including: a processor and a memory;
the memory has stored thereon a computer readable program executable by the processor;
the steps in the method for reading a data message according to any one of the above are implemented when the processor executes the computer readable program.
The beneficial effects are that: compared with the prior art, the application provides a method, a device, equipment and a storage medium for reading data messages, wherein the method comprises the steps of responding to a reading instruction of the data messages, reading the data messages from a preset ordered queue, and checking whether a first placement position of the preset current ordered queue places the data messages or not when the read data messages do not meet the reading requirement corresponding to the reading instruction; when the data message is placed, reading a continuous data message sequence taking the data message of the first placement position as a starting data message; when the data message is not placed, reading the vacant duration of the first placement position; when the idle time length does not reach the preset time length, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time length reaches the preset time length; when the idle time length reaches the preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message or not. According to the embodiment of the application, the current sequencing queue and the sequenced queue are preset, when the data messages are read, the data messages in the sequenced queue are read first, when the data messages in the sequenced queue do not meet the reading requirement, the data messages in the current sequencing queue are read, and the data messages which are sequenced in the current queuing sequence are detected when the current queuing sequence messages are read, so that the data messages in the sequenced queue are sequenced through the current queuing sequence and the step data messages, and when the data messages stored in the front part of the current sequencing queue are read, the data messages are sequenced through the rear part of the data messages, so that the data message reading and the data message can be synchronously performed, the data message with the sequence being kept can be read, the reading efficiency of the data message can be improved, and the response efficiency of the reading operation can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for reading a data packet according to an embodiment of the present application.
Fig. 2 is a flowchart of step S30 in the method for reading a data packet according to the embodiment of the present application.
Fig. 3 is a flow chart illustrating a moving process of the first position in the method for reading a data packet according to the embodiment of the present application.
Fig. 4 is a schematic structural diagram of a data packet reading device according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The embodiments of the present application provide a method, an apparatus, a device, and a storage medium for reading a data packet, so that the purposes, technical solutions, and effects of the present application are clearer and more specific, and the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
It should be understood that the sequence number and the size of each step in this embodiment do not mean the sequence of execution, and the execution sequence of each process is determined by the function and the internal logic of each process, and should not constitute any limitation on the implementation process of the embodiment of the present application.
It has been found that UDP (user datagram protocol) technology has been widely adopted for its practical and reliable use. Compared with TCP (Transmission control protocol), UDP protocol omits the process of establishing connection and dismantling connection, cancels a retransmission checking mechanism, greatly improves the real-time performance of data communication, simultaneously UDP multicast can simultaneously send data from a data acquisition end to a plurality of distributed servers for main/standby distributed operation, and the main/standby distributed processing of multiple nodes not only improves the data processing capacity, but also avoids single node faults from influencing the normal operation of the whole system, and greatly improves the capacity and reliability of the data processing of the whole system.
When data transmission is performed through the UDP protocol, the condition of disorder and packet loss of the data message exists. In order to avoid the influence of disorder of the data messages, it is common to reorder the data messages first and then read the ordered data messages. However, it is common to perform data message ordering and then respond to the read operation, which results in that the read operation of the data message needs to wait for the data message ordering to be completed, and the response efficiency of the read operation of the data message is affected.
In order to solve the above problem, in the embodiment of the present application, in response to a read instruction of a data packet, the data packet is read from a preset ordered queue, and when the read data packet does not meet a read requirement corresponding to the read instruction, whether a first placement position of the preset current ordered queue places the data packet is checked; when the data message is placed, reading a continuous data message sequence taking the data message of the first placement position as a starting data message; when the data message is not placed, reading the vacant duration of the first placement position; when the idle time length does not reach the preset time length, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time length reaches the preset time length; when the idle time length reaches the preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message or not. According to the embodiment of the application, the current sequencing queue and the sequenced queue are preset, when the data messages are read, the data messages in the sequenced queue are read first, when the data messages in the sequenced queue do not meet the reading requirement, the data messages in the current sequencing queue are read, and the data messages which are sequenced in the current queuing sequence are detected when the current queuing sequence messages are read, so that the data messages in the sequenced queue are sequenced through the current queuing sequence and the step data messages, and when the data messages stored in the front part of the current sequencing queue are read, the data messages are sequenced through the rear part of the data messages, so that the data message reading and the data message can be synchronously performed, the data message with the sequence being kept can be read, the reading efficiency of the data message can be improved, and the response efficiency of the reading operation can be improved.
The application will be further described by the description of embodiments with reference to the accompanying drawings.
The embodiment provides a method for reading a data message, as shown in fig. 1, where the method includes:
s10, responding to a reading instruction of the data message, and reading the data message from a preset ordered queue.
Specifically, the reading instruction may be formed based on a reading operation performed by the user through the client, and is used for reading the received data packet, so as to feed back the data packet to the client, where the data packet that the client needs to obtain is a data packet with a guaranteed sequence. Based on the above, after responding to the reading instruction of the data message, the data message is read from the ordered queue, instead of directly reading the data message from the current ordered queue or directly reading the received data message, so that on one hand, the message sequence of the read data message can be ensured, and on the other hand, the reading efficiency of the data message can be improved.
The ordered queue is pre-established and is used for storing the ordered data messages. The data messages which are sequenced through a sliding window mode through the current queuing sequence. In the embodiment of the application, the message pointers of the data messages stored in the ordered queue and the current ordered queue. That is, after receiving the data message, the data message is not required to be stored in the current sorting queue, then the data message is moved from the current sorting queue to the sorted queue, and only the message pointer of the data message is required to be stored in the current sorting queue, and then the data message is moved from the current sorting queue to the sorted queue.
S20, checking whether a preset first placement position of the current sequencing queue places the data message or not when the read data message does not meet the reading requirement corresponding to the reading instruction.
Specifically, the current ordering queue is configured to order the received message data, where the current ordering queue includes a plurality of placement positions, and the current ordering queue corresponds to a message sequence number segment, the number of positions of the plurality of placement positions is the same as the number of message sequence numbers included in the message sequence number segment, the plurality of placement positions correspond to the message sequence numbers included in the message sequence number segment one by one, and as the number of positions of the placement positions increases, the message sequence corresponding to the placement positions also increases. For example, the message sequence number corresponding to the placement position of the position code 1 is larger than the message sequence number corresponding to the placement position of the position code 2.
Further, the read requirement is used to reflect the number of data messages required by the read instruction, where the read requirement may be the number of data messages, and the read data messages not meeting the read requirement means that the number of messages of the read data messages does not meet the read requirement. Of course, in practical application, the reading requirement may also be a target message sequence number, that is, all data messages before the target message sequence number need to be read, and correspondingly, the read data message does not meet the reading requirement corresponding to the reading instruction, which means that the maximum message sequence number in the read data message does not reach the target message sequence number.
In addition, it should be noted that when the data packet read in the ordered queue meets the reading requirement, the data packet can be directly required from the ordered queue, so that the reading efficiency of the data packet can be improved. Of course, when the data packets read from the ordered queue satisfy the reading requirement, the number of data packets in the ordered queue may be greater than the number of requirement packets corresponding to the reading requirement. Therefore, the data messages of the number of the demand messages can be read from the ordered queue according to the number of the demand messages corresponding to the reading demand in a front-to-back sequence, and the starting position of the ordered queue can be moved to the position of the first data message in the data messages which are not read.
S30, when the data message is placed, reading a continuous data message sequence taking the data message at the first placement position as a starting data message.
Specifically, the placement data message indicates that a data message continuous with the last data message in the read data message exists in the current queuing sequence, and at this time, the continuous data message sequence taking the data message at the first placement position as the initial data message is read from the current queuing sequence.
In some implementations, as shown in fig. 2, when the data packet is placed, the reading the continuous data packet sequence with the data packet of the first placement location as the starting data packet specifically includes:
s31, when the data message is placed, selecting a continuous data message sequence taking the data message of the first placement position as an initial message, and acquiring the message number of the continuous data message sequence;
s32, when the number of the messages and the read data messages do not meet the reading requirement, reading the continuous data message sequence;
s33, when the number of messages and the read data messages meet the reading requirement, determining the number of messages to be read according to the reading requirement and the read data messages, reading the number of messages to be read from the continuous data message sequence according to the front-to-back sequence, and placing the data messages which are not read in the continuous data message sequence in an ordered queue.
Specifically, the number of messages may be the number of data messages included in a continuous data message sequence, and after the number of messages is obtained, the continuous data message sequence and the data messages read in the ordered sequence are directly combined to be used as the read data messages; and whether the read data message and the continuous data message sequence meet the reading requirement or not can be detected, and when the read requirement is met, whether all data messages in the continuous data message sequence or partial data messages in the continuous data message are needed to be determined is determined. When partial data messages need to be read, determining the number of the messages to be read, reading the number of the messages to be read from the continuous data message sequence according to the front-to-back sequence, and then placing the data messages which are not read in the continuous data message sequence in an ordered queue.
In some implementations, the current queuing sequence reserves a placement position for each message sequence number in the corresponding message sequence number segment, other data messages do not occupy the reserved placement position corresponding to the message sequence number, and for each placement position, there may be a data message before the placement position, there may be a data message after the placement position, and the placement position is in an idle state. Therefore, when the data message of the first placement position is used as a continuous data message sequence of the initial data message, the position state of the idle placement position encountered in the reading process can be detected, if the position state is the data message packet loss state, the idle placement position is used as the data message of the previous placement position, whether the data message is stored in the next placement position of the idle placement position or the placement position of the data message packet loss state is continuously read, when the data message is stored, the data message is placed in the continuous data message sequence, and when the data message is stored in the idle placement position of the data message packet loss state, the step of reading whether the next placement position of the idle placement position stores the data message or the placement position of the data message packet loss state is continuously executed until the obtained position state is not the idle placement position of the data message packet loss state.
According to the embodiment of the application, the placement positions are reserved for the data messages, so that the late data messages can be the acquired ordering positions, and meanwhile, the position states are set for the idle placement positions to determine whether the data messages corresponding to the idle placement positions are packet loss data messages or not, and therefore the problem that subsequent data message ordering cannot be performed due to packet loss of the data messages can be avoided.
In some implementations, as shown in fig. 3, after the reading the continuous data packet sequence with the data packet of the first placement location as the starting data packet, the method further includes:
s310, selecting a target placement position adjacent to the placement position of the last data message in the continuous data message sequence from the current sequencing queue;
s320, taking the target placement position as the first placement position of the current sequencing queue, and re-executing the step of checking whether the preset first placement position of the current sequencing queue places the data message or not when the read data message does not meet the reading requirement corresponding to the reading instruction.
Specifically, after the continuous data message sequence is selected, the message sequence number segment corresponding to the current sequencing queue is slid, so that the initial message sequence number of the slid message sequence number segment is the last data message added with 1 in the continuous data message sequence, wherein when the continuous data message sequence contains the idle placement position of the position state of the data message packet loss state, the last data message in the continuous data message sequence is the idle placement position corresponding to the idle placement position of the data message packet loss state, and then the message sequence number is the message sequence number corresponding to the idle placement position of the position state of the data message packet loss state. Based on the above, after the continuous data message sequence is read, a placement position where the last data message is located in the continuous data message sequence can be selected, and a placement position which is the next to the read placement position is taken as a target placement position, wherein the placement position can be a placement position where the data message is located, and can also be an idle placement position where the data message is lost in a time-position state.
And S40, when the data message is not placed, reading the vacant duration of the first placement position.
Specifically, the unset data message indicates that the first place is in an idle state, that is, the data message of the first place has not been received yet. In addition, a placement location following the first placement location may have a data message. Therefore, the idle time length of the first placement position is read, so as to judge whether the data message corresponding to the first placement position is lost or not according to the idle time length.
In some implementations, the reading the empty duration of the first placement location specifically includes:
and reading the message quantity of the data messages contained in the current sequencing queue, and taking the message quantity as the idle time length corresponding to the first placement position.
Specifically, the triggering condition that the first placement position is judged to enter the idle state is that the placement position after the first placement position is placed in a data message, that is, a data message with a message sequence number larger than that of the message sequence number corresponding to the first placement position is received, but the data message corresponding to the first placement position is not received, so that the data message corresponding to the first placement position is in a late state, correspondingly, the first placement position is triggered to enter the idle state, the idle time of the first placement position is set to be 1, and then after the first placement position enters the idle state, the idle time of the first placement position is increased by 1 every time when one data message is received. In addition, the first placement position is not previously placed, so that after the first placement position enters the idle state, the received data messages are stored in the first placement position, and the message data of the data messages contained in the current ordering corresponds to the idle time of the first placement position.
Furthermore, it should be noted that, for each placement position except the first placement position in the current ordering queue, the idle duration of the placement position may be determined according to the number of messages of the data message received after the placement position enters the idle state. That is, for each placement location, the time when the placement location enters the idle state and the time when each data packet is stored in the current ordering sequence may be recorded, and then the idle time corresponding to the placement location is determined according to the time when the placement location enters the idle state and the time when each data packet is stored.
And S50, when the idle time does not reach the preset time, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time reaches the preset time.
Specifically, when the idle time length does not reach the preset time length, the data message corresponding to the first placement position is the late data message, and the data message corresponding to the first placement position needs to be waited until the data message corresponding to the first placement position is received or the idle time length reaches the preset time length, so that the reading operation corresponding to the reading instruction can be controlled to enter a waiting state. In addition, in the waiting process, if the data message corresponding to the first placement position is received, executing the step of reading the continuous data message sequence taking the data message of the first placement position as the initial data message, and if the idle time does not reach the preset time, executing the step of taking the placement position after the first placement position as the first placement position and rechecking whether the first placement position places the data message.
And S60, when the idle time length reaches a preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message.
Specifically, when the idle time reaches the preset time, it is indicated that the data message corresponding to the first placement position is in a packet loss state, at this time, a placement position after the first placement position can be used as the first placement position, whether the first placement position places the data message can be checked again, and so on, so that parallel reading and sequencing can be achieved. In addition, in practical application, when the placement position in the current sequencing queue is determined to be the packet loss of the data message, and then the data message corresponding to the placement position is received, whether the placement position corresponding to the data message is contained in the current sequencing queue or not can be checked, if so, the data message can be stored in the corresponding placement position, and when not, the data message can be discarded. Under the condition that the reading efficiency of the data messages is not affected, the data messages can be ordered to the greatest extent, and the number of the data messages judged to be lost due to late arrival is reduced. Of course, in practical application, after determining that the data packet corresponding to the placement position is lost, the data packet may be directly lost when the data packet corresponding to the placement position is received. In one implementation of the embodiments of the present application,
in summary, the present embodiment provides a method for reading a data packet, including responding to a read instruction of the data packet, reading the data packet from a preset ordered queue, and checking whether a first placement position of the preset current ordered queue places the data packet when the read data packet does not meet a read requirement corresponding to the read instruction; when the data message is placed, reading a continuous data message sequence taking the data message of the first placement position as a starting data message; when the data message is not placed, reading the vacant duration of the first placement position; when the idle time length does not reach the preset time length, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time length reaches the preset time length; when the idle time length reaches the preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message or not. According to the embodiment of the application, the current sequencing queue and the sequenced queue are preset, when the data messages are read, the data messages in the sequenced queue are read first, when the data messages in the sequenced queue do not meet the reading requirement, the data messages in the current sequencing queue are read, and the data messages which are sequenced in the current queuing sequence are detected when the current queuing sequence messages are read, so that the data messages in the sequenced queue are sequenced through the current queuing sequence and the step data messages, and when the data messages stored in the front part of the current sequencing queue are read, the data messages are sequenced through the rear part of the data messages, so that the data message reading and the data message can be synchronously performed, the data message with the sequence being kept can be read, the reading efficiency of the data message can be improved, and the response efficiency of the reading operation can be improved.
Based on the above method for reading the data message, this embodiment provides a device for reading the data message, as shown in fig. 4, where the device for reading the data message includes:
the response module 100 is configured to respond to a reading instruction of a data packet, and read the data packet from a preset ordered queue, where the ordered queue is used to store the data packet that has been ordered;
the checking module 200 is configured to check whether a preset first placement position of a current ordering queue is used for placing a data packet when the read data packet does not meet a read requirement corresponding to a read instruction, where the current ordering queue is used for ordering received packet data;
an obtaining module 300, configured to read a continuous data message sequence using the data message of the first placement location as a starting data message when placing the data message;
a reading module 400, configured to read the empty duration of the first placement location when the data packet is not placed;
the waiting module 500 is configured to control a reading operation corresponding to the reading instruction to enter a waiting state when the idle time does not reach the preset time, until a data message corresponding to the first placement position is received or the idle time reaches the preset time;
and the control module 600 is configured to take the placement position subsequent to the first placement position as the first placement position when the idle time length reaches a preset time length, and recheck whether the first placement position places the data packet.
Based on the above-mentioned method for reading a data packet, this embodiment provides a computer-readable storage medium storing one or more programs executable by one or more processors to implement the steps in the method for reading a data packet according to the above-mentioned embodiment.
Based on the above method for reading the data packet, the present application also provides a terminal device, as shown in fig. 5, which includes at least one processor (processor) 20; a display screen 21; and a memory (memory) 22, which may also include a communication interface (Communications Interface) 23 and a bus 24. Wherein the processor 20, the display 21, the memory 22 and the communication interface 23 may communicate with each other via a bus 24. The display screen 21 is configured to display a user guidance interface preset in the initial setting mode. The communication interface 23 may transmit information. The processor 20 may invoke logic instructions in the memory 22 to perform the methods of the embodiments described above.
Further, the logic instructions in the memory 22 described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product.
The memory 22, as a computer readable storage medium, may be configured to store a software program, a computer executable program, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 performs functional applications and data processing, i.e. implements the methods of the embodiments described above, by running software programs, instructions or modules stored in the memory 22.
The memory 22 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include high-speed random access memory, and may also include nonvolatile memory. For example, a plurality of media capable of storing program codes such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or a transitory storage medium may be used.
In addition, the specific processes that the storage medium and the plurality of instruction processors in the terminal device load and execute are described in detail in the above method, and are not stated here.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (10)

1. The method for reading the data message is characterized by comprising the following steps:
responding to a reading instruction of the data message, and reading the data message from a preset ordered queue, wherein the ordered queue is used for storing the data message which is ordered;
when the read data message does not meet the reading requirement corresponding to the reading instruction, checking whether a first placement position of a preset current ordering queue is used for placing the data message, wherein the current ordering queue is used for ordering the received message data;
when the data message is placed, reading a continuous data message sequence taking the data message of the first placement position as a starting data message;
when the data message is not placed, reading the vacant duration of the first placement position;
when the idle time length does not reach the preset time length, controlling the reading operation corresponding to the reading instruction to enter a waiting state until a data message corresponding to the first placement position is received or the idle time length reaches the preset time length;
when the idle time length reaches the preset time length, taking the next placement position of the first placement position as the first placement position, and rechecking whether the first placement position places the data message or not.
2. The method of claim 1, wherein the ordered queue and the current ordered queue each store a message pointer for the data message.
3. The method of claim 1, wherein the current queue corresponds to a sequence number segment and the sequence number segment slides as the current queue's data message is read.
4. The method for reading data messages according to claim 1, wherein after said reading a continuous sequence of data messages in which the data message of the first placement position is the start data message, the method further comprises:
selecting a target placement position adjacent to the placement position of the last data message in the continuous data message sequence from the current sequencing queue;
and taking the target placement position as the first placement position of the current sequencing queue, and re-executing the step of checking whether the preset first placement position of the current sequencing queue places the data message or not when the read data message does not meet the reading requirement corresponding to the reading instruction.
5. The method for reading a data packet according to claim 1, wherein the reading the empty duration of the first placement location specifically includes:
and reading the message quantity of the data messages contained in the current sequencing queue, and taking the message quantity as the idle time length corresponding to the first placement position.
6. The method for reading a data message according to claim 1, wherein when the data message is placed, the step of reading a continuous data message sequence using the data message at the first placement position as a starting data message specifically includes:
when placing data messages, selecting a continuous data message sequence taking the data message of the first placement position as a starting message, and acquiring the message number of the continuous data message sequence;
when the number of the messages and the read data messages do not meet the reading requirement, reading the continuous data message sequence;
when the number of the messages and the read data messages meet the reading requirement, determining the number of the messages to be read according to the reading requirement and the read data messages, reading the number of the messages to be read from the continuous data message sequence according to the front-to-back sequence, and placing the data messages which are not read in the continuous data message sequence in an ordered queue.
7. The method for reading a data packet according to claim 1, further comprising:
when the data messages read from the ordered queue meet the reading requirement, the data messages of the number of the requirement messages are read from the ordered queue according to the number of the requirement messages corresponding to the reading requirement and the front-to-back order.
8. The data message reading device is characterized by comprising:
the response module is used for responding to a reading instruction of the data message and reading the data message from a preset ordered queue, wherein the ordered queue is used for storing the data message which is ordered;
the checking module is used for checking whether the data message is placed at the first placement position of the preset current ordering queue or not when the read data message does not meet the reading requirement corresponding to the reading instruction, wherein the current ordering queue is used for ordering the received message data;
the acquisition module is used for reading a continuous data message sequence taking the data message at the first placement position as a starting data message when the data message is placed;
the reading module is used for reading the vacant duration of the first placement position when the data message is not placed;
the waiting module is used for controlling the reading operation corresponding to the reading instruction to enter a waiting state when the idle time does not reach the preset time, until a data message corresponding to the first placement position is received or the idle time reaches the preset time;
and the control module is used for taking the placement position after the first placement position as the first placement position when the idle time reaches the preset time, and rechecking whether the first placement position places the data message.
9. A computer readable storage medium storing one or more programs executable by one or more processors to implement the steps in the method of reading a data message according to any one of claims 1-7.
10. A terminal device, comprising: a processor and a memory;
the memory has stored thereon a computer readable program executable by the processor;
the steps in a method of reading a data message according to any of claims 1-7 are implemented when the processor executes the computer readable program.
CN202410010685.1A 2024-01-04 2024-01-04 Method, device, equipment and storage medium for reading data message Active CN117527714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410010685.1A CN117527714B (en) 2024-01-04 2024-01-04 Method, device, equipment and storage medium for reading data message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410010685.1A CN117527714B (en) 2024-01-04 2024-01-04 Method, device, equipment and storage medium for reading data message

Publications (2)

Publication Number Publication Date
CN117527714A true CN117527714A (en) 2024-02-06
CN117527714B CN117527714B (en) 2024-03-15

Family

ID=89751629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410010685.1A Active CN117527714B (en) 2024-01-04 2024-01-04 Method, device, equipment and storage medium for reading data message

Country Status (1)

Country Link
CN (1) CN117527714B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007383A1 (en) * 2010-03-11 2013-01-03 Fujitsu Limited Data block read-out control apparatus
CN105138678A (en) * 2015-09-11 2015-12-09 武汉云空间地理信息技术有限公司 Reading and distributing method and system for map tile data
CN112235234A (en) * 2020-07-30 2021-01-15 视联动力信息技术股份有限公司 Data processing method and device, electronic equipment and computer readable storage medium
CN112637162A (en) * 2020-12-14 2021-04-09 上海金仕达软件科技有限公司 UDP (user Datagram protocol) data packet processing method and device
CN113704588A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 File reading method and system based on mapping technology

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007383A1 (en) * 2010-03-11 2013-01-03 Fujitsu Limited Data block read-out control apparatus
CN105138678A (en) * 2015-09-11 2015-12-09 武汉云空间地理信息技术有限公司 Reading and distributing method and system for map tile data
CN112235234A (en) * 2020-07-30 2021-01-15 视联动力信息技术股份有限公司 Data processing method and device, electronic equipment and computer readable storage medium
CN112637162A (en) * 2020-12-14 2021-04-09 上海金仕达软件科技有限公司 UDP (user Datagram protocol) data packet processing method and device
CN113704588A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 File reading method and system based on mapping technology

Also Published As

Publication number Publication date
CN117527714B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
CN112272243B (en) Address allocation method
CN110865769B (en) Method for processing read/write request, network storage system and electronic equipment
CN112311702B (en) FC switch scheduling method and device, electronic equipment and storage medium
CN108023829A (en) Message processing method and device, storage medium, electronic equipment
CN110532205A (en) Data transmission method, device, computer equipment and computer readable storage medium
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
CN108304272B (en) Data IO request processing method and device
CN110413398B (en) Task scheduling method and device, computer equipment and storage medium
CN117527714B (en) Method, device, equipment and storage medium for reading data message
CN112040001A (en) Request processing method and device based on distributed storage
CN109818977B (en) Access server communication optimization method, access server and communication system
CN104714839A (en) Method and device for controlling life cycle of processes
CN108429703B (en) DHCP client-side online method and device
CN113157465A (en) Message sending method and device based on pointer linked list
CN108241616B (en) Message pushing method and device
US11194619B2 (en) Information processing system and non-transitory computer readable medium storing program for multitenant service
CN116909767A (en) Channel-extensible flow message processing method
CN110445874A (en) A kind of conversation processing method, device, equipment and storage medium
CN109905459A (en) A kind of data transmission method and device
JP2011234114A (en) Frame processor and frame processing method
CN110162415B (en) Method, server, device and storage medium for processing data request
CN115292023A (en) Timing task processing method and device
CN112433977B (en) Communication method for multiple serial devices of electrical measurement system based on VB environment
CN117527641B (en) Packet loss observation method, device and equipment for data message and storage medium
CN110515553B (en) Volume deleting method and device

Legal Events

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