WO2015058613A1 - Method and device for detecting data packet, and storage medium - Google Patents

Method and device for detecting data packet, and storage medium Download PDF

Info

Publication number
WO2015058613A1
WO2015058613A1 PCT/CN2014/088153 CN2014088153W WO2015058613A1 WO 2015058613 A1 WO2015058613 A1 WO 2015058613A1 CN 2014088153 W CN2014088153 W CN 2014088153W WO 2015058613 A1 WO2015058613 A1 WO 2015058613A1
Authority
WO
WIPO (PCT)
Prior art keywords
sequence number
tag
detection window
data packet
mark
Prior art date
Application number
PCT/CN2014/088153
Other languages
French (fr)
Chinese (zh)
Inventor
管坤
曾新海
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2015058613A1 publication Critical patent/WO2015058613A1/en

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/34Flow control; Congestion control ensuring sequence integrity, e.g. using sequence numbers

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a method, an apparatus, and a storage medium for detecting a data packet.
  • the terminal sends network data to the server through a User Data Protocol (UDP).
  • UDP User Data Protocol
  • the data is sliced according to a specified size, and the transmission sequence number is transmitted.
  • Network data transmission is divided into reliable transmission and unreliable transmission.
  • the data sender and the data receiver When transmitting reliably, the data sender and the data receiver need to maintain the connection status and assign a sequence number to each transmitted byte, relying on data timeout retransmission and data acknowledgement to ensure reliable transmission.
  • the data sender and the data receiver ensure reliability by reducing the transmission rate, and cannot maximize the utilization of the network bandwidth, and thus are not suitable for real-time interaction scenarios of audio and video.
  • the data receiver does not detect the reception of the data packet, so there is no data retransmission and data confirmation during the unreliable transmission process. Maximize the use of network bandwidth, so it is suitable for real-time interactive scenarios of audio and video.
  • the data receiver does not detect the reception of the data packet, and the data packet received by the data receiver may be out of order, or may not receive the data packet sent by the data sender, so that the audio and video file is obtained. Cannot play normally.
  • Embodiments of the present invention provide a method, an apparatus, and a storage medium for detecting a data packet, so as to implement data packet detection in unreliable transmission.
  • a first aspect of the present invention provides a method for detecting a data packet, including:
  • the marker sequence serial queue is provided with a fixed length mobility detection window.
  • the coverage of the detection window is [a, a+n-1], where a is the marker sequence serial queue.
  • the smallest mark serial number, n is the fixed length;
  • the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the determining is that the packet is lost or out of order, including:
  • Marking the position of the tag sequence number corresponding to the sending sequence number in the preset tag sequence linear queue including:
  • the mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
  • the method further includes:
  • a second aspect of the present invention provides an apparatus for detecting a data packet, including:
  • An obtaining unit configured to acquire a sending sequence number of the received data packet
  • a marking unit configured to mark a mark serial number position corresponding to the sending serial number in the preset linear sequence of the marking serial number
  • a determining unit configured to determine that a packet is lost or out of order when the location of the tag sequence corresponding to the sending sequence number obtained by the acquiring unit is consecutively discontinuous.
  • a fixed length mobility detection window is disposed on the linear serial queue of the marking unit mark.
  • the coverage of the detection window is [a, a+n-1], where a is The smallest number of the label in the linear sequence of the label number, n is the fixed length;
  • the determining unit is further configured to: when the label sequence number corresponding to the sending sequence number is not in the coverage of the detection window, move the detection window, so that a maximum tag number covered by the detection window is corresponding to the sending sequence number The tag sequence number; when the sequence number span between the maximum tag sequence number and the maximum tag sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
  • the determining unit is specifically configured to determine that the maximum tag number covered by the detection window before moving, and the data packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
  • the marking unit is specifically configured to: The tag sequence number position is marked as the received state, and the tag sequence number in the linear queue is marked as unreceived before being marked.
  • the apparatus further includes:
  • a judging unit configured to determine that a tag sequence corresponding to the data packet determined to be lost or out of order is out of the After the detection window is overwritten, is it still unreceived;
  • the determining unit is further configured to: when the determining unit determines that the tag sequence corresponding to the lost or out-of-order data packet is still in an unreceived state after being covered by the detection window, determining that the determining is lost or Out of order packets have been lost.
  • a third aspect of the invention provides a storage medium comprising computer executable instructions for performing any of the methods of detecting a data packet described above when executed by a computer processor.
  • the method, device, and storage medium for detecting a data packet provided by the embodiment of the present invention, by acquiring the sending sequence number of the received data packet; marking the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number; When the position of the tag sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, and the data receiver that the data receiver sends to the data sender is detected by the unreliable transmission process, thereby enabling data reception.
  • the party may only send a retransmission request to the data sender for the lost data packet, thereby reducing the probability of true packet loss while ensuring the maximum utilization of the network; or when detecting the data packet
  • the order of the data packets is adjusted to ensure the normal playback of the audio and video files.
  • FIG. 1 is a schematic diagram of an embodiment of a method for detecting a data packet in an embodiment of the present invention
  • FIG. 2 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention
  • FIG. 3 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an embodiment of an apparatus for detecting a data packet according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of another embodiment of an apparatus for detecting a data packet in an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an embodiment of a terminal in an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of an embodiment of a server in an embodiment of the present invention.
  • Embodiments of the present invention provide a method for detecting a data packet, which can quickly detect a lost or out-of-order data packet. Embodiments of the present invention also provide corresponding detection devices. The details are described below separately.
  • a method for detecting a data packet includes: Step 101 to Step 103.
  • step 101 the sending sequence number of the received data packet is obtained.
  • the data receiver can obtain the transmission sequence number of the data packet after receiving the data packet.
  • step 102 the position of the tag sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked.
  • the linear sequence of the tag sequence number in the embodiment of the present invention corresponds to the transmission sequence number of the data packet sent by the data sender. For example, if the transmission sequence number of the data packet set by the data sender is 0, 1, 2, 3, 4, ..., the data is received. The square also pre-sets the linear serial number queues with sequence numbers 0, 1, 2, 3, 4, ..., and the serial numbers in the queue are arranged in order from small to large. If the data sequence received by the data receiver is m, the sequence number m is found in the queue and marked at the location where m is located to indicate that the data packet with the transmission sequence number m has been received.
  • step 103 when the positions of the tag serial numbers corresponding to the transmission sequence numbers acquired twice consecutively are discontinuous, it is determined that there is packet loss or disorder.
  • the two consecutive acquisitions can be understood as two acquisitions, and the transmission serial numbers of the two acquisitions are consecutive.
  • the transmission sequence number of the first received data packet is 11
  • the first sequence number of the received transmission sequence number is 11
  • the second received data packet has a transmission sequence number of 15 and the second time.
  • the obtained tag number corresponding to the sending sequence number is 15, and it can be determined that the tag number corresponding to the first obtained transmission sequence number and the tag number corresponding to the second acquired transmission sequence number are discontinuous in the sequence linear queue, that is, Said that the serial number corresponding to the serial number obtained twice in succession is
  • the position in the serial number linear queue is not continuous, so it can be determined that the data packets corresponding to the serial numbers 12, 13 and 14 between the tag numbers 11 and 15 are lost or out of order, that is, the data packets corresponding to the serial numbers 12 to 14 may be completely If it is not received (that is, lost), it may be received after receiving the data packet corresponding to sequence number 15 (that is, out of order).
  • the data receiver can detect the loss or out of order of the data packet by using the method for detecting the data packet provided by the foregoing embodiment, so that when the data receiver detects the data, When the packet is lost, the retransmission request can be sent only to the data sender after the lost data packet, thereby reducing the probability of true packet loss while ensuring the maximum utilization of the network; when the data receiver detects the packet disorder
  • adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, which improves the reliability of unreliable transmission.
  • a fixed length mobility detection is set on the linear queue of the marking sequence number.
  • Window, in the initial state, the coverage of the detection window is [a, a+n-1], where a is the smallest label number in the linear sequence of the label sequence number, and n is the fixed length;
  • packet loss or disorder which may include:
  • the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the length of the mobility detection window may be pre-defined. For example, it may be set to 1024 serial number lengths, or may be other numbers of serial number lengths, such as 1025, 1026, 1027, ..., 2048, and the like.
  • the left side of the mobility detection window is at the position of the mark serial number linear queue mark number 0, and the right side is at the position of the mark number 1023.
  • the minimum mark number covered by the mobility detection window is 0, and the maximum mark number covered is 1023.
  • the transmission sequence number of the received data packet is less than 1024, the mobility detection window does not move.
  • the transmission sequence number of the received data packet is greater than 1023, the mobility detection window moves to the tail direction of the linear sequence of the marker sequence number, that is, the direction in which the marker sequence number increases.
  • the transmission sequence number of the received data packet as 1024 as an example, after the mobility detection window is moved, the maximum mark number of the coverage becomes 1024, the minimum mark number of the cover becomes 1, and the mobility detection window moves to the right.
  • the displacement of the sequence numbers can be determined without packet loss or out of order.
  • the mobility detection window moves the displacement of the three serial numbers to the right.
  • the maximum tag number of the overlay is changed from 1024 to 1027, and the minimum tag number of the overlay is changed from 1 to 4.
  • the sequence number of the mobility detection window that is moved once is 3, 3 is greater than 1, and the packets with sequence numbers 1025 and 1026 can be determined. Lost or out of order.
  • the determining that the data packet is lost or out of order may include:
  • the maximum mark number covered by the mobility detection window is 1024, and the maximum mark number covered by the mobility detection window after moving is 1027, directly crossing the mark numbers 1025 and 1026, so it can be determined Packets with sequence numbers 1025 and 1026 are sent missing or out of order.
  • the preset tag serial number linear queue is in the same manner as the embodiment corresponding to FIG. 1 or the corresponding embodiment of FIG.
  • the marking sequence number corresponding to the sending serial number is marked, and may include:
  • the mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
  • each tag serial number in the tag sequence linear queue is set to 0.
  • the data receiver receives the data packet whose transmission sequence number corresponds to the tag sequence number or is the same as the tag sequence number, the corresponding data will be corresponding.
  • the value of the marker number is set to 1.
  • the method may further include:
  • the data packets since the data packets may be out of order during the transmission process, the data packet whose sequence number is 1025 or 1026 in FIG. 3 may only be out of order, causing the reception delay, so it is necessary to judge the two after a period of time. Whether the packets are lost. For example, when the mobility detection window moves further to the tail of the linear sequence of the tag sequence number, and does not overwrite the tag sequence number corresponding to the previously confirmed lost or out-of-order packet, it is determined that the tag sequence corresponding to the lost or out-of-order packet is confirmed. The value of the location indicates whether the status is received or not received.
  • the status is not received, it can be determined that the previously lost or out-of-order packet has been lost; if the status is received, it can be determined that the missing or out-of-order packet is previously out of order.
  • the minimum mark number covered by the mobility detection window is 1025, and the minimum mark number covered by the mobility detection window is 1026. At this time, the state marked at the position of the mark number 1025 is detected, when the position is detected.
  • the status is not received, it is determined that the packet with the transmission sequence number of 1025 is lost; if the status is received, it indicates that the packet with the transmission sequence number of 1025 is out of order.
  • the apparatus for detecting a data packet provided by the embodiment of the present invention is used to implement the method for detecting a data packet provided by the embodiment shown in FIG. 1, and includes: an obtaining unit 201, a marking unit 202, and a determining unit 203.
  • the obtaining unit 201 is configured to acquire a sending sequence number of the received data packet.
  • the marking unit 202 is configured to mark the position of the marking sequence number corresponding to the transmission serial number acquired by the acquiring unit 201 in the preset linear sequence of the marking serial number.
  • the determining unit 203 is configured to determine that there is packet loss or disorder when the location of the tag sequence corresponding to the transmission sequence number acquired by the acquiring unit 201 is discontinuous.
  • the device for detecting a data packet acquires the sending sequence number of the received data packet by the acquiring unit, and marks the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number by the marking unit; When the location of the tag sequence number corresponding to the transmission sequence number obtained twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
  • the device for detecting the data packet may be a data receiver or a part of the data receiver, so that, in the unreliable transmission process, when the data receiver detects that the data packet is lost, the data packet may be lost only to the lost data packet.
  • the data sender sends a retransmission request, thereby reducing the probability of true packet loss while ensuring maximum utilization of the network;
  • the data receiver detects that the data packet is out of order, adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, and the reliability of the unreliable transmission is improved.
  • the marker sequence serial number queue marked by the marking unit 202 is provided with a fixed length mobility detection window.
  • the coverage of the detection window is [ a, a + n-1], wherein a is the smallest mark serial number in the linear sequence of the mark serial number, and n is the fixed length;
  • the determining unit 203 is also applicable to
  • the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the determining unit 203 may be specifically configured to determine that the maximum tag number covered by the detection window before moving, and the data packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
  • the marking unit 202 may be specifically configured to mark, in the preset linear sequence of the tag serial number, a tag serial number position corresponding to the sending serial number as a received state, where the marking The sequence number position in the serial number linear queue is unreceived before being marked.
  • the apparatus 20 may further include: a determining unit 205.
  • the determining unit 205 is configured to determine whether the tag sequence corresponding to the data packet determined to be lost or out of order is out of the detection window, and is still in an unreceived state;
  • the determining unit 203 is further configured to: when the determining unit 205 determines that the tag sequence corresponding to the data packet determined to be lost or out of order is out of the detection window and is still in an unreceived state, determining the Packets determined to be lost or out of order have been lost.
  • the device for detecting a data packet in the embodiment of the present invention may be a terminal or a server.
  • FIG. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the terminal may be used to implement the detection data provided in the foregoing embodiment.
  • the method of the package Specifically:
  • the terminal 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity, wireless).
  • the fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like. It will be understood by those skilled in the art that the terminal structure shown in FIG. 7 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements. among them:
  • the RF circuit 110 can be used for transmitting and receiving information or during a call, and receiving and transmitting signals. Specifically, after receiving downlink information of the base station, the downlink information is processed by one or more processors 180. In addition, the data related to the uplink is sent to the base station. .
  • the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc.
  • RF circuitry 110 can also communicate with the network and other devices via wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access). , Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • e-mail Short Messaging Service
  • the memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120.
  • the memory 120 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to the terminal.
  • the data created by the use of 1200 (such as audio data, phone book, etc.).
  • memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
  • the input unit 130 can be configured to receive input numeric or character information, and generate and user settings to And keyboard, mouse, joystick, optical or trackball signal input related to function control.
  • input unit 130 can include touch-sensitive surface 131 as well as other input devices 132.
  • Touch-sensitive surface 131 also referred to as a touch display or trackpad, can collect touch operations on or near the user (such as a user using a finger, stylus, etc., on any suitable object or accessory on touch-sensitive surface 131 or The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program.
  • the touch sensitive surface 131 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 180 is provided and can receive commands from the processor 180 and execute them.
  • the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 can also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 140 can be used to display information entered by the user or information provided to the user and various graphical user interfaces of the terminal 1200, which can be composed of graphics, text, icons, video, and any combination thereof.
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
  • the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141.
  • touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
  • Terminal 1200 can also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the terminal 1200 moves to the ear. / or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes).
  • the magnitude and direction of gravity can be detected, which can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.;
  • Other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors that can be configured in 1200 are not described here.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal 1200.
  • the audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the terminal, for example, via the RF circuit 110, or outputted to the memory 120 for further processing.
  • the audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the terminal 1200.
  • WiFi is a short-range wireless transmission technology
  • the terminal 1200 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 170, which provides wireless broadband Internet access for users.
  • FIG. 7 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the terminal 1200, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 180 is a control center of the terminal 1200 that connects various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120, The various functions and processing data of the terminal 1200 are executed to perform overall monitoring of the mobile phone.
  • the processor 180 can include one or more processing cores; for example, the processor 180 can integrate an application processor and a modem processor, wherein the application processor processes an operating system, a user interface, an application, etc., a modem processor Handle wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180.
  • the terminal 1200 also includes a power supply 190 (such as a battery) that supplies power to various components.
  • the power supply 190 can be logically coupled to the processor 180 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the terminal 1200 may further include a camera, a Bluetooth module, and the like, and details are not described herein.
  • the display unit of the terminal is a touch screen display
  • the terminal further includes a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be processed by one or more
  • the execution of one or more programs includes instructions for performing the following operations:
  • the memory of the terminal further includes an instruction for performing the following operations. :
  • the marker sequence serial queue is provided with a fixed length mobility detection window.
  • the coverage of the detection window is [a, a+n-1], where a is the marker sequence serial queue.
  • the smallest mark serial number, n is the fixed length;
  • the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
  • the memory of the terminal further includes an instruction for performing the following operations:
  • the terminal provided in this embodiment adopts the sending sequence number of the received data packet, and fills the sending sequence number into the corresponding tag sequence number position in the preset tag sequence linear queue;
  • the sequence number corresponding to the serial number is not continuous, it is determined that there is packet loss or disorder.
  • the method for detecting a data packet provided in the embodiment of the present invention can quickly detect a lost or out-of-order data packet, as compared with the method for detecting the data transmission number of the data packet one by one in the prior art.
  • still another embodiment of the present invention provides a storage medium including computer executable instructions, that is, a computer readable storage medium, which may be included in the memory in the above embodiment.
  • the computer readable storage medium stores one or more programs, the one or more programs being used by one or more processors to perform the method of detecting a data packet, or the computer executable instructions being processed by a computer
  • the marker sequence serial queue is provided with a fixed length mobility detection window.
  • the coverage of the detection window is [a, a+n-1], where a is the smallest label number in the linear sequence of the label sequence number, and n is the fixed length;
  • the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the determining is that the data packet is lost or out of order, including:
  • the position of the marking sequence number corresponding to the sending sequence number in the preset linear sequence of marking numbers is performed.
  • Mark including:
  • the mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
  • the method further includes:
  • the device for detecting a data packet in the embodiment of the present invention may be a terminal or a server, and when the device for detecting the data packet is a server:
  • FIG. 8 is a schematic structural diagram of a server 600 according to an embodiment of the present invention.
  • Server 600 can include input device 601, output device 604, processor 602, and memory 603.
  • Memory 603 can include read only memory and random access memory and provides instructions and data to processor 602. A portion of the memory 603 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 603 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
  • Operation instructions include various operation instructions for implementing various operations.
  • Operating system Includes a variety of system programs for implementing various basic services and handling hardware-based tasks.
  • the processor 602 performs the following operations by calling an operation instruction stored in the memory 603 (the operation instruction can be stored in the operating system):
  • the server 600 uses the sending sequence number of the received data packet, and marks the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number; When the tag sequence number is not continuous, it is determined that there is packet loss or out of order. In this way, the server 600 acts as a data sender.
  • the server 600 can only send a retransmission request to the data sender for the lost data packet, thereby maximizing the use of the network.
  • the probability of real packet loss is reduced; when the server 600 detects that the data packet is out of order, the adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, and the reliability of the unreliable transmission is improved.
  • the processor 602 controls the operation of the server 600, which may also be referred to as a CPU (Central Processing Unit).
  • Memory 603 can include read only memory and random access memory and provides instructions and data to processor 602. A portion of the memory 603 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the various components of the server 600 are coupled together by a bus system 605.
  • the bus system 605 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as bus system 605 in the figure.
  • Processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 602 or an instruction in a form of software.
  • the processor 602 described above may be a general purpose processor, a digital signal processor (DSP), Application Specific Integrated Circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASICs Application Specific Integrated Circuits
  • FPGAs off-the-shelf programmable gate arrays
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or carried out.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented by the hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the memory 603, and the processor 602 reads the information in the memory 603 and completes the steps of the above method in combination with its hardware.
  • the mark sequence serial queue is provided with a fixed length mobility detection window.
  • the coverage of the detection window is [a, a+n-1], where a is the mark The smallest number of the label in the serial number queue, where n is the fixed length;
  • the processor 602 moves the detection window when the label sequence number corresponding to the sending sequence number is not in the coverage of the detection window, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
  • the processor 602 determines that the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
  • the processor 602 marks, in the preset linear sequence of the tag sequence number, a tag sequence number corresponding to the transmission sequence number as a received state, and the tag sequence number in the linear queue is marked as an unreceived state before being marked.
  • Processor 602 also determines that there is a packet loss or out of order,
  • the storage medium may include: a ROM, a RAM, a magnetic disk, or an optical disk.

Abstract

A method and device for detecting a data packet, and a storage medium. The method comprises: acquiring a sending sequence number of a received data packet; marking a mark sequence number position corresponding to the sending sequence number in a preset mark sequence number linear queue; and when the mark sequence number positions corresponding to the sending sequence numbers which are acquired for two successive times are discontinuous, determining that data packet loss or disorder occurs, thereby realizing that a data receiver detects a data packet sent by a data sender in an unreliable transmission process.

Description

一种检测数据包的方法、装置及存储介质Method, device and storage medium for detecting data packets
本专利申请要求于2013年10月21日提交的、申请号为201310495811.9、申请人为腾讯科技(深圳)有限公司、发明名称为“一种丢包检测的方法及检测装置”的中国专利申请的优先权,该申请的全文以引用的方式并入本申请中。This patent application claims priority on Chinese patent application filed on October 21, 2013, with the application number 201310495811.9, the applicant is Tencent Technology (Shenzhen) Co., Ltd., and the invention name is “a method and detection device for packet loss detection”. The entire contents of this application are incorporated herein by reference.
技术领域Technical field
本发明涉及互联网技术领域,具体涉及一种检测数据包的方法、装置及存储介质。The present invention relates to the field of Internet technologies, and in particular, to a method, an apparatus, and a storage medium for detecting a data packet.
背景技术Background technique
终端通过用户数据协议(User Data Protocol,UDP)向服务器发送网络数据,通常将数据按照指定大小切片后,加上发送序号传输。The terminal sends network data to the server through a User Data Protocol (UDP). Usually, the data is sliced according to a specified size, and the transmission sequence number is transmitted.
网络数据传输分为可靠传输和不可靠传输。Network data transmission is divided into reliable transmission and unreliable transmission.
可靠传输时,数据发送方和数据接收方需要维护连接状态,并对每个传输的字节分配序列号,依赖数据超时重传和数据确认应答来保证传输可靠。但由于当网络波动时,数据发送方和数据接收方通过降低发送速率保证可靠性,不能最大化利用网络带宽,因此不适合音视频实时交互场景。When transmitting reliably, the data sender and the data receiver need to maintain the connection status and assign a sequence number to each transmitted byte, relying on data timeout retransmission and data acknowledgement to ensure reliable transmission. However, when the network fluctuates, the data sender and the data receiver ensure reliability by reducing the transmission rate, and cannot maximize the utilization of the network bandwidth, and thus are not suitable for real-time interaction scenarios of audio and video.
而不可靠传输过程中,由于数据发送方和数据接收方不需要维护连接状态,数据接收方也不对数据包的接收情况进行检测,因而不可靠传输过程中不存在数据重传和数据确认,能最大化利用网络带宽,因此适合音视频实时交互场景。In the unreliable transmission process, since the data sender and the data receiver do not need to maintain the connection state, the data receiver does not detect the reception of the data packet, so there is no data retransmission and data confirmation during the unreliable transmission process. Maximize the use of network bandwidth, so it is suitable for real-time interactive scenarios of audio and video.
但是,由于网络数据在传输过程中,受网络介质和链路影响,可能丢失或乱序。因此,不可靠传输过程中,数据接收方不对数据包的接收进行检测,也导致数据接收方接收的数据包可能乱序,或者可能接收不到数据发送方发送的数据包,而使得音视频文件不能正常播放。However, because network data is affected by network media and links during transmission, it may be lost or out of order. Therefore, during the unreliable transmission process, the data receiver does not detect the reception of the data packet, and the data packet received by the data receiver may be out of order, or may not receive the data packet sent by the data sender, so that the audio and video file is obtained. Cannot play normally.
发明内容Summary of the invention
本发明实施例提供一种检测数据包的方法、装置及存储介质,以实现对不可靠传输中的数据包检测。 Embodiments of the present invention provide a method, an apparatus, and a storage medium for detecting a data packet, so as to implement data packet detection in unreliable transmission.
本发明第一方面提供一种检测数据包的方法,包括:A first aspect of the present invention provides a method for detecting a data packet, including:
获取接收到的数据包的发送序号;Obtaining the sending sequence number of the received data packet;
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;Marking a mark number position corresponding to the transmission sequence number in a preset linear sequence of tag numbers;
当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。When the position of the mark sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
结合第一方面,在第一种可能的实现方式中,In combination with the first aspect, in a first possible implementation manner,
所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;The marker sequence serial queue is provided with a fixed length mobility detection window. In the initial state, the coverage of the detection window is [a, a+n-1], where a is the marker sequence serial queue. The smallest mark serial number, n is the fixed length;
所述当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序,包括:When the location of the label sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, including:
当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,In conjunction with the first possible implementation of the first aspect, in a second possible implementation,
所述确定有数据包丢失或乱序,包括:The determining is that the packet is lost or out of order, including:
确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。Determining the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the maximum tag sequence number after the movement is lost or out of order.
结合第一方面的第一种或第二种可能的实现方式,在第三种可能的实现方式中,In conjunction with the first or second possible implementation of the first aspect, in a third possible implementation,
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记,包括:Marking the position of the tag sequence number corresponding to the sending sequence number in the preset tag sequence linear queue, including:
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
结合第一方面第三种可能的实现方式,在第四种可能的实现方式中,所述 确定有数据包丢失或乱序之后,所述方法还包括:With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner, After determining that there is packet loss or out of order, the method further includes:
判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;Determining whether the tag sequence number corresponding to the lost or out-of-order data packet is out of the detection window and is still in an unreceived state;
若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
本发明第二方面提供一种检测数据包的装置,包括:A second aspect of the present invention provides an apparatus for detecting a data packet, including:
获取单元,用于获取接收到的数据包的发送序号;An obtaining unit, configured to acquire a sending sequence number of the received data packet;
标记单元,用于将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;a marking unit, configured to mark a mark serial number position corresponding to the sending serial number in the preset linear sequence of the marking serial number;
确定单元,用于当所述获取单元连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。And a determining unit, configured to determine that a packet is lost or out of order when the location of the tag sequence corresponding to the sending sequence number obtained by the acquiring unit is consecutively discontinuous.
结合第二方面,在第一种可能的实现方式中,In combination with the second aspect, in a first possible implementation manner,
所述标记单元标记的所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;a fixed length mobility detection window is disposed on the linear serial queue of the marking unit mark. In the initial state, the coverage of the detection window is [a, a+n-1], where a is The smallest number of the label in the linear sequence of the label number, n is the fixed length;
所述确定单元,还用于当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。The determining unit is further configured to: when the label sequence number corresponding to the sending sequence number is not in the coverage of the detection window, move the detection window, so that a maximum tag number covered by the detection window is corresponding to the sending sequence number The tag sequence number; when the sequence number span between the maximum tag sequence number and the maximum tag sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
结合第二方面第一种可能的实现方式,在第二种可能的实现方式中,In conjunction with the first possible implementation of the second aspect, in a second possible implementation manner,
所述确定单元具体用于确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。The determining unit is specifically configured to determine that the maximum tag number covered by the detection window before moving, and the data packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
结合第二方面的第一种或第二种可能的实现方式,在第三种可能的实现方式中,所述标记单元具体用于将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。In conjunction with the first or second possible implementation of the second aspect, in a third possible implementation, the marking unit is specifically configured to: The tag sequence number position is marked as the received state, and the tag sequence number in the linear queue is marked as unreceived before being marked.
结合第二方面第三种可能的实现方式,在第四种可能的实现方式中,所述装置还包括:In conjunction with the third possible implementation of the second aspect, in a fourth possible implementation, the apparatus further includes:
判断单元,用于判断确定为丢失或乱序的数据包对应的标记序号脱离所述 检测窗口覆盖后,是否仍为未接收状态;a judging unit, configured to determine that a tag sequence corresponding to the data packet determined to be lost or out of order is out of the After the detection window is overwritten, is it still unreceived;
所述确定单元,还用于当所述判断单元判断出确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后仍为未接收状态时,则判定所述确定为丢失或乱序的数据包已丢失。The determining unit is further configured to: when the determining unit determines that the tag sequence corresponding to the lost or out-of-order data packet is still in an unreceived state after being covered by the detection window, determining that the determining is lost or Out of order packets have been lost.
本发明第三方面提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行上述任一种检测数据包的方法。A third aspect of the invention provides a storage medium comprising computer executable instructions for performing any of the methods of detecting a data packet described above when executed by a computer processor.
本发明实施例提供的检测数据包的方法、装置及存储介质,通过获取接收到的数据包的发送序号;将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序,实现了不可靠传输过程数据接收方对数据发送方发送的数据包的检测,从而使得数据接收方当检测到数据包丢失时,可以仅仅对丢失后的数据包向数据发送方发送重传请求,在保证网络最大化利用的前提下,降低了真正丢包的概率;或者当检测到数据包乱序时,对数据包的顺序进行调整,保证了音视频文件的正常播放。The method, device, and storage medium for detecting a data packet provided by the embodiment of the present invention, by acquiring the sending sequence number of the received data packet; marking the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number; When the position of the tag sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, and the data receiver that the data receiver sends to the data sender is detected by the unreliable transmission process, thereby enabling data reception. When detecting a packet loss, the party may only send a retransmission request to the data sender for the lost data packet, thereby reducing the probability of true packet loss while ensuring the maximum utilization of the network; or when detecting the data packet When out of order, the order of the data packets is adjusted to ensure the normal playback of the audio and video files.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings can also be obtained from those skilled in the art based on these drawings without paying any creative effort.
图1是本发明实施例中检测数据包的方法的一实施例示意图;1 is a schematic diagram of an embodiment of a method for detecting a data packet in an embodiment of the present invention;
图2是本发明实施例中检测数据包的方法的另一实施例示意图;2 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention;
图3是本发明实施例中检测数据包的方法的另一实施例示意图;3 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention;
图4是本发明实施例中检测数据包的方法的另一实施例示意图;4 is a schematic diagram of another embodiment of a method for detecting a data packet in an embodiment of the present invention;
图5是本发明实施例中检测数据包的装置的一实施例示意图;FIG. 5 is a schematic diagram of an embodiment of an apparatus for detecting a data packet according to an embodiment of the present invention; FIG.
图6是本发明实施例中检测数据包的装置的另一实施例示意图;6 is a schematic diagram of another embodiment of an apparatus for detecting a data packet in an embodiment of the present invention;
图7是本发明实施例中终端的一实施例示意图;7 is a schematic diagram of an embodiment of a terminal in an embodiment of the present invention;
图8是本发明实施例中服务器的一实施例示意图。 FIG. 8 is a schematic diagram of an embodiment of a server in an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供一种检测数据包的方法,可以快速检测出丢失或乱序的数据包。本发明实施例还提供了相应的检测装置。以下分别进行详细说明。Embodiments of the present invention provide a method for detecting a data packet, which can quickly detect a lost or out-of-order data packet. Embodiments of the present invention also provide corresponding detection devices. The details are described below separately.
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
参阅图1,本发明实施例提供的检测数据包的方法包括:步骤101至步骤103。Referring to FIG. 1, a method for detecting a data packet according to an embodiment of the present invention includes: Step 101 to Step 103.
步骤101中,获取接收到的数据包的发送序号。In step 101, the sending sequence number of the received data packet is obtained.
由于数据包发送方在发送数据包时,会在数据包中写入数据包的发送序号,因此,数据接收方接收到数据包后,能够从中得到数据包的发送序号。Since the sender of the data packet writes the transmission sequence number of the data packet in the data packet when the data packet sender transmits the data packet, the data receiver can obtain the transmission sequence number of the data packet after receiving the data packet.
步骤102中,将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记。In step 102, the position of the tag sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked.
本发明实施例中的标记序号线性队列与数据发送方发送的数据包的发送序号对应,例如数据发送方设置的数据包的发送序号为0、1、2、3、4……,则数据接收方也预先设置序号为0、1、2、3、4……的线性序号队列,且队列中的序号从小到大依次排列。假如数据接收方接收到的数据包的发送序号为m,则在队列中找到序号m,并在m所在的位置进行标记,以表明发送序号为m的数据包已被接收。The linear sequence of the tag sequence number in the embodiment of the present invention corresponds to the transmission sequence number of the data packet sent by the data sender. For example, if the transmission sequence number of the data packet set by the data sender is 0, 1, 2, 3, 4, ..., the data is received. The square also pre-sets the linear serial number queues with sequence numbers 0, 1, 2, 3, 4, ..., and the serial numbers in the queue are arranged in order from small to large. If the data sequence received by the data receiver is m, the sequence number m is found in the queue and marked at the location where m is located to indicate that the data packet with the transmission sequence number m has been received.
步骤103中,当连续两次获取的发送序号对应的标记序号的位置不连续时,确定有数据包丢失或乱序。In step 103, when the positions of the tag serial numbers corresponding to the transmission sequence numbers acquired twice consecutively are discontinuous, it is determined that there is packet loss or disorder.
本实施例中,所述连续两次获取可以理解为两次获取,且该两次获取的发送序号连续。例如,第一次接收到的数据包的发送序号为11,该第一次获取到的发送序号对应的标记序号为11;第二次接收到的数据包的发送序号为15且该第二次获取到的发送序号对应的标记序号为15,由此可以判定,第一次获取的发送序号对应的标记序号与第二次获取的发送序号对应的标记序号在序号线性队列中不连续,也就是说,该连续两次获取到的发送序号所对应的标记序号在 序号线性队列中的位置不连续,因此可以确定标记序号11和15之间的序号12、13和14对应的数据包丢失或乱序,也就是说,序号12至14对应的数据包有可能彻底收不到(即为丢失),也有可能在接收到序号15对应的数据包之后收到(即为乱序)。In this embodiment, the two consecutive acquisitions can be understood as two acquisitions, and the transmission serial numbers of the two acquisitions are consecutive. For example, the transmission sequence number of the first received data packet is 11, the first sequence number of the received transmission sequence number is 11; the second received data packet has a transmission sequence number of 15 and the second time. The obtained tag number corresponding to the sending sequence number is 15, and it can be determined that the tag number corresponding to the first obtained transmission sequence number and the tag number corresponding to the second acquired transmission sequence number are discontinuous in the sequence linear queue, that is, Said that the serial number corresponding to the serial number obtained twice in succession is The position in the serial number linear queue is not continuous, so it can be determined that the data packets corresponding to the serial numbers 12, 13 and 14 between the tag numbers 11 and 15 are lost or out of order, that is, the data packets corresponding to the serial numbers 12 to 14 may be completely If it is not received (that is, lost), it may be received after receiving the data packet corresponding to sequence number 15 (that is, out of order).
可以看出,在不可靠传输过程中,数据接收方通过采用上述实施例提供的检测数据包的方法,能够实现对数据包的丢失或乱序进行检测,这样,当数据接收方检测到有数据包丢失时,可以仅仅对丢失后的数据包向数据发送方发送重传请求,从而在保证网络最大化利用的前提下,降低了真正丢包的概率;当数据接收方检测到有数据包乱序时,可以预先采取调整措施,从而保证传输的音视频文件能够正常播放,提高了不可靠传输的可靠性。It can be seen that, in the unreliable transmission process, the data receiver can detect the loss or out of order of the data packet by using the method for detecting the data packet provided by the foregoing embodiment, so that when the data receiver detects the data, When the packet is lost, the retransmission request can be sent only to the data sender after the lost data packet, thereby reducing the probability of true packet loss while ensuring the maximum utilization of the network; when the data receiver detects the packet disorder In the sequence, adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, which improves the reliability of unreliable transmission.
本实施例中,在上述图1对应的实施例的基础上,本发明实施例提供的检测数据包的方法的另一实施例中,所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;In this embodiment, in another embodiment of the method for detecting a data packet provided by the embodiment of the present invention, a fixed length mobility detection is set on the linear queue of the marking sequence number. Window, in the initial state, the coverage of the detection window is [a, a+n-1], where a is the smallest label number in the linear sequence of the label sequence number, and n is the fixed length;
所述当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序,可以包括:When the location of the label sequence number corresponding to the transmission sequence number that is acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, which may include:
当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
本发明实施例中,移动性检测窗口的长度可以预先规定好,例如:可以设定为1024个序号长度,也可以为其他数量个序号长度,如1025、1026、1027….2048等等。In the embodiment of the present invention, the length of the mobility detection window may be pre-defined. For example, it may be set to 1024 serial number lengths, or may be other numbers of serial number lengths, such as 1025, 1026, 1027, ..., 2048, and the like.
以移动性检测窗口的长度是1024为例,参阅图2,在初始时刻,移动性检测窗口的左侧在标记序号线性队列标记序号0的位置,右侧在标记序号1023的位置,也可以说,移动性检测窗口覆盖的最小标记序号为0,覆盖的最大标记序号为1023。当接收到的数据包的发送序号小于1024时,该移动性检测窗口不移 动;当接收到的数据包的发送序号大于1023时,该移动性检测窗口向标记序号线性队列的队尾方向即标记序号增大的方向移动。以接收到的数据包的发送序号是1024为例,该移动性检测窗口移动后,覆盖的最大标记序号变为1024,覆盖的最小标记序号变为1,该移动性检测窗口向右移动了1个序号的位移,可以确定没有数据包丢失或乱序。Taking the length of the mobility detection window as 1024 as an example, referring to FIG. 2, at the initial time, the left side of the mobility detection window is at the position of the mark serial number linear queue mark number 0, and the right side is at the position of the mark number 1023. The minimum mark number covered by the mobility detection window is 0, and the maximum mark number covered is 1023. When the transmission sequence number of the received data packet is less than 1024, the mobility detection window does not move. When the transmission sequence number of the received data packet is greater than 1023, the mobility detection window moves to the tail direction of the linear sequence of the marker sequence number, that is, the direction in which the marker sequence number increases. Taking the transmission sequence number of the received data packet as 1024 as an example, after the mobility detection window is moved, the maximum mark number of the coverage becomes 1024, the minimum mark number of the cover becomes 1, and the mobility detection window moves to the right. The displacement of the sequence numbers can be determined without packet loss or out of order.
参阅图3,当数据接收方接收到发送序号为1024的数据包之后,紧接着接收到的数据包的发送序号是1027时,该移动性检测窗口就要向右移动3个序号的位移,其覆盖的最大标记序号从1024变为1027,覆盖的最小标记序号从1变为4,该移动性检测窗口一次性移动的序号跨度为3,3大于1,可以确定序号为1025和1026的数据包丢失或乱序。Referring to FIG. 3, when the data receiver receives the data packet with the transmission sequence number of 1024, and immediately after the transmission sequence number of the received data packet is 1027, the mobility detection window moves the displacement of the three serial numbers to the right. The maximum tag number of the overlay is changed from 1024 to 1027, and the minimum tag number of the overlay is changed from 1 to 4. The sequence number of the mobility detection window that is moved once is 3, 3 is greater than 1, and the packets with sequence numbers 1025 and 1026 can be determined. Lost or out of order.
本实施例中,在上述图1对应的实施例的基础上,本发明实施例提供的检测数据包的方法的另一实施例中,所述确定有数据包丢失或乱序,可以包括:In this embodiment, on the basis of the foregoing embodiment corresponding to FIG. 1, in another embodiment of the method for detecting a data packet provided by the embodiment of the present invention, the determining that the data packet is lost or out of order may include:
确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。Determining the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the maximum tag sequence number after the movement is lost or out of order.
例如,参阅图3,在移动前,移动性检测窗口覆盖的最大标记序号为1024,移动后移动性检测窗口覆盖的最大标记序号为1027,直接跨过了标记序号1025和1026,因此,可以确定发送序号为1025和1026的数据包丢失或乱序。For example, referring to FIG. 3, before moving, the maximum mark number covered by the mobility detection window is 1024, and the maximum mark number covered by the mobility detection window after moving is 1027, directly crossing the mark numbers 1025 and 1026, so it can be determined Packets with sequence numbers 1025 and 1026 are sent missing or out of order.
在上述图1对应的实施例或图1对应的任一实施例的基础上,本发明实施例提供的检测数据包的方法的另一实施例中,将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记,可以包括:In another embodiment of the method for detecting a data packet provided by the embodiment of the present invention, the preset tag serial number linear queue is in the same manner as the embodiment corresponding to FIG. 1 or the corresponding embodiment of FIG. The marking sequence number corresponding to the sending serial number is marked, and may include:
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
如初始状态下,将标记序号线性队列中各个标记序号所在位置的值都设置为0,当数据接收方接收到发送序号与标记序号对应的或与标记序号相同的数据包时,则将对应的标记序号所在位置的值设置为1。In the initial state, the value of each tag serial number in the tag sequence linear queue is set to 0. When the data receiver receives the data packet whose transmission sequence number corresponds to the tag sequence number or is the same as the tag sequence number, the corresponding data will be corresponding. The value of the marker number is set to 1.
在上一个实施例的基础上,本发明实施例提供的检测数据包的方法的另一实施例中,所述确定有数据包丢失或乱序之后,所述方法还可以包括:On the basis of the previous embodiment, in another embodiment of the method for detecting a data packet provided by the embodiment of the present invention, after the determining is that the data packet is lost or out of order, the method may further include:
判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖 后,是否仍为未接收状态;Determining that the tag number corresponding to the lost or out-of-order packet is out of the detection window After, is it still unreceived;
若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
本发明实施例中,因数据包在传输过程中可能会乱序,针对图3中发送序号是1025或1026的数据包可能只是乱序导致接收延迟了,所以需要在一段时间后才能判断这两个数据包是否丢失。如当移动性检测窗口更进一步移向标记序号线性队列的队尾,而不再覆盖之前确认丢失或乱序的数据包对应的标记序号时,判断确认丢失或乱序的数据包对应的标记序号所在位置的值表示的状态是已接收还是未接收。如果状态是未接收,则可以判定之前确认丢失或乱序的数据包已丢失;如果状态是已接收,则可以判定之前确认丢失或乱序的数据包乱序。参阅图4,移动前,移动性检测窗口覆盖的最小标记序号是1025,移动性检测窗口覆盖的最小标记序号是1026,这时就检测标记序号1025位置处所标记的状态,当检测到该位置的状态为未接收时,确定发送序号为1025的数据包丢失;如果状态是已接收,说明该发送序号为1025的数据包接收时发生乱序。In the embodiment of the present invention, since the data packets may be out of order during the transmission process, the data packet whose sequence number is 1025 or 1026 in FIG. 3 may only be out of order, causing the reception delay, so it is necessary to judge the two after a period of time. Whether the packets are lost. For example, when the mobility detection window moves further to the tail of the linear sequence of the tag sequence number, and does not overwrite the tag sequence number corresponding to the previously confirmed lost or out-of-order packet, it is determined that the tag sequence corresponding to the lost or out-of-order packet is confirmed. The value of the location indicates whether the status is received or not received. If the status is not received, it can be determined that the previously lost or out-of-order packet has been lost; if the status is received, it can be determined that the missing or out-of-order packet is previously out of order. Referring to FIG. 4, before moving, the minimum mark number covered by the mobility detection window is 1025, and the minimum mark number covered by the mobility detection window is 1026. At this time, the state marked at the position of the mark number 1025 is detected, when the position is detected. When the status is not received, it is determined that the packet with the transmission sequence number of 1025 is lost; if the status is received, it indicates that the packet with the transmission sequence number of 1025 is out of order.
参阅图5,本发明实施例提供的检测数据包的装置用于实现上述图1所示实施例提供的检测数据包的方法,包括:获取单元201、标记单元202和确定单元203。Referring to FIG. 5, the apparatus for detecting a data packet provided by the embodiment of the present invention is used to implement the method for detecting a data packet provided by the embodiment shown in FIG. 1, and includes: an obtaining unit 201, a marking unit 202, and a determining unit 203.
获取单元201用于获取接收到的数据包的发送序号。The obtaining unit 201 is configured to acquire a sending sequence number of the received data packet.
标记单元202用于将预置的标记序号线性队列中与所述获取单元201获取的发送序号对应的标记序号位置进行标记。The marking unit 202 is configured to mark the position of the marking sequence number corresponding to the transmission serial number acquired by the acquiring unit 201 in the preset linear sequence of the marking serial number.
确定单元203用于当所述获取单元201连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。The determining unit 203 is configured to determine that there is packet loss or disorder when the location of the tag sequence corresponding to the transmission sequence number acquired by the acquiring unit 201 is discontinuous.
本发明实施例提供的检测数据包的装置,通过获取单元获取接收到的数据包的发送序号,通过标记单元将预置的标记序号线性队列中与发送序号对应的标记序号位置进行标记;通过确定单元当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。该检测数据包的装置可以作为数据接收方,也可以是数据接收方的一部分,这样,在不可靠传输过程中,数据接收方检测到有数据包丢失时,可以仅仅对丢失后的数据包向数据发送方发送重传请求,从而在保证网络最大化利用的前提下,降低了真正丢包的概率; 当数据接收方检测到有数据包乱序时,可以预先采取调整措施,从而保证传输的音视频文件能够正常播放,提高了不可靠传输的可靠性。The device for detecting a data packet provided by the embodiment of the present invention acquires the sending sequence number of the received data packet by the acquiring unit, and marks the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number by the marking unit; When the location of the tag sequence number corresponding to the transmission sequence number obtained twice consecutively is discontinuous, it is determined that there is packet loss or disorder. The device for detecting the data packet may be a data receiver or a part of the data receiver, so that, in the unreliable transmission process, when the data receiver detects that the data packet is lost, the data packet may be lost only to the lost data packet. The data sender sends a retransmission request, thereby reducing the probability of true packet loss while ensuring maximum utilization of the network; When the data receiver detects that the data packet is out of order, adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, and the reliability of the unreliable transmission is improved.
本发明实施例提供的检测数据包的装置中,所述标记单元202标记的所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;In the apparatus for detecting a data packet provided by the embodiment of the present invention, the marker sequence serial number queue marked by the marking unit 202 is provided with a fixed length mobility detection window. In the initial state, the coverage of the detection window is [ a, a + n-1], wherein a is the smallest mark serial number in the linear sequence of the mark serial number, and n is the fixed length;
相应的,所述确定单元203还可用于Correspondingly, the determining unit 203 is also applicable to
当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
,本发明实施例提供的检测数据包的装置中,In the apparatus for detecting a data packet provided by the embodiment of the present invention,
所述确定单元203可具体用于确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。The determining unit 203 may be specifically configured to determine that the maximum tag number covered by the detection window before moving, and the data packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
本发明实施例提供的检测数据包的装置中,所述标记单元202可具体用于将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。In the apparatus for detecting a data packet provided by the embodiment of the present invention, the marking unit 202 may be specifically configured to mark, in the preset linear sequence of the tag serial number, a tag serial number position corresponding to the sending serial number as a received state, where the marking The sequence number position in the serial number linear queue is unreceived before being marked.
在上述图5对应的实施例的基础上,参阅图6,本发明实施例提供的检测数据包的装置的另一实施例中,所述装置20还可包括:判断单元205。On the basis of the foregoing embodiment of FIG. 5, referring to FIG. 6, in another embodiment of the apparatus for detecting a data packet provided by the embodiment of the present invention, the apparatus 20 may further include: a determining unit 205.
判断单元205用于判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;The determining unit 205 is configured to determine whether the tag sequence corresponding to the data packet determined to be lost or out of order is out of the detection window, and is still in an unreceived state;
相应的,所述确定单元203还可用于当所述判断单元205判断出确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后仍为未接收状态时,则判定所述确定为丢失或乱序的数据包已丢失。Correspondingly, the determining unit 203 is further configured to: when the determining unit 205 determines that the tag sequence corresponding to the data packet determined to be lost or out of order is out of the detection window and is still in an unreceived state, determining the Packets determined to be lost or out of order have been lost.
本发明实施例中的检测数据包的装置可以为终端,也可以为服务器。The device for detecting a data packet in the embodiment of the present invention may be a terminal or a server.
当所述检测数据包的装置为终端时,请参考图7,其示出了本发明实施例所涉及的终端的结构示意图,该终端可以用于实施上述实施例中提供的检测数据 包的方法。具体来讲:When the device for detecting a data packet is a terminal, please refer to FIG. 7 , which is a schematic structural diagram of a terminal according to an embodiment of the present invention. The terminal may be used to implement the detection data provided in the foregoing embodiment. The method of the package. Specifically:
终端1200可以包括RF(Radio Frequency,射频)电路110、包括有一个或一个以上计算机可读存储介质的存储器120、输入单元130、显示单元140、传感器150、音频电路160、WiFi(wireless fidelity,无线保真)模块170、包括有一个或者一个以上处理核心的处理器180、以及电源190等部件。本领域技术人员可以理解,图7中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:The terminal 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity, wireless). The fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like. It will be understood by those skilled in the art that the terminal structure shown in FIG. 7 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements. among them:
RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器180处理;另外,将涉及上行的数据发送给基站。通常,RF电路110包括但不限于天线、至少一个放大器、调谐器、一个或多个振荡器、用户身份模块(SIM)卡、收发信机、耦合器、LNA(Low Noise Amplifier,低噪声放大器)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于GSM(Global System of Mobile communication,全球移动通讯系统)、GPRS(General Packet Radio Service,通用分组无线服务)、CDMA(Code Division Multiple Access,码分多址)、WCDMA(Wideband Code Division Multiple Access,宽带码分多址)、LTE(Long Term Evolution,长期演进)、电子邮件、SMS(Short Messaging Service,短消息服务)等。The RF circuit 110 can be used for transmitting and receiving information or during a call, and receiving and transmitting signals. Specifically, after receiving downlink information of the base station, the downlink information is processed by one or more processors 180. In addition, the data related to the uplink is sent to the base station. . Generally, the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc. In addition, RF circuitry 110 can also communicate with the network and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access). , Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
存储器120可用于存储软件程序以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据终端1200的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器120还可以包括存储器控制器,以提供处理器180和输入单元130对存储器120的访问。The memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120. The memory 120 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to the terminal. The data created by the use of 1200 (such as audio data, phone book, etc.). Moreover, memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
输入单元130可用于接收输入的数字或字符信息,以及产生与用户设置以 及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元130可包括触敏表面131以及其他输入设备132。触敏表面131,也称为触摸显示屏或者触控板,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面131上或在触敏表面131附近的操作),并根据预先设定的程式驱动相应的连接装置。触敏表面131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面131。除了触敏表面131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 130 can be configured to receive input numeric or character information, and generate and user settings to And keyboard, mouse, joystick, optical or trackball signal input related to function control. In particular, input unit 130 can include touch-sensitive surface 131 as well as other input devices 132. Touch-sensitive surface 131, also referred to as a touch display or trackpad, can collect touch operations on or near the user (such as a user using a finger, stylus, etc., on any suitable object or accessory on touch-sensitive surface 131 or The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program. The touch sensitive surface 131 can include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 180 is provided and can receive commands from the processor 180 and execute them. In addition, the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 can also include other input devices 132. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元140可用于显示由用户输入的信息或提供给用户的信息以及终端1200的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元140可包括显示面板141,该显示面板141可以采用LCD(Liquid Crystal Display,液晶显示器)、OLED(Organic Light-Emitting Diode,有机发光二极管)等形式来配置显示面板141。进一步的,触敏表面131可覆盖显示面板141,当触敏表面131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示面板141上提供相应的视觉输出。虽然在图7中,触敏表面131与显示面板141是作为两个独立的部件来实现输入和输入功能,但是在某些实施例中,可以将触敏表面131与显示面板141集成而实现输入和输出功能。The display unit 140 can be used to display information entered by the user or information provided to the user and various graphical user interfaces of the terminal 1200, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 140 may include a display panel 141. The display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141. Although in FIG. 7, touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
终端1200还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在终端1200移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静 止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于终端1200还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。Terminal 1200 can also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the terminal 1200 moves to the ear. / or backlight. As a kind of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). At the end of the time, the magnitude and direction of gravity can be detected, which can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; Other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors that can be configured in 1200 are not described here.
音频电路160、扬声器161,传声器162可提供用户与终端1200之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一终端,或者将音频数据输出至存储器120以便进一步处理。音频电路160还可能包括耳塞插孔,以提供外设耳机与终端1200的通信。The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal 1200. The audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the terminal, for example, via the RF circuit 110, or outputted to the memory 120 for further processing. The audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the terminal 1200.
WiFi属于短距离无线传输技术,终端1200通过WiFi模块170可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图7示出了WiFi模块170,但是可以理解的是,其并不属于终端1200的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-range wireless transmission technology, and the terminal 1200 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 170, which provides wireless broadband Internet access for users. Although FIG. 7 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the terminal 1200, and may be omitted as needed within the scope of not changing the essence of the invention.
处理器180是终端1200的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行终端1200的各种功能和处理数据,从而对手机进行整体监控。处理器180可包括一个或多个处理核心;例如,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器处理操作系统、用户界面和应用程序等,调制解调处理器处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。The processor 180 is a control center of the terminal 1200 that connects various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120, The various functions and processing data of the terminal 1200 are executed to perform overall monitoring of the mobile phone. The processor 180 can include one or more processing cores; for example, the processor 180 can integrate an application processor and a modem processor, wherein the application processor processes an operating system, a user interface, an application, etc., a modem processor Handle wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180.
终端1200还包括给各个部件供电的电源190(比如电池),电源190可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源190还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The terminal 1200 also includes a power supply 190 (such as a battery) that supplies power to various components. The power supply 190 can be logically coupled to the processor 180 through a power management system to manage functions such as charging, discharging, and power management through the power management system. Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
尽管未示出,终端1200还可以包括摄像头、蓝牙模块等,在此不再赘述。 具体在本实施例中,终端的显示单元是触摸屏显示器,终端还包括有存储器,以及一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理器执行述一个或者一个以上程序包含用于进行以下操作的指令:Although not shown, the terminal 1200 may further include a camera, a Bluetooth module, and the like, and details are not described herein. Specifically, in this embodiment, the display unit of the terminal is a touch screen display, the terminal further includes a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be processed by one or more The execution of one or more programs includes instructions for performing the following operations:
获取接收到的数据包的发送序号;Obtaining the sending sequence number of the received data packet;
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;Marking a mark number position corresponding to the transmission sequence number in a preset linear sequence of tag numbers;
当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。When the position of the mark sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
假设上述为第一种可能的实施方式,则在第一种可能的实施方式作为基础而提供的第二种可能的实施方式中,所述终端的存储器中,还包含用于执行以下操作的指令:Assuming that the foregoing is a first possible implementation manner, in a second possible implementation manner provided by the first possible implementation manner, the memory of the terminal further includes an instruction for performing the following operations. :
所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;The marker sequence serial queue is provided with a fixed length mobility detection window. In the initial state, the coverage of the detection window is [a, a+n-1], where a is the marker sequence serial queue. The smallest mark serial number, n is the fixed length;
当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
在第二种可能的实施方式作为基础而提供的第三种可能的实施方式中,所述终端的存储器中,还包含用于执行以下操作的指令:In a third possible implementation manner provided by the second possible implementation manner, the memory of the terminal further includes an instruction for performing the following operations:
确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。Determining the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the maximum tag sequence number after the movement is lost or out of order.
在第一种、第二种或第三种可能的实施方式作为基础而提供的第四种可能的实施方式中,所述终端的存储器中,还包含用于执行以下操作的指令:In a fourth possible implementation manner provided by the first, second or third possible implementation manner, the memory of the terminal further includes an instruction for performing the following operations:
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。 The mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
在第四种可能的实施方式作为基础而提供的第五种可能的实施方式中,所述终端的存储器中,还包含用于执行以下操作的指令:In a fifth possible implementation manner provided by the fourth possible implementation manner, the memory of the terminal further includes an instruction for performing the following operations:
判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;Determining whether the tag sequence number corresponding to the lost or out-of-order data packet is out of the detection window and is still in an unreceived state;
若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
综上所述,本实施例提供的终端,采用获取接收到的数据包的发送序号;将所述发送序号填充到预置的标记序号线性队列中对应的标记序号位置;当连续两次填充发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。与现有技术中过逐个记录数据包的发送序号的方法进行丢包检测相比,本发明实施例中提供的检测数据包的方法,可以快速检测出丢失或乱序的数据包。In summary, the terminal provided in this embodiment adopts the sending sequence number of the received data packet, and fills the sending sequence number into the corresponding tag sequence number position in the preset tag sequence linear queue; When the sequence number corresponding to the serial number is not continuous, it is determined that there is packet loss or disorder. The method for detecting a data packet provided in the embodiment of the present invention can quickly detect a lost or out-of-order data packet, as compared with the method for detecting the data transmission number of the data packet one by one in the prior art.
作为另一方面,本发明再一实施例还提供了一种包含计算机可执行指令的存储介质,即计算机可读存储介质,该计算机可读存储介质可以是上述实施例中的存储器中所包含的计算机可读存储介质;也可以是单独存在,未装配入终端中的计算机可读存储介质。所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序被一个或者一个以上的处理器用来执行上述检测数据包的方法,或者所述计算机可执行指令在由计算机处理器执行时用于执行上述检测数据包的方法,所述方法包括:In another aspect, still another embodiment of the present invention provides a storage medium including computer executable instructions, that is, a computer readable storage medium, which may be included in the memory in the above embodiment. A computer readable storage medium; or a computer readable storage medium that is separately present and not incorporated into a terminal. The computer readable storage medium stores one or more programs, the one or more programs being used by one or more processors to perform the method of detecting a data packet, or the computer executable instructions being processed by a computer The method for executing the above detection data packet when the device is executed, the method comprising:
获取接收到的数据包的发送序号;Obtaining the sending sequence number of the received data packet;
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;Marking a mark number position corresponding to the transmission sequence number in a preset linear sequence of tag numbers;
当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。When the position of the mark sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
假设上述为第一种可能的实施方式,则在第一种可能的实施方式作为基础而提供的第二种可能的实施方式中,所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;Assuming that the foregoing is a first possible implementation manner, in a second possible implementation manner provided by the first possible implementation manner, the marker sequence serial queue is provided with a fixed length mobility detection window. In the initial state, the coverage of the detection window is [a, a+n-1], where a is the smallest label number in the linear sequence of the label sequence number, and n is the fixed length;
所述当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序,包括: When the location of the label sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, including:
当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
在第二种可能的实施方式作为基础而提供的第三种可能的实施方式中,所述确定有数据包丢失或乱序,包括:In a third possible implementation manner provided by the second possible implementation manner, the determining is that the data packet is lost or out of order, including:
确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。Determining the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the maximum tag sequence number after the movement is lost or out of order.
在第一种、第二种或第三种可能的实施方式作为基础而提供的第四种可能的实施方式中,将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记,包括:In a fourth possible implementation manner provided by the first, second or third possible implementation manner, the position of the marking sequence number corresponding to the sending sequence number in the preset linear sequence of marking numbers is performed. Mark, including:
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
在第四种可能的实施方式作为基础而提供的第五种可能的实施方式中,所述确定有数据包丢失或乱序之后,所述方法还包括:In a fifth possible implementation manner provided by the fourth possible implementation manner, after the determining is that the data packet is lost or out of order, the method further includes:
判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;Determining whether the tag sequence number corresponding to the lost or out-of-order data packet is out of the detection window and is still in an unreceived state;
若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
本发明实施例中的检测数据包的装置可以为终端,也可以为服务器,当所述检测数据包的装置为服务器时:The device for detecting a data packet in the embodiment of the present invention may be a terminal or a server, and when the device for detecting the data packet is a server:
图8是本发明实施例服务器600的结构示意图。服务器600可包括输入设备601、输出设备604、处理器602和存储器603。FIG. 8 is a schematic structural diagram of a server 600 according to an embodiment of the present invention. Server 600 can include input device 601, output device 604, processor 602, and memory 603.
存储器603可以包括只读存储器和随机存取存储器,并向处理器602提供指令和数据。存储器603的一部分还可以包括非易失性随机存取存储器(NVRAM)。Memory 603 can include read only memory and random access memory and provides instructions and data to processor 602. A portion of the memory 603 may also include non-volatile random access memory (NVRAM).
存储器603存储了如下的元素,可执行模块或者数据结构,或者它们的子集,或者它们的扩展集:The memory 603 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
操作指令:包括各种操作指令,用于实现各种操作。 Operation instructions: include various operation instructions for implementing various operations.
操作系统:包括各种系统程序,用于实现各种基础业务以及处理基于硬件的任务。Operating system: Includes a variety of system programs for implementing various basic services and handling hardware-based tasks.
在本发明实施例中,处理器602通过调用存储器603存储的操作指令(该操作指令可存储在操作系统中),执行如下操作:In the embodiment of the present invention, the processor 602 performs the following operations by calling an operation instruction stored in the memory 603 (the operation instruction can be stored in the operating system):
获取接收到的数据包的发送序号;Obtaining the sending sequence number of the received data packet;
将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;Marking a mark number position corresponding to the transmission sequence number in a preset linear sequence of tag numbers;
当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。When the position of the mark sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
本发明实施例中,服务器600采用获取接收到的数据包的发送序号;将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。这样,服务器600作为数据发送方,在不可靠传输过程中,服务器600检测到有数据包丢失时,可以仅仅对丢失后的数据包向数据发送方发送重传请求,从而在保证网络最大化利用的前提下,降低了真正丢包的概率;当服务器600检测到有数据包乱序时,可以预先采取调整措施,从而保证传输的音视频文件能够正常播放,提高了不可靠传输的可靠性。In the embodiment of the present invention, the server 600 uses the sending sequence number of the received data packet, and marks the position of the tag sequence number corresponding to the sending sequence number in the preset linear sequence of the tag number; When the tag sequence number is not continuous, it is determined that there is packet loss or out of order. In this way, the server 600 acts as a data sender. In the unreliable transmission process, when the server 600 detects that there is a packet loss, the server 600 can only send a retransmission request to the data sender for the lost data packet, thereby maximizing the use of the network. Under the premise, the probability of real packet loss is reduced; when the server 600 detects that the data packet is out of order, the adjustment measures can be taken in advance to ensure that the transmitted audio and video files can be played normally, and the reliability of the unreliable transmission is improved.
处理器602控制服务器600的操作,处理器602还可以称为CPU(Central Processing Unit,中央处理单元)。存储器603可以包括只读存储器和随机存取存储器,并向处理器602提供指令和数据。存储器603的一部分还可以包括非易失性随机存取存储器(NVRAM)。具体的应用中,服务器600的各个组件通过总线系统605耦合在一起,其中总线系统605除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线系统605。The processor 602 controls the operation of the server 600, which may also be referred to as a CPU (Central Processing Unit). Memory 603 can include read only memory and random access memory and provides instructions and data to processor 602. A portion of the memory 603 may also include non-volatile random access memory (NVRAM). In a specific application, the various components of the server 600 are coupled together by a bus system 605. The bus system 605 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as bus system 605 in the figure.
上述本发明实施例揭示的方法可以应用于处理器602中,或者由处理器602实现。处理器602可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器602中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器602可以是通用处理器、数字信号处理器(DSP)、 专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器603,处理器602读取存储器603中的信息,结合其硬件完成上述方法的步骤。The method disclosed in the foregoing embodiments of the present invention may be applied to the processor 602 or implemented by the processor 602. Processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 602 or an instruction in a form of software. The processor 602 described above may be a general purpose processor, a digital signal processor (DSP), Application Specific Integrated Circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or carried out. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present invention may be directly implemented by the hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor. The software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like. The storage medium is located in the memory 603, and the processor 602 reads the information in the memory 603 and completes the steps of the above method in combination with its hardware.
可选地,所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;Optionally, the mark sequence serial queue is provided with a fixed length mobility detection window. In the initial state, the coverage of the detection window is [a, a+n-1], where a is the mark The smallest number of the label in the serial number queue, where n is the fixed length;
处理器602当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;The processor 602 moves the detection window when the label sequence number corresponding to the sending sequence number is not in the coverage of the detection window, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
处理器602确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。The processor 602 determines that the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
处理器602将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The processor 602 marks, in the preset linear sequence of the tag sequence number, a tag sequence number corresponding to the transmission sequence number as a received state, and the tag sequence number in the linear queue is marked as an unreceived state before being marked.
处理器602还在确定有数据包丢失或乱序之后, Processor 602 also determines that there is a packet loss or out of order,
判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;Determining whether the tag sequence number corresponding to the lost or out-of-order data packet is out of the detection window and is still in an unreceived state;
若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存 储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。A person of ordinary skill in the art can understand that all or part of the steps of the foregoing embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable memory. In the storage medium, the storage medium may include: a ROM, a RAM, a magnetic disk, or an optical disk.
以上对本发明实施例所提供的检测数据包的方法、装置及存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The method, device and storage medium for detecting data packets provided by the embodiments of the present invention are described in detail. The principles and implementation manners of the present invention are described in the following. The description of the above embodiments is only for helping. The method of the present invention and its core idea are understood; at the same time, for those skilled in the art, according to the idea of the present invention, there are changes in the specific embodiments and application scopes. It should be understood that the invention is limited.

Claims (11)

  1. 一种检测数据包的方法,其特征在于,包括:A method for detecting a data packet, comprising:
    获取接收到的数据包的发送序号;Obtaining the sending sequence number of the received data packet;
    将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;Marking a mark number position corresponding to the transmission sequence number in a preset linear sequence of tag numbers;
    当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。When the position of the mark sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder.
  2. 根据权利要求1所述的方法,其特征在于,所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;The method according to claim 1, wherein the mark sequence serial queue is provided with a fixed length mobility detection window, and in the initial state, the detection window has a coverage range of [a, a+n-1 ], wherein a is the smallest mark serial number in the linear sequence of the mark serial number, and n is the fixed length;
    所述当连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序,包括:When the location of the label sequence number corresponding to the transmission sequence number acquired twice consecutively is discontinuous, it is determined that there is packet loss or disorder, including:
    当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;When the tag sequence number corresponding to the sending sequence number is not in the coverage of the detection window, the detection window is moved, so that the maximum tag number covered by the detection window is a tag sequence number corresponding to the sending sequence number;
    当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。When the sequence number span between the maximum mark sequence number and the maximum mark sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
  3. 根据权利要求2所述的方法,其特征在于,所述确定有数据包丢失或乱序,包括:The method according to claim 2, wherein said determining that there is packet loss or out of order comprises:
    确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。Determining the maximum tag number covered before the detection window moves, and the packet corresponding to the tag sequence number between the maximum tag sequence number after the movement is lost or out of order.
  4. 根据权利要求2-3任一所述的方法,其特征在于,将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记,包括:The method according to any one of claims 2-3, wherein the marking sequence number corresponding to the sending sequence number in the preset linear sequence of tag numbers is marked, including:
    将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The mark sequence number corresponding to the transmission sequence number in the preset tag sequence linear queue is marked as the received state, and the tag sequence number position in the linear queue is marked as the unreceived state before being marked.
  5. 根据权利要求4所述的方法,其特征在于,所述确定有数据包丢失或乱序之后,所述方法还包括:The method according to claim 4, wherein after the determining that there is packet loss or out of order, the method further comprises:
    判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖 后,是否仍为未接收状态;Determining that the tag number corresponding to the lost or out-of-order packet is out of the detection window After, is it still unreceived;
    若是,则判定所述确定为丢失或乱序的数据包已丢失。If so, it is determined that the data packet determined to be lost or out of order has been lost.
  6. 一种检测数据包的装置,其特征在于,包括:An apparatus for detecting a data packet, comprising:
    获取单元,用于获取接收到的数据包的发送序号;An obtaining unit, configured to acquire a sending sequence number of the received data packet;
    标记单元,用于将预置的标记序号线性队列中与所述发送序号对应的标记序号位置进行标记;a marking unit, configured to mark a mark serial number position corresponding to the sending serial number in the preset linear sequence of the marking serial number;
    确定单元,用于当所述获取单元连续两次获取的发送序号对应的标记序号位置不连续时,确定有数据包丢失或乱序。And a determining unit, configured to determine that a packet is lost or out of order when the location of the tag sequence corresponding to the sending sequence number obtained by the acquiring unit is consecutively discontinuous.
  7. 根据权利要求6所述的装置,其特征在于,所述标记单元标记的所述标记序号线性队列上设置有固定长度的移动性检测窗口,初始状态下,所述检测窗口的覆盖范围为[a,a+n-1],其中,a为所述标记序号线性队列中最小的标记序号,n为所述固定长度;The apparatus according to claim 6, wherein the mark sequence linear queue of the mark unit mark is provided with a fixed length mobility detection window, and in the initial state, the detection window has a coverage range of [a] , a+n-1], wherein a is the smallest mark serial number in the linear sequence of the mark serial number, and n is the fixed length;
    所述确定单元,还用于当所述发送序号对应的标记序号不在所述检测窗口覆盖范围内时,移动所述检测窗口,使得所述检测窗口覆盖的最大标记序号为所述发送序号对应的标记序号;当所述最大标记序号与所述检测窗口移动前覆盖的最大标记序号之间的序号跨度大于1时,确定有数据包丢失或乱序。The determining unit is further configured to: when the label sequence number corresponding to the sending sequence number is not in the coverage of the detection window, move the detection window, so that a maximum tag number covered by the detection window is corresponding to the sending sequence number The tag sequence number; when the sequence number span between the maximum tag sequence number and the maximum tag sequence number covered before the detection window moves is greater than 1, it is determined that there is packet loss or disorder.
  8. 根据权利要求7所述的装置,其特征在于,The device of claim 7 wherein:
    所述确定单元具体用于确定所述检测窗口移动前覆盖的最大标记序号,与移动后覆盖的最大标记序号之间的标记序号对应的数据包丢失或乱序。The determining unit is specifically configured to determine that the maximum tag number covered by the detection window before moving, and the data packet corresponding to the tag sequence number between the largest tag sequence number after the movement is lost or out of order.
  9. 根据权利要求7-8任一所述的装置,其特征在于,所述标记单元具体用于将预置的标记序号线性队列中与所述发送序号对应的标记序号位置标记为已接收状态,所述标记序号线性队列中标记序号位置被标记前为未接收状态。The device according to any one of claims 7-8, wherein the marking unit is specifically configured to mark the position of the marking sequence number corresponding to the sending serial number in the preset linear sequence of the marking serial number as the received state. The tag sequence number in the linear queue is marked as unreceived before being marked.
  10. 根据权利要求9所述的装置,其特征在于,所述装置还包括:The device according to claim 9, wherein the device further comprises:
    判断单元,用于判断确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后,是否仍为未接收状态;a judging unit, configured to determine whether the tag sequence corresponding to the lost or out-of-order packet is out of the detection window, and is still in an unreceived state;
    所述确定单元,还用于当所述判断单元判断出确定为丢失或乱序的数据包对应的标记序号脱离所述检测窗口覆盖后仍为未接收状态时,则判定所述确定为丢失或乱序的数据包已丢失。 The determining unit is further configured to: when the determining unit determines that the tag sequence corresponding to the lost or out-of-order data packet is still in an unreceived state after being covered by the detection window, determining that the determining is lost or Out of order packets have been lost.
  11. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行上述权利要求1-5任一项所述的检测数据包的方法。 A storage medium comprising computer executable instructions for performing the method of detecting a data packet of any of the above claims 1-5 when executed by a computer processor.
PCT/CN2014/088153 2013-10-21 2014-10-08 Method and device for detecting data packet, and storage medium WO2015058613A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310495811.9 2013-10-21
CN201310495811.9A CN103501259B (en) 2013-10-21 2013-10-21 A kind of method of packet loss detection and detection device

Publications (1)

Publication Number Publication Date
WO2015058613A1 true WO2015058613A1 (en) 2015-04-30

Family

ID=49866434

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/088153 WO2015058613A1 (en) 2013-10-21 2014-10-08 Method and device for detecting data packet, and storage medium

Country Status (2)

Country Link
CN (1) CN103501259B (en)
WO (1) WO2015058613A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109756306A (en) * 2017-11-03 2019-05-14 华为技术有限公司 Information transferring method and communication equipment
CN113676413A (en) * 2021-08-26 2021-11-19 锐捷网络股份有限公司 Method and device for rearranging disordered messages and storage medium
CN115834002A (en) * 2022-11-16 2023-03-21 江苏为是科技有限公司 High-speed transmission system and method

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103501259B (en) * 2013-10-21 2016-08-31 腾讯科技(深圳)有限公司 A kind of method of packet loss detection and detection device
CN105471825B (en) * 2014-09-03 2019-08-23 南京中兴软件有限责任公司 Lose recognition methods and the device of data message
CN105356975A (en) * 2015-11-27 2016-02-24 尹绍华 Data transmission method
CN105607859B (en) * 2016-03-02 2018-12-11 腾讯科技(深圳)有限公司 A kind of data processing method and device
US10841833B2 (en) * 2016-10-12 2020-11-17 Qualcomm Incorporated Streamlined user plane headers for high data rates
CN108123990B (en) * 2016-11-30 2020-06-16 华为技术有限公司 Data storage method, data storage system and data processing equipment
CN109120383B (en) 2017-06-26 2021-11-26 深圳市道通智能航空技术股份有限公司 Unmanned aerial vehicle, ground station thereof and data transmission method
CN109842856A (en) * 2017-11-29 2019-06-04 成都鼎桥通信技术有限公司 A kind of method and apparatus shielding uplink packet loss
CN108551378B (en) * 2018-02-08 2019-09-06 中国航天时代电子有限公司 A kind of radiofrequency signal remote transmission method
CN113328901B (en) * 2020-02-28 2023-04-28 华为技术有限公司 Message out-of-order detection method, device and system
CN116760744B (en) * 2023-08-17 2023-11-07 新华三技术有限公司 Packet loss statistical method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101488841A (en) * 2009-02-18 2009-07-22 中兴通讯股份有限公司 Frame retransmission method and apparatus for radio link protocol
CN101527927A (en) * 2008-03-04 2009-09-09 大唐移动通信设备有限公司 Data receiving method and data receiving device for radio link control layer in long time evolution system
CN102333337A (en) * 2011-10-11 2012-01-25 中兴通讯股份有限公司 Script transmission method, wireless network simulation system (iNES) and server
US20130044595A1 (en) * 2011-08-19 2013-02-21 Futurewei Technologies, Inc. System and Method for Transmission Control Protocol Service Delivery in Wireless Communications Systems
CN103338131A (en) * 2013-06-20 2013-10-02 百度在线网络技术(北京)有限公司 Method and equipment for testing log transmitting loss rate
CN103501259A (en) * 2013-10-21 2014-01-08 腾讯科技(深圳)有限公司 Packet loss detection method and detector

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101527927A (en) * 2008-03-04 2009-09-09 大唐移动通信设备有限公司 Data receiving method and data receiving device for radio link control layer in long time evolution system
CN101488841A (en) * 2009-02-18 2009-07-22 中兴通讯股份有限公司 Frame retransmission method and apparatus for radio link protocol
US20130044595A1 (en) * 2011-08-19 2013-02-21 Futurewei Technologies, Inc. System and Method for Transmission Control Protocol Service Delivery in Wireless Communications Systems
CN102333337A (en) * 2011-10-11 2012-01-25 中兴通讯股份有限公司 Script transmission method, wireless network simulation system (iNES) and server
CN103338131A (en) * 2013-06-20 2013-10-02 百度在线网络技术(北京)有限公司 Method and equipment for testing log transmitting loss rate
CN103501259A (en) * 2013-10-21 2014-01-08 腾讯科技(深圳)有限公司 Packet loss detection method and detector

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109756306A (en) * 2017-11-03 2019-05-14 华为技术有限公司 Information transferring method and communication equipment
CN109756306B (en) * 2017-11-03 2023-10-03 华为技术有限公司 Information transmission method and communication device
CN113676413A (en) * 2021-08-26 2021-11-19 锐捷网络股份有限公司 Method and device for rearranging disordered messages and storage medium
CN115834002A (en) * 2022-11-16 2023-03-21 江苏为是科技有限公司 High-speed transmission system and method
CN115834002B (en) * 2022-11-16 2023-10-31 江苏为是科技有限公司 High-speed transmission system and method

Also Published As

Publication number Publication date
CN103501259A (en) 2014-01-08
CN103501259B (en) 2016-08-31

Similar Documents

Publication Publication Date Title
WO2015058613A1 (en) Method and device for detecting data packet, and storage medium
WO2018121148A1 (en) Communication resource selection method, hand-held intelligent terminal and access device
WO2017028577A1 (en) Method and apparatus for displaying group chat content
WO2018170833A1 (en) Uplink data transmission method, terminal, network side device and system
WO2018049887A1 (en) Data transmission processing method and terminal device
TWI520043B (en) Method, device and moving terminal for examining messages
WO2015043189A1 (en) Message display method and apparatus, and terminal device
WO2019047019A1 (en) Information transmission method and related product
WO2019052554A1 (en) Method for reducing ue capability signalling structural content, and storage medium and mobile phone
WO2018036026A1 (en) Data transmission method, base station, target terminal, system and storage medium
WO2018049894A1 (en) Data transmission method and device
CN110932825B (en) Hybrid automatic repeat request response feedback method and terminal
WO2018126457A1 (en) Data transmission method and device
US20170171255A1 (en) Method and device for establishing a data connection and computer-readable medium
CN111800867B (en) Feedback method of semi-persistent scheduling physical downlink shared channel and terminal equipment
BR112016018783B1 (en) METHOD, APPARATUS, DEVICE AND INTERCOMMUNICATION SYSTEM
WO2019076250A1 (en) Push message management method and related products
WO2015074387A1 (en) Sliding operation response method, apparatus and terminal device
TW201541337A (en) Method, device and system for displaying messages in mobile terminal
WO2021027713A1 (en) Uplink transmission method, uplink transmission control method, and related device
WO2015081880A1 (en) Method, device and system for processing cluster service attribute
WO2018049969A1 (en) Hotspot establishment method and related device
CN104240710B (en) A kind of method, system and the terminal device of information transmission
US11258844B2 (en) Bluetooth transmission control method, control system, and storage medium
WO2017005080A1 (en) Webpage display method, terminal device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14856047

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 06.09.2016)

122 Ep: pct application non-entry in european phase

Ref document number: 14856047

Country of ref document: EP

Kind code of ref document: A1