Communication method, terminal equipment, network equipment, collector

By introducing packet headers into the IP network to include device identification and statistical information, the problem of defining lost packet devices in the IP network is solved, efficient packet loss detection is achieved, the analysis load of the collector is reduced, and network equipment is improved and terminal equipment performance.

CN113132171BActive Publication Date: 2024-11-19HUAWEI TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN201911415026.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-31
Publication Date
2024-11-19
Estimated Expiration
2039-12-31

AI Technical Summary

Technical Problem

In IP networks, it is difficult for the prior art to efficiently determine the devices that lost data packets, resulting in the collector spending a lot of time and computing resources to conduct a comprehensive analysis of a large amount of information.

Method used

By introducing a packet header in the network device and terminal device, including device identification and statistical information, the network device and terminal device allow the network device and terminal device to determine the data stream to which the packet belongs when receiving the packet, and send a data packet containing the device identification to the collector to the collector , reduce the analysis load of the collector.

Benefits of technology

It realizes the device that has lost data packets more efficiently in the IP network, reduces the time and computing resource requirements of the collector, and improves the performance of network devices and terminal devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113132171B_ABST
    Figure CN113132171B_ABST
Patent Text Reader

Abstract

The present application provides a communication method and device. A network device receives a data packet from a first node and determines the data stream to which the data packet belongs. The network device determines a first statistical number of data packets belonging to the data stream that the network device has received; and determines whether the data packet includes a first header, the first header including the device identification of the first node and a second statistical number of data packets belonging to the data stream that the first node has sent. When the first header is included in the data packet and the difference between the second statistical number and the first statistical number is greater than a set value, the network device sends the data packet including a second header to a collector, the second header including the first statistical number and the device identification of the network device. According to the technical solution of the present application, the device that loses data packets in the IP network can be determined more efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to communication methods and terminal equipment, network equipment, and collectors. Background Art

[0002] The Internet Protocol (IP) network usually includes a large number of network devices and terminal devices. The device type, quantity, connection relationship, etc. of each network device and terminal device are usually deployed by users and network operators based on actual business needs. For any two terminal devices in an IP network, the data packets required to be exchanged between the two terminal devices can be transmitted through the data link provided by one or more network devices. In order to ensure that the data link can be used to efficiently transmit the data packets required to be exchanged by the corresponding terminal devices, it is necessary to promptly discover and maintain the devices that lose data packets.

[0003] At present, a functional module based on the Internet Protocol Flow Information Export (IPFIE) protocol can be pre-deployed in each network device and terminal device. This functional module collects the number of packets, total number of bytes, timestamp and other traffic of each data flow to form a flow table, and sends the flow table to the collector. The collector then conducts a comprehensive analysis of the flow table from each device to determine the device that lost the data packet.

[0004] In this solution, each network device and terminal device in the IP network needs to send a flow table containing a large amount of information to the collector. The number of network devices and terminal devices is also relatively large, which causes the collector to spend a lot of time and computing resources to conduct a comprehensive analysis of each flow table in order to determine the device that loses the data packet. Summary of the invention

[0005] The present application provides a communication method and terminal equipment, network equipment, and collector, which can more efficiently determine the device that loses data packets in the IP network.

[0006] In a first aspect, a communication method applied to a network device is provided, the method comprising: receiving a data packet from a first node, and determining a data stream to which the data packet belongs, the first node being the previous hop of the network device, the first node comprising a first terminal device or a first network device; determining a first statistical number of data packets belonging to the data stream that have been received by the network device; determining whether the data packet includes a first header, the first header comprising a device identification of the first node and a second statistical number of data packets belonging to the data stream that have been sent by the first node; in a case where the data packet includes the first header, determining whether a difference between the second statistical number and the first statistical number is greater than a set value; in a case where the difference is greater than the set value, sending the data packet including a second header to a collector, the second header including the first statistical number and the device identification of the network device.

[0007] In this way, when the first node as its previous hop loses a data packet belonging to a data stream, the network device can send a data packet including the device identification of the first node to the collector, so that the collector can determine that the first node loses the data packet according to the device identification of the first node included in the received data packet. The collector does not need to spend a lot of time and computing resources to comprehensively analyze a large amount of information, and can more efficiently determine the device that loses the data packet in the IP network.

[0008] In a possible implementation, the method further includes: when the first header is included in the data packet, sending the data packet including the second header to a second node, the second node being the next hop of the network device, the second node including a second terminal device or a second network device. In this way, it is ensured that the second node as the next hop of the network device can know the statistical number of data packets received / sent by the network device and belonging to the corresponding data flow, so as to find out whether the network device has lost data packets belonging to the corresponding data flow.

[0009] In a possible implementation, the second header is located between the first header and the payload included in the data packet. Thus, the collector and the second node as the next hop of the network device can more quickly determine the header inserted into the data packet by the network device according to the positions of the headers included in the received data packet in the data packet.

[0010] In a possible implementation manner, the determining whether the data packet includes the first header includes: determining whether the data packet includes the first header according to a preset identifier, the first header including the preset identifier.

[0011] In a possible implementation, determining whether the data packet includes the first header includes: determining whether the data packet includes the first header based on indication information, wherein the indication information is located in an option included in a transport layer protocol header of the data packet.

[0012] In a possible implementation, after determining whether the difference between the second statistical quantity and the first statistical quantity is greater than a set value, the method further includes: setting the first statistical quantity to an initial value. In this way, data packets belonging to the same data stream are segmented and counted, so that after a network device in the IP network loses a data packet belonging to the data stream, the second node as the next hop of the network device avoids sending a corresponding data packet to the collector every time it receives a data packet belonging to the data stream, thereby increasing the load of the second node.

[0013] In a possible implementation, before determining the first statistical number of data packets belonging to the data stream that the network device has received, the method further includes: determining whether the data packet includes another header, the other header indicating that the data packet is the first data packet belonging to the data stream sent by the first terminal device; when the data packet includes the other header, sending the data packet to the collector and the second node respectively, and recording that the current statistical number of data packets belonging to the data stream that the network device has received is 1, the second node is the next hop of the network device, and the second node includes a second terminal device or a second network device. In this way, the network device can more efficiently determine the device that has lost the first data packet belonging to a data stream in the IP network.

[0014] In a second aspect, a communication method applied to a terminal device is provided, the method comprising: obtaining a data packet to be sent, and determining a data stream to which the data packet belongs; determining a current statistical number of data packets belonging to the data stream that have been sent by the terminal device; and sending the data packet including a first header to a network device when the current statistical number meets a preset condition, the first header including a device identification of the terminal device and a first statistical number of data packets belonging to the data stream that have been sent by the terminal device, the difference between the first statistical number and the current statistical number being 1.

[0015] In this way, the terminal device does not need to insert the corresponding header into each data packet belonging to the same data stream, which can more efficiently determine the lost data packets in the IP network while reducing the load of the terminal device and network equipment as much as possible and improving the performance of the terminal device and network equipment.

[0016] In a possible implementation, the first header is located between the transport layer protocol header and the payload included in the data packet. Thus, the collector and the second node as the next hop of the network device can more quickly determine the header inserted into the data packet by the network device according to the positions of the respective headers included in the received data packet in the data packet.

[0017] In a possible implementation, the method further includes: when the current statistical quantity does not meet a preset condition, sending the data packet to the network device and adding 1 to the current statistical quantity.

[0018] In a possible implementation, after sending the data packet including the first header to the network device, the method further includes: setting the current statistical quantity to an initial value. In this way, data packets belonging to the same data stream are segmented and counted, so as to avoid that after the terminal device loses a data packet belonging to the data stream, the network device as the next hop of the terminal device sends a corresponding data packet to the collector every time it receives a data packet belonging to the data stream, thereby increasing the load of the network device.

[0019] In a possible implementation, the first header further includes a preset identifier, and the preset identifier is used to indicate that the data packet includes the first header. In this way, the collector and other network devices or second terminal devices that are the next hop of the network device can more quickly determine the header inserted into the data packet by the network device according to the preset identifier.

[0020] In a possible implementation, the data packet further includes indication information, the indication information is located in an optional item included in the transport layer protocol header of the data packet, and the indication information is used to indicate whether the data packet includes the first header. In this way, the network device can know whether the data packet includes the header inserted into the data packet by the first node as the previous hop of the network device without having to fully parse all the headers included in the data packet it receives.

[0021] In a possible implementation, the method further includes: before determining the current statistical number of data packets belonging to the data stream that have been sent by the terminal device, the method further includes: determining whether the data packet is the first data packet belonging to the data stream sent by the terminal device; in a case where the data packet is the first data packet belonging to the data stream sent by the terminal device, sending the data packet including another header to the network device, and recording the current statistical number of data packets belonging to the data stream that have been sent by the network device as 1, wherein the other header is used to indicate that the data packet is the first data packet belonging to the data stream sent by the terminal device.

[0022] In this way, when each network device receives the first data packet belonging to a data stream, it can send the data packet to the collector according to the instruction of another header included in the data packet, so that the collector can determine the network device that lost the data packet in the IP network based on the data packet.

[0023] In a third aspect, a communication method applied to a collector is provided, the method comprising: receiving a first data packet from a network device; determining a first header from the first data packet, the first header including a device identifier of a first node, the first node being the previous hop of the network device, the first node including a first terminal device or a first network device; and determining that the first node loses a data packet according to the device identifier of the first node. In this way, the collector can determine that the first node loses a data packet according to the device identifier of the first node included in the data packet it receives, without spending a lot of time resources and computing resources to comprehensively analyze a large amount of information, and can more efficiently determine the device that loses the data packet in the IP network.

[0024] Here, the collector can determine that the first node has lost the data packet based on the device identifier of the first node included in the received data packet. The collector does not need to spend a lot of time and computing resources to conduct a comprehensive analysis of a large amount of information, and can more efficiently determine the device that has lost the data packet in the IP network.

[0025] In one possible implementation, determining the first header from the first data packet includes: determining at least two headers from the payload included in the first data packet according to a preset identifier, each of the headers including the preset identifier; and determining the first header from the at least two headers according to positions of the at least two headers in the payload, respectively.

[0026] In a possible implementation, the method further includes: receiving second data packets from a plurality of network devices respectively, and recording the corresponding receiving times when receiving each of the data packets, wherein the payload of the second data packet includes another header, and the other header is used to indicate that the payload is the first data packet belonging to a data stream sent by the first terminal device; in the case where no indication is received from the second terminal device, determining the target network device from each of the network devices, and the corresponding receiving time when the collector receives the second data packet from the target network device is the maximum value among the receiving times; wherein the indication information is sent to the collector by the second terminal device after receiving the payload sent by the first terminal device to the second terminal device, and the indication information is used to indicate that the second terminal device has received the payload sent by the first terminal device to the second terminal device; determining that the target network device has lost the data packet. Here, the collector can more efficiently determine the device that has lost the first data packet belonging to a data stream in the IP network.

[0027] In a fourth aspect, a computer-readable storage medium is provided for storing instructions, which, when executed by a processor of a computing device, enables the computing device to implement any one of the methods in the first aspect, the second aspect or the third aspect.

[0028] According to a fifth aspect, a computer program product is provided, the computer program product comprising a computer program code, which, when executed on a computing device, enables the computing device to implement the method described in any one of the first aspect, the second aspect or the third aspect.

[0029] In a sixth aspect, a network device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the first aspects is implemented.

[0030] In a seventh aspect, a terminal device is provided, comprising a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method described in any one of the second aspects is implemented.

[0031] In an eighth aspect, a collector is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the third aspects is implemented.

[0032] In a ninth aspect, a communication device is provided, wherein the communication device has the functions of the network device / terminal device / collector in the above-mentioned aspects.

[0033] In a tenth aspect, a communication device is provided, and the communication device may be the network device / terminal device / collector described in the above-mentioned various aspects, or a chip set in the network device / terminal device / collector. The communication device includes a memory, a communication interface, and a processor, wherein the memory is used to store computer programs or instructions, and the processor is coupled to the memory and the communication interface, and when the processor executes the computer program or instruction, the communication device executes any one of the methods described in the above-mentioned first aspect / second aspect / third aspect.

[0034] In the eleventh aspect, a chip system is provided, which includes a processor for implementing the functions of the network device / terminal device / processor described in the above-mentioned various aspects, for example, receiving or processing the data and / or information involved in the method of the first aspect / second aspect / third aspect. In one possible design, the chip system also includes a memory, which is used to store program instructions and / or data. The chip system can be composed of chips, or it can include chips and other discrete devices.

[0035] According to the technical solution provided in the present application, when a first node as its previous hop loses a data packet belonging to a data stream, the network device can send a data packet including the device identification of the first node to a collector, so that the collector can determine that the first node loses the data packet according to the device identification of the first node included in the received data packet. The collector does not need to spend a lot of time and computing resources to comprehensively analyze a large amount of information, and can more efficiently determine the device that loses the data packet in the IP network. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A system framework diagram of an exemplary IP network provided in an embodiment of the present application;

[0037] Figure 2 A flow chart of a communication method applied to a terminal device provided in an embodiment of the present application;

[0038] Figure 3 This is a schematic diagram of the message structure of the first header inserted into the data packet by the terminal device in an embodiment of the present application;

[0039] Figure 4 A flow chart of another communication method using a terminal device provided in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of a message structure of another header inserted into a data packet by a terminal device in an embodiment of the present application;

[0041] Figure 6A flow chart of a communication method applied to a network device provided in an embodiment of the present application;

[0042] Figure 7 A schematic diagram of a process for processing a data packet belonging to a data flow in an exemplary IP network;

[0043] Figure 8 is a schematic diagram of the structure of an exemplary data packet;

[0044] Figure 9 is a flow chart of another communication method applied to a network device provided in an embodiment of the present application;

[0045] Fig.10 A flow chart of a communication method applied to a collector provided in an embodiment of the present application;

[0046] Fig.11 A schematic diagram of a process for processing the first data packet belonging to a data flow in an exemplary IP network;

[0047] Fig.12 A schematic diagram of the structure of a communication device applied to a terminal device provided in an embodiment of the present application;

[0048] Fig.13 A schematic diagram of the structure of a communication device applied to a network device provided in an embodiment of the present application;

[0049] Fig.14 A schematic diagram of the structure of a communication device applied to a collector provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0051] In the embodiment of the present application, the terminal device (TD) may be a mobile device (mobiledevice), user equipment (UE), terminal (terminal), mobile station (MS), mobile terminal (MT), personal computer, server, etc. In the embodiment of the present application, the network device is a device for connecting a communication line, and may specifically be a repeater, hub, switch, router or base station equipment. Among them, the communication line is a path to ensure information transmission, and may specifically be a wired line such as an optical cable or an electric cable, or may be a wireless line in various wireless communication technologies.

[0052] It can be understood that for any terminal device in the IP network, the terminal device can send a data packet to another terminal device in the IP network through a data link provided by a number of network devices. Figure 1 , the data packets sent by terminal device 1 to terminal device 2 can be transmitted through the data links provided by network device 1, network device 3, network device 4, and network device 6; the data packets sent by terminal device 1 to terminal device 3 or terminal device 4 can also be transmitted through the data links provided by network device 1, network device 2, network device 4, and network device 5.

[0053] It can be understood that the data packet sent by the terminal device at least includes an IP header and a transport layer protocol header; usually, the data packet may also include a payload and / or other headers used to assist in completing specific services. Among them, the IP header at least includes a source IP address, a destination IP address and a transport layer protocol type; the transport layer protocol header may be a Transmission Control Protocol (TCP) header / User Datagram Protocol (UDP) header including at least a source port number and a destination port number.

[0054] In a possible implementation, for a data packet, the data packet may be divided into a data stream identified by a source IP address and a destination IP address included in the data packet. That is, each data packet sent by terminal device 1 to terminal device 2 will be divided into one data stream, and each data packet sent by terminal device 1 to terminal device 3 will be divided into another data stream.

[0055] In a possible implementation, for a data packet, the data packet may be divided into a data stream identified by the five-tuple of the data packet. That is, multiple data packets sent by terminal device 1 to terminal device 2 may be divided into different data streams, wherein each data packet belonging to the same data stream has the same source IP address, the same destination IP address, the same transport layer protocol type, the same source port number, and the same destination port number.

[0056] In the embodiment of the present application, through one of the two possible implementation methods described above, the data streams to which the several data packets sent by the terminal device belong are divided, and the multiple data packets sent by a terminal device and belonging to the same data stream will be transmitted to another terminal device by the same data link. In other words, if the first data packet belonging to a data stream sent by terminal device 1 to terminal device 2 is transmitted through the data link provided by network device 1, network device 3, network device 4, and network device 6, then the other data packets belonging to the data stream sent by terminal device 1 to terminal device 2 will also be transmitted through the data link provided by network device 1, network device 3, network device 4, and network device 6.

[0057] Correspondingly, for any two network devices directly connected through the corresponding communication line on the data link, if the statistical numbers of data packets belonging to the same data flow received by the two network devices are not exactly the same, it means that the network device with the larger statistical number has lost the data packets belonging to the data flow.

[0058] Accordingly, in order to more efficiently determine the device that loses data packets in the IP network, at least one or more communication methods and devices are provided in the embodiments of the present application. Among them, after the network device receives a data packet belonging to a data stream from the first node as its previous hop, it can determine the first statistical number of data packets belonging to the data stream that it has received; if the data packet includes a first header, the first header includes the device identification of the first node and the second statistical number of data packets belonging to the data stream that the first node has sent, and the difference between the second statistical number and the first statistical number is greater than a set value, it means that the first node has lost the data packet belonging to the data stream. Accordingly, the data packet containing the second header information can be sent to the collector by the network device, and the second header contains the device identification of the network device and the first statistical number.

[0059] In other words, when the first node as its previous hop loses a data packet belonging to a data stream, the network device can send a data packet including the device identification of the first node to the collector, so that the collector can determine that the first node lost the data packet based on the device identification of the first node included in the received data packet, and the device that loses the data packet in the IP network can be discovered without spending a lot of time and computing resources to conduct a comprehensive analysis of a large amount of information.

[0060] The following is a more detailed description of the steps that each of the terminal devices, network devices, collectors and other devices needs to perform during the communication process in the embodiments of the present application.

[0061] Figure 2 1 is a flow chart of a communication method applied to a network device provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps 21 to 25.

[0062] First, in step 21, a data packet to be sent is obtained, and the data flow to which the data packet belongs is determined.

[0063] In a possible implementation, the terminal device can determine the data flow to which packet-n belongs based on the source IP address and destination IP address of the acquired data packet packet-n. That is, the data flow to which packet-n belongs can be the data flow identified by the source IP address and destination IP address of packet-n.

[0064] In a possible implementation, the terminal device may determine the data stream to which packet-n belongs based on the acquired quintuple of data packet-n. That is, the data stream to which packet-n belongs may be the data stream identified by the quintuple of packet-n.

[0065] It should be noted that the data packet packet-n obtained by the terminal device may also include a valid load, and the valid load may be business data from an application deployed on the terminal device.

[0066] It should be noted that the terminal device can automatically or under the trigger of the user determine whether it is necessary to perform packet loss measurement on the data stream to which packet-n belongs; when it is determined that packet loss measurement is required for the data stream to which packet-n belongs, the following step 22 and the business processing flow related to step 22 are executed for packet-n.

[0067] In step 22, it is determined whether the data packet is the first data packet belonging to the data flow sent by the terminal device.

[0068] In a more specific example, for the data packet packet-n obtained by the terminal device, the terminal device can query whether there is target statistical information including the quintuple of packet-n in the various statistical information it maintains. If the target statistical information does not exist, it is determined that packet-n is the first data packet obtained / sent by the terminal device and belongs to the data stream identified by the quintuple of packet-n; conversely, if the target statistical information exists, it is determined that packet-n is not the first data packet obtained / sent by the terminal device and belongs to the data stream identified by the quintuple of packet-n.

[0069] Wherein, in the case that the data packet is not the first data packet belonging to the data stream sent by the terminal device, the terminal device may further perform the following step 23.

[0070] In step 23, the current statistical number of data packets belonging to the data flow that have been sent by the terminal device is determined.

[0071] It is understandable that the terminal device may record the current statistical number of data packets that it has sent and that belong to each data flow.

[0072] Taking the example that each data packet belonging to the same data stream has the same five-tuple, any terminal device 1 in the IP network can maintain a traffic statistics table that is the same or similar to the following Table 1, and record the current statistical number of data packets that have been sent by the terminal device 1 and belong to each data stream by maintaining a number of statistical information in the traffic statistics table.

[0073] Table 1

[0074]

[0075] As shown in Table 1 above, each row except the row where each field name is located records a piece of statistical information; wherein IP_1 is the IP address of any terminal device 1 in the IP network, IP_2 is the IP address of any terminal device 2 in the IP network, and IP_3 is the IP address of any terminal device 3 in the IP network. For the data packet packet-n obtained by the terminal device 1, the terminal device 1 can further obtain the quintuple of packet-n, and query the various statistical information recorded in the above Table 1 according to the quintuple of packet-n, and obtain the current statistical number of data packets sent by the terminal device 1 and belonging to the data flow identified by the quintuple of packet-n. Specifically, in the quintuple of packet-n, the source IP address is IP_1, the destination IP address is IP_2, the transport layer protocol type is TCP, the source port number is C11, and the destination port number is C21. The terminal device 1 can determine that the current statistical quantity is X1 by querying the above Table 1; in the quintuple of packet-n, the source IP address is IP_1, the destination IP address is IP_2, the transport layer protocol type is TCP, the source port number is C12, and the destination port number is C22. The terminal device 1 can determine that the current statistical quantity is X2 by querying the above Table 1; in the quintuple of packet-n, the source IP address is IP_1, the destination IP address is IP_3, the transport layer protocol type is TCP, the source port number is C13, and the destination port number is C31. The terminal device 1 can determine that the current statistical quantity is X3 by querying the above Table 1.

[0076] Correspondingly, if the target statistical information including the quintuple of packet does not exist in the above Table 1, that is, the terminal device 1 has not searched the quintuple of packet-n in the above Table 1, the terminal device 1 can determine that packet is the first data packet sent by the terminal device 1 and belongs to the data stream identified by the quintuple of packet-n.

[0077] Next, in step 24, it is determined whether the current statistical quantity meets a preset condition.

[0078] Here, the preset condition can be set in combination with actual business needs, including but not limited to setting the preset condition to: the quotient of the current statistical quantity and the preset value is a positive integer; for example, the preset condition can also be set to (X+1) and the preset value is a positive integer, where X represents the current statistical quantity determined in step 23.

[0079] Here, when the current statistical quantity meets the preset conditions, the terminal device can further perform the following step 25 and / or the service processing flow related to step 25. That is to say, when the current statistical quantity does not meet the preset conditions, the terminal device does not need to perform the following step 25 and / or the more complicated service processing flow related to step 25 on the data packets it obtains, thereby reducing the load of the terminal device and improving the performance of the terminal device.

[0080] In step 25, the data packet including the first header is sent to the network device.

[0081] Among them, for the first header included in the data packet packet-n sent by the terminal device to the network device, the first header may at least include the device identification of the terminal device, the first statistical number of data packets that have been sent by the terminal device and belong to the data flow, and the difference between the first statistical number and the current statistical number determined in step 23 is 1. That is, the terminal device can insert the first header into the data packet packet-n it obtains when the current statistical number determined in step 23 meets the preset condition, and send the packet-n including the first header to the network device as the next hop of the terminal device.

[0082] For the convenience of description, the first header inserted into packet-n obtained by the terminal device is denoted as header-0 below.

[0083] In one possible implementation, header-0 inserted by the terminal device into packet-n may be located between the transport layer protocol header and the payload included in packet-n, so that the network device can quickly determine header-0 inserted by the terminal device into packet-n based on the position of header-0 in packet-n.

[0084] In a possible implementation, the header-0 inserted by the terminal device into the packet-n may further include a preset identifier, so that the network device can quickly determine the header-0 inserted by the terminal device into the packet-n according to the preset identifier.

[0085] For a more specific example, see Figure 3 The message corresponding to header-0 inserted by the terminal device into packet-n may include sub-message 1 for representing a preset identifier, sub-message 2 for representing the device identification of the terminal device, and sub-message 3 for representing the first statistical quantity; wherein the length of sub-message 1 may be a preset length a, the length of sub-message 2 may be a preset length b, and the length of sub-message 3 may be a preset length c.

[0086] In order to facilitate the network device to quickly determine whether the packet-n it receives includes the header-0 inserted by the terminal device, in a possible implementation, the terminal device may also insert indication information into the packet-n it obtains. The indication information may be located in the optional items included in the transport layer protocol header of the packet-n, and is used to indicate whether the packet-n received by the network device includes the header-0 inserted into the packet-n by the terminal device.

[0087] In a more specific example, if packet-n sent by the terminal device to the network device includes header-0, the terminal device inserts indication information with a value of 1 into the optional items included in the transport layer protocol header of packet-n; if packet-n sent by the terminal device to the network device does not include header-0 inserted into packet-n by the terminal device, the terminal device inserts indication information with a value of 0 into the optional items included in the transport layer protocol header of packet-n.

[0088] In order to facilitate the network device to determine the data stream to which the received packet-n belongs, in a possible implementation, the terminal device can also determine the flow identifier that can be used to uniquely identify the data stream to which packet-n belongs based on the quintuple of packet-n it obtains, and insert the flow identifier into packet-n. That is, the packet-n sent by the terminal device to the network device can also include the flow identifier of the data stream to which packet-n belongs.

[0089] In a more specific example, any terminal device 1 in the IP network can add a flow identification field based on the above Table 1, that is, the terminal device 1 can maintain a traffic statistics table as shown in the following Table 2.

[0090] Table 2

[0091]

[0092] Among them, for the data flow identified by the five-tuple consisting of source IP address IP_1, destination IP address IP_2, transport layer protocol type TCP, source port number C11, and destination port number C21, the data packet belonging to the data flow sent by terminal device 1 may include flow identifier L1. For the data flow identified by the five-tuple consisting of source IP address IP_1, destination IP address IP_2, transport layer protocol type TCP, source port number C12, and destination port number C22, the data packet belonging to the data flow sent by terminal device 1 may include flow identifier L2. For the data flow identified by the five-tuple consisting of source IP address IP_1, destination IP address IP_3, transport layer protocol type TCP, source port number C13, and destination port number C31, the data packet belonging to the data flow sent by terminal device 1 may include flow identifier L3.

[0093] In a more specific example, for packet-n including Header-0, the flow identifier may be located in Header-0. For example, the flow identifier may be located at any position after the preset identifier included in Header-0.

[0094] Furthermore, in Figure 2 Based on the embodiment shown, in a possible implementation manner, as Figure 4 As shown, in the case where the data packet is the first data packet belonging to the data stream sent by the terminal device, the terminal device may further perform step 41, send the data packet including another header to the network device, and record that the current statistical number of data packets belonging to the data stream sent by the terminal device is 1; wherein the other header is used to indicate that the data packet is the first data packet belonging to the data stream sent by the terminal device. In other words, the terminal device may insert another header into the first data packet belonging to a data stream obtained by it, and send the data packet including the other header to the network device as the next hop of the terminal device.

[0095] For the convenience of description, another header inserted into the data packet packet-n obtained by the terminal device is referred to as header below.

[0096] In a more specific example, Header can have a similar data structure to Header-0. Figure 5, the message corresponding to the header may include sub-message 1 for representing a preset identifier, sub-message 2 for representing a device identifier, and sub-message 3 for representing a characteristic value; wherein the length of sub-message 1 may be a preset length a, the length of sub-message 2 may be a preset length b, and the length of sub-message 3 may be a preset length c. The characteristic value is used to indicate that packet-n including the header is the first data packet belonging to the corresponding data stream sent by the terminal device; illustratively, the value of the characteristic value may be 0 or other preset values.

[0097] In a more specific example, the Header may have a data structure completely different from that of Header-0. For example, the Header may include another preset identifier, and the other preset identifier is used to indicate that packet-n including the Header is the first data packet belonging to the corresponding data stream sent by the terminal device.

[0098] In a more specific example, for packet-n including a Header, the Header may be located between the transport layer protocol header and the payload included in packet-n.

[0099] In a more specific example, for packet-n including a Header, packet-n may also include a flow identifier of a data flow to which packet-n belongs, and the flow identifier may be located in the Header.

[0100] In a more specific example, the terminal device can add a new statistical information to the traffic statistics table it maintains. The statistical information includes the five-tuple of packet-n obtained by the terminal device and the flow identifier of the data flow to which packet-n belongs, and the statistical information includes the current statistical quantity with a value of 1.

[0101] Furthermore, in order to avoid the network device losing a data packet belonging to a data stream, the second node as the next hop of the network device sends a data packet to the collector to notify the network device of the lost data packet when receiving each data packet belonging to the data stream. In a possible implementation, if the current statistical quantity meets the preset conditions, the terminal device may further execute step 42 after step 24 or step 25 to set the current statistical quantity to the initial value.

[0102] For example, if the preset condition is that the quotient of (X+1) and the preset value "100" is a positive integer, X represents the current statistical quantity determined in step 23. Then, for the data stream identified by the flow identifier L1, after the terminal device obtains the 100th data packet packet-n belonging to the data stream identified by L1 and sends packet-n containing Header-0 to the corresponding network device, the current statistical quantity "99" determined in step 23 can be reset to an initial value, such as reset to 0.

[0103] Accordingly, in Figure 2 Based on the embodiment shown, in a possible implementation manner, as Figure 4 As shown, when the current statistical quantity determined in step 23 does not meet the preset condition, the terminal device can also execute step 43 to send the data packet to the network device and add 1 to the current statistical quantity.

[0104] It can be understood that, for packet-n obtained by the terminal device, regardless of whether the terminal device inserts Header / Header-0 into the packet-n obtained by the terminal device, the terminal device can insert the flow identifier of the data flow to which packet-n belongs into the optional items included in the transport layer protocol header of packet-n. In other words, in packet-n sent by the terminal device, the optional items included in the transport layer protocol header can include the flow identifier of the data flow to which packet-n belongs.

[0105] Corresponding to the communication method applied to any terminal device in the IP network, the present application embodiment also provides a communication method applied to any network device in the IP network. Figure 6 As shown, the method may include the following steps 61

[0106] In step 61, a data packet is received from a first node, and a data flow to which the data packet belongs is determined, wherein the first node is a previous hop of a network device, and the data packet belongs to a data flow.

[0107] It should be noted that the first node is a first terminal device or a first network device that sends a data packet to the network device and is directly connected to the network device through a corresponding communication line.

[0108] Please refer to Figure 1, the data links provided by network device 1, network device 3, network device 4 and network device 5 are used to transmit data packet packet-n sent by terminal device 1 to terminal device 2. If the network device executing step 61 is network device 1 directly connected to terminal device 1 through a communication line, terminal device 1 is generally referred to as the previous hop of network device 1, and terminal device 1 is the first terminal device relative to network device 1; if the network device executing step 61 is not a network device directly connected to terminal device 1 through a communication line, for example, the network device executing step 61 is network device 4, network device 3 directly connected to network device 4 through a communication line is generally referred to as the previous hop of network device 4, and network device 3 is the first network device relative to network device 4.

[0109] It can be understood that the network device usually adopts the same or similar method as the terminal device to determine the data flow to which the data packet packet-n received from the first node belongs.

[0110] Next, at step 62, a first statistical number of data packets belonging to the data flow that have been received by the network device is determined.

[0111] It is understandable that the network device can use the same or similar method as the terminal device to record the current statistical number of data packets it has received and belong to each data stream. Accordingly, after determining the data stream to which the received data packet packet-n belongs, the network device can query the current statistical number of data packets it has received and belong to the data stream, and then add 1 to the queried current statistical number to obtain the first statistical number of data packets actually received by the network device and belonging to the data stream.

[0112] Taking the example that each data packet belonging to the same data stream has the same five-tuple, for any network device in the IP network, a traffic statistics table that is the same or similar to the following Table 3 can be maintained. By maintaining a number of statistical information in the traffic statistics table, the current statistical number of data packets that have been received by the network device and belong to each data stream is recorded.

[0113] Table 3

[0114]

[0115] As shown in Table 3 above, each row except the row where the field name is located records a piece of statistical information.

[0116] Exemplarily, IP_1 is the IP address of terminal device 1, IP_2 is the IP address of terminal device 2, IP_3 is the IP address of terminal device 3, and network device 4 can receive data packet packet-n from network device 1, network device 2, network device 3, network device 5 or network device 6. After network device 4 receives data packet packet-n, network device 4 can further determine the quintuple of packet-n; then, network device 4 can query the above table 3 maintained by network device 4 according to the quintuple to determine the current statistical number of data packets received by network device 4 and belonging to the data flow identified by the quintuple. If, in the five-tuple of packet-n, the source IP address is IP_1, the destination IP address is IP_2, the transport layer protocol type is TCP, the source port number is C11, and the destination port number is C21, the network device 4 can query the above Table 3 to determine that the current statistical number of data packets of the data flow identified by the five-tuple of packet-n that the network device 4 has received before receiving packet-n is Y1, and then add 1 to the current statistical number Y1, and obtain the first statistical number of data packets of the data flow identified by the five-tuple of packet-n that the network device 4 has received, which is (Y1+1 ); if in the quintuple of packet-n, the source IP address is IP_1, the destination IP address is IP_3, the transport layer protocol type is TCP, the source port number is C13, and the destination port number is C31, the network device 4 can query the above Table 3 to determine that the current statistical number of data packets that the network device 4 has received and belongs to the data flow identified by the quintuple of packet-n before receiving packet-n is Y3, and then add 1 to the current statistical number Y3, and obtain the first statistical number of data packets that the network device 4 has received and belongs to the data flow identified by the quintuple of packet-n is (Y3+1).

[0117] As mentioned above, the data packet packet-n received by the network device from the first node may also include a flow identifier, which is used to uniquely identify the data flow identified by the quintuple of the data packet; accordingly, the network device may also add a flow identifier field based on the above Table 3.

[0118] Accordingly, the network device can determine the flow identifier included in the received data packet packet-n, and query the traffic statistics table maintained by it according to the flow identifier to determine the current statistical number of data packets that the network device has received before receiving packet-n and that belong to the data flow identified by the flow identifier, and add 1 to the current statistical number to obtain the first statistical number. In this way, the network device does not need to spend too much time and resources to fully parse the received data packet packet-n to obtain the five-tuple of packet-n.

[0119] Next, in step 63, it is determined whether the data packet includes a first header, wherein the first header includes a device identifier of the first node and a second statistical number of data packets belonging to the data flow that have been sent by the first node.

[0120] It can be understood that when the first node is a first terminal device, the first header may include Header-0 inserted into the data packet packet-n received by the terminal device from the network device; when the first node is a first network device, the first header may include the header inserted into packet-n by the first network device.

[0121] It can be understood that the second statistical number of data packets that have been sent by the first node and belong to the data flow is equal to the first statistical number of data packets that have been received by the first node and belong to the data flow.

[0122] In a possible implementation, the network device may obtain indication information from the optional items included in the transport layer protocol header of the received data packet packet-n, and determine whether packet-n includes the first header according to the value of the indication information. For example, if the value of the indication information is 1, it is determined that packet-n includes the first header, and if the value of the indication information is 0, it is determined that packet-n does not include the first header.

[0123] In a possible implementation, the network device may determine whether the data packet includes the first header according to a preset identifier. For example, the terminal device may parse the received packet-n to determine whether there are several headers including the preset identifier between the transport layer protocol header and the payload of packet-n; if so, it is determined that the first header is included in packet-n.

[0124] In which, when the data packet received by the network device includes the first header, the network device may execute the following 64.

[0125] In step 64, it is determined whether the difference between the second statistical quantity and the first statistical quantity is greater than a set value.

[0126] Here, the set value may be an empirical value, and may generally be 0 or a natural number greater than 0.

[0127] In which, when the difference is greater than the set value, the network device can execute the following step 65.

[0128] In step 65, the data packet including the second header is sent to the collector, wherein the second header includes the first statistical quantity and the device identification of the network device.

[0129] It can be understood that when the network device sends a data packet packet-n including a second header to a collector, the network device can further encapsulate the data packet packet-n including the second header to form a first data packet P1 that can be transmitted to the collector, and the packet-n including the second header is encapsulated as the effective load of P1.

[0130] It can be understood that, for a data packet packet-n belonging to a data flow received by a network device, if the statistical number of data packets belonging to the data flow sent by the first node to the network device is different from the statistical number of data packets belonging to the data flow received by the network device from the first node, it means that the first node has lost the data packet belonging to the data flow.

[0131] That is to say, here, when the network device finds that the first node has lost the data packet belonging to the corresponding data stream, the network device sends packet-n including the second header to the collector to notify the collector that the first node has lost the data packet.

[0132] In a more specific example, the second header is located between the first header and the payload inserted into packet-n by the first node. For example, please refer to Figure 7 After network device 1 receives packet-n including the first header Header-0 from the first node (terminal device 1) as its previous hop, network device 1 can insert a second header Header-1 into the received packet-n, and Header-1 is located between Header-0 and the payload Payload included in packet-n; for packet-n received by network device 3 from the first node (network device 1) as its previous hop, the first header included in packet-n refers to the second header Header-1 inserted into the packet by network device 1, and network device 3 can insert the second header Header-2 between Header-1 and the payload included in packet-n.

[0133] It can be understood that the second header inserted by the network device into the data packet received by it and the first header Header-0 inserted by the terminal device into the data packet obtained by it can have the same data structure.

[0134] For example, please refer to Figure 7 , Figure 8, for a data packet packet-n belonging to a data stream L sent by network device 3 to network device 4, it may include Header-0 inserted by terminal device 1 into packet-n, Header1 inserted by network device 1 into packet-n, and Header2 inserted by network device 3 into packet-n. Among them, Header-0, Header1 and Header2 all include preset identifiers, Header-0 also includes the device identification A of terminal device 1 and the statistical number x of data packets belonging to a data stream sent by terminal device 1, Header-1 also includes the device identification B of network device 1 and the statistical number y of data packets belonging to the data stream sent by network device 1, and Header2 also includes the device identification C of network device 3 and the statistical number z of data packets belonging to the data stream sent by network device 3.

[0135] Accordingly, in order to ensure that the data packets received by the network device can be transmitted to the corresponding terminal device, and the next hop of the network device can know the statistical number of data packets sent by the network device and belonging to the corresponding data flow, in the following example: Figure 6 Based on the embodiment shown, in a possible implementation manner, as Fig. 9 As shown, regardless of whether the difference between the second statistical quantity and the first statistical quantity is greater than 0, the network device can further execute step 91 to send the data packet including the second header to a second node, where the second node is the next hop of the network device.

[0136] It should be noted that the second node is a second terminal device or a second network device directly connected to the network device via a communication line. Figure 1 , the data links provided by network device 1, network device 3, network device 4 and network device 6 are used to transmit data packet packet-n sent by terminal device 1 to terminal device 2. Then, if the network device executing step 91 is network device 6 directly connected to terminal device 2 through a communication line, terminal device 2 is usually referred to as the next hop of network device 6, and terminal device 2 is the second terminal device relative to network device 6. If the network device executing step 91 is not network device 6 directly connected to terminal device 2 through a communication line, such as network device 4, network device 6 directly connected to network device 4 through a communication line is usually referred to as the next hop of network device 4, and network device 6 is the second network device relative to network device 4.

[0137] In order to avoid the situation where, after the network device loses a data packet belonging to a data stream, the second node as the next hop of the network device sends a data packet including the second header to the collector when receiving each data packet belonging to the data stream, thereby increasing the load of the second node, in a possible implementation, after the network device completes step 64, the network device may further execute step 92 to set the first statistical quantity to an initial value. Specifically, the network device may reset the current statistical quantity of the data packets that it has received and that belong to the data stream to 0.

[0138] In order to discover the network device that loses the first data packet belonging to a data stream in the IP network, in a possible implementation manner, the network device may further execute the following step 93 and other service processing flows related to step 93 before executing step 62.

[0139] Specifically, in step 93, it is determined whether the data packet includes another header, wherein the another header is used to indicate that the data packet including the another header is the first data packet belonging to the data flow sent by the first terminal device.

[0140] As mentioned above, another header refers to the header inserted into the data packet packet-n obtained by the terminal device. In the case that the data packet received by the network device includes the header, the network device can execute step 62; conversely, in the case that the data packet received by the network device does not include the header, the network device can further execute the following step 94.

[0141] In step 94, the data packet is sent to the collector and the second node respectively, and the current statistical number of data packets belonging to the data flow received by the network device is recorded as 1, and the second node is the next hop of the network device.

[0142] It should be noted that when the network device sends a data packet packet-n including another header Header to the collector, the network device can further encapsulate the packet-n including the Header to form a second data packet P2 that can be transmitted to the collector, and the payload of the second data packet P2 is the packet-n including the Header.

[0143] Furthermore, in order to ensure that the data packets received by the network device from the first node can be transmitted to the corresponding terminal device, and to accurately count the current statistical number of data packets belonging to a data flow actually received / sent by the network device, in a possible implementation manner, Fig. 9As shown, in the case where the data packet received by the network device from the first node does not include the first header Header-0 inserted into the data packet by the first node, the network device may further execute step 95, send the data packet to the second node, and update the current statistical number of data packets belonging to the data flow received by the network device to the first statistical number.

[0144] In other words, when a data packet belonging to a data flow received by a network device from a first node does not include a first header inserted into the data packet by the first node, the network device can directly forward the data packet to a second node as its next hop and increase the current statistical number of data packets recorded in the network device that have been received and belong to the data flow by 1.

[0145] Corresponding to the communication method performed by the network device, the present application embodiment also provides a communication method applied to the collector. Fig.10 As shown, the method may include the following steps 101 to 102.

[0146] In step 101, a first data packet is received from a network device.

[0147] As mentioned above, the effective load of the first data packet P1 is packet-n including the second header formed after the network device inserts the second header into packet-n, which is received from the first node as its previous hop and belongs to a data flow.

[0148] Next, in step 102, a first header is determined from the first data packet, wherein the first header includes a device identifier of a first node, and the first node is a previous hop of the network device.

[0149] It can be understood that the collector needs to parse the first data packet it receives to obtain the effective load included in the first data packet, and then determine the first header from the effective load.

[0150] In a possible implementation, the collector may determine at least two headers from the payload included in the first data packet according to a preset identifier, and determine the first header from the at least two headers according to respective positions of the at least two headers in the first data packet.

[0151] For example, please refer to Figure 7For the first data packet P1 received by the collector from the network device 6, the collector can parse P1 to obtain the packet-n sent by the network device 6 to the terminal device, that is, the packet-n obtained after the network device 6 inserts the second header Header-4 into the packet-n from the network device 5. Then, the collector can identify multiple headers including the preset identifier Header-0, Header-1, Header-2, Header-3 and Header-4 from the obtained packet-n, and determine the distances between the positions of Header-0, Header-1, Header-2, Header-3 and Header-4 in packet-n and the position of the payload in packet-n, and sort the headers corresponding to the respective distances in order from small to large to form a sequence [Header-4, Header-3, Header-2, Header-1, Header-0], and select the second header Header3 in the sequence as the first header.

[0152] As mentioned above, the headers inserted by the terminal device and the network device into the data packets they obtain / receive respectively have a certain data structure. The collector only needs to further parse the determined first header based on the pre-known data structure of the header to obtain the device identification of the first node.

[0153] Thereafter, in step 103, it is determined that the first node loses a data packet according to the device identifier of the first node.

[0154] Furthermore, in order to discover a device that has lost the first data packet belonging to a data stream in an IP network, in a possible implementation, the network device may also perform: receiving second data packets from multiple network devices respectively, and recording the receiving times corresponding to when each of the second data packets is received; in the absence of an instruction from the second terminal device, determining a target network device from each of the network devices, the receiving time corresponding to when the collector receives the second data packet from the target network device being the maximum value of each of the receiving times; and determining that the target network device has lost a data packet.

[0155] As mentioned above, the payload of the second data packet P2 is the data packet packet-n sent by the first terminal device, and packet-n includes another header Header inserted into packet-n by the first terminal device, and the Header is used to indicate that packet-n including the Header is the first data packet belonging to a data stream sent by the first terminal device.

[0156] Among them, the indication information can be sent by the second terminal device to the collector after receiving the effective load sent by the first terminal device to the second terminal device, that is, the indication information is used to indicate that the second terminal device has received packet-n including another header Header sent by the first terminal device to the second terminal device.

[0157] In combination with the above-mentioned embodiments, the specific process of measuring packet loss for a device in an IP network is described below by way of example.

[0158] like Figure 1 As shown, a TCP connection can be established between any terminal device 1 and terminal device 2 in the IP network, and terminal device 1 can send multiple data packets to terminal device 2 based on the TCP connection. It can be understood that multiple packets with exactly the same five-tuple sent by terminal device 1 to terminal device 2 based on the TCP connection, and multiple packets will be transmitted to terminal device 2 by the same data link; therefore, multiple packets will be divided into the same data stream, and the data stream is identified by the stream identifier assigned to the data stream (for example, the stream identifier is L). Here, it is specifically taken that multiple packets belonging to data stream L sent by terminal device 1 to terminal device 2 based on the TCP connection are transmitted through the data link provided by network device 1, network device 3, network device 4, and network device 6, and it is taken as an example that when the number of data packets belonging to data stream L sent by terminal device 1 increases by a set number n, the network device is triggered to detect whether the device as its previous hop has lost data packets.

[0159] First, if Fig.11 As shown, for the first data packet packet-1 generated in the terminal device 1 and needs to be sent to the terminal device 2 based on the TCP connection, the terminal device 1 can insert another header Header between the TCP header and Payload included in packet-1, send packet-1 including the Header to the network device 1 as its next hop, and record in the terminal device 1 that the current statistical number of data packets belonging to the data flow L that it has sent is 1.

[0160] Correspondingly, for any network device that receives packet-1, it can be informed by the indication of the Header included in packet-1 that packet-1 is the first data packet belonging to data stream L sent by terminal device 1, and then directly forward the received packet-1 to other network devices or terminal device 2 as its next hop; at the same time, the network device can also further encapsulate packet-1 including the Header to form a second data packet P2 whose payload is packet-1 including the Header, and then send it to the collector, recording that the current statistical number of data packets it has received and belonging to data stream L is 1.

[0161] It can be understood that if network device 1, network device 3, network device 4, and network device 6 do not lose the received packet-1 including the Header, then the packet-1 including the Header will eventually be transmitted to terminal device 2, and terminal device 2 can send an indication message to the collector to inform the collector that "terminal device 2 has received packet-1 included in P2."

[0162] On the contrary, if one of the target network devices among network device 1, network device 3, network device 4, and network device 6 loses the packet-1 it receives, packet-1 cannot be transmitted to terminal device 2, and the collector cannot receive the indication information from terminal device 2. The collector can determine the last network device that sends P2 to it as the network device that loses packet-1 according to the corresponding receiving time when it receives each P2.

[0163] Next, for each data packet packet-m from the 2nd to the n-1th data packets generated in the terminal device 1 and need to be sent to the terminal device 2 based on the TCP connection, the terminal device 1 can directly forward the obtained packet-m to the network device 1 which is its next hop, and add 1 to the current statistical number of data packets that have been sent and belong to the data flow L.

[0164] Correspondingly, any network device that receives packet-m can directly forward packet-m to other network devices or terminal device 2 as its next hop; and increase the current statistical number of data packets that it has received and belongs to data stream L by 1.

[0165] For further information, please refer again Figure 7For the nth data packet packet-n generated in the terminal device 1 and needs to be sent to the terminal device 2 based on the TCP connection, the terminal device 1 can determine that the current statistical number (n-1) of data packets that have been sent and belong to the data stream L meets the preset conditions, and then insert the first header Header-0 between the TCP header and Payload of packet-n, send packet-n including Header-0 to the network device 1, and reset the current statistical number of data packets that have been sent and belong to the data stream L recorded by it to 0.

[0166] Accordingly, any network device that receives packet-n can learn the first header inserted into packet-n by the first node as its previous hop, insert the second header after the first header, and reset the current statistical number of received data packets belonging to data stream L recorded by it to 0. Figure 7 As shown, network device 1, network device 3, network device 4 and network device 6 can insert Header-1, Header-2, Header-3 and Header-4 into the packet-n they receive in turn. If network device 1, network device 3, network device 4 and network device 6 do not lose the packet-n they receive respectively, packet-n will eventually be transmitted to terminal device 2.

[0167] It can be understood that for any network device that receives packet-m, if the second statistical number of data packets belonging to data stream L sent by the first node as the previous hop of the network device is greater than the first statistical number of data packets belonging to data stream L received by the network device, it means that the first node has lost one or more data packets belonging to data stream L. The network device can further encapsulate packet-n after the second header inserted by itself to form a data packet P1 that can be transmitted to the collector, and the effective load included in P1 is packet-n after the second header is inserted.

[0168] Exemplarily, for packet-n sent by terminal device 1, the second statistical number in Header-0 included in packet-n should be n. If the current statistical number of received data packets belonging to data stream L recorded in network device 1 is S1 which is less than (n-1), it means that terminal device 1 has lost (n-1-S1) data packets belonging to data stream L. Network device 1 can encapsulate packet-n sent to network device 2 as P1 and send it to the collector. If the second statistical number of data packets sent by network device 4 and belonging to data stream L included in Header-3 is S2, and the current statistical number of received data packets belonging to data stream L recorded in network device 6 is S3 which is less than (S2-1), it means that network device 4 has lost (S2-1-S1) data packets belonging to data stream L. Network device 6 can encapsulate packet-n sent to terminal device 2 as P1 and send it to the collector.

[0169] In this way, when the collector receives P1 from a network device (for example, network device 1 or network device 4), it can obtain the header inserted into packet-n by the first node which is the previous hop of the network device from the payload packet-n included in P1 from the network device, and then obtain the device identifier of the first node which lost the data packet from the header, and locate the first node which lost the data packet belonging to the data stream L according to the device identifier.

[0170] Corresponding to the above-mentioned various method embodiments, the present application embodiment also provides a communication device applied to a terminal device, such as Fig.12 As shown, the communication device includes:

[0171] An acquisition unit 121, configured to acquire a data packet to be sent;

[0172] A determination unit 122, configured to determine a data stream to which the data packet belongs;

[0173] The sending unit 123 is used to send the data packet including the first header to the network device when the current statistical quantity meets the preset conditions. The first header includes the device identification of the terminal device and the first statistical quantity of data packets belonging to the data flow sent by the terminal device, and the difference between the first statistical quantity and the current statistical quantity is 1.

[0174] In a possible implementation, the first header is located between a transport layer protocol header and a payload included in the data packet.

[0175] In a possible implementation, the communication device further includes a processing unit, configured to send the data packet to the network device and increase the current statistical number by 1 if the current statistical number does not meet a preset condition.

[0176] In a possible implementation manner, the communication device further includes a processing unit configured to set the current statistical quantity as an initial value.

[0177] In a possible implementation manner, the first header further includes a preset identifier, and the preset identifier is used to indicate that the data packet includes the first header.

[0178] In a possible implementation, the data packet further includes indication information, where the indication information is located in an optional item included in a transport layer protocol header of the data packet, and the indication information is used to indicate whether the data packet includes the first header.

[0179] In a possible implementation, the determining unit 122 is further configured to determine whether the data packet is the first data packet belonging to the data flow sent by the terminal device;

[0180] The sending unit 123 is also used to send the data packet including another header to the network device when the data packet is the first data packet belonging to the data stream sent by the terminal device, and record the current statistical number of data packets belonging to the data stream sent by the network device as 1, and the other header is used to indicate that the data packet is the first data packet belonging to the data stream sent by the terminal device.

[0181] The present application also provides a communication device applied to a network device, such as Fig.13 As shown, the communication device includes:

[0182] A receiving unit 131, configured to receive a data packet from a first node, where the first node is a previous hop of the network device, and the first node includes a first terminal device or a first network device;

[0183] A first determining unit 132, configured to determine a data stream to which the data packet belongs;

[0184] A second determining unit 133, configured to determine a first statistical number of data packets belonging to the data flow that have been received by the network device;

[0185] A third determining unit 134 is configured to determine whether the data packet includes a first header, wherein the first header includes a device identifier of the first node and a second statistical number of data packets belonging to the data flow that have been sent by the first node;

[0186] A fourth determining unit 135, configured to determine whether a difference between the second statistical quantity and the first statistical quantity is greater than a set value when the first header is included in the data packet;

[0187] The sending unit 136 is used to send the data packet including the second header to the collector when the difference is greater than a set value, wherein the second header includes the first statistical quantity and the device identification of the network device.

[0188] In a possible implementation, the sending unit 136 is also used to send the data packet including the second header to a second node when the data packet includes the first header, the second node being the next hop of the network device, and the second node including a second terminal device or a second network device.

[0189] In a possible implementation manner, the second header is located between the first header and the payload in the data packet.

[0190] In a possible implementation manner, the third determination unit 134 is specifically configured to determine whether the data packet includes a first header according to a preset identifier, and the first header includes the preset identifier.

[0191] In a possible implementation, the third determination unit 134 is specifically configured to determine whether the data packet includes the first header according to indication information, where the indication information is located in an optional item included in the transport layer protocol header of the data packet.

[0192] In a possible implementation manner, the communication device further includes a record processing unit, configured to set the first statistical quantity as an initial value.

[0193] In a possible implementation manner, the communication device further includes a fifth determination unit and a record processing unit; wherein,

[0194] The fifth determining unit is used to determine whether the data packet includes another header, wherein the other header indicates that the data packet is the first data packet belonging to the data flow sent by the first terminal device;

[0195] The sending processing unit is further used to send the data packet to the collector and the second node respectively when the data packet includes the other header, the second node is the next hop of the network device, and the second node includes a second terminal device or a second network device;

[0196] The record processing unit is used to record that the current statistical number of data packets belonging to the data flow received by the network device is 1.

[0197] The present application also provides a communication device for use in a collector, such as Fig.14 As shown, the communication device includes:

[0198] The receiving unit 141 is configured to receive a first data packet from a network device;

[0199] A first determining unit 142 is configured to determine a first header from the first data packet, wherein the first header includes a device identifier of a first node, the first node is a previous hop of the network device, and the first node includes a first terminal device or a first network device;

[0200] The second determining unit 143 is configured to determine, according to the device identifier of the first node, whether the first node has lost a data packet.

[0201] In a possible implementation, the first determination unit 142 is specifically used to determine at least two headers from the payload included in the first data packet according to a preset identifier, each of the headers including the preset identifier; and determine the first header from the at least two headers according to positions of the at least two headers in the payload, respectively.

[0202] In a possible implementation manner, the communication device further includes a record processing unit

[0203] The receiving unit 141 is further configured to receive second data packets from a plurality of network devices respectively, wherein the payload of the second data packet includes another header, and the other header is configured to indicate that the payload is the first data packet belonging to a data stream sent by the first terminal device;

[0204] The recording processing unit is used to record the receiving time corresponding to each of the data packets;

[0205] A third determining unit is used to determine a target network device from each of the network devices when no indication is received from the second terminal device, and the corresponding receiving time when the collector receives the second data packet from the target network device is the maximum value of each of the receiving times; wherein the indication information is sent to the collector by the second terminal device after receiving the effective load sent by the first terminal device to the second terminal device, and the indication information is used to indicate that the second terminal device has received the effective load sent by the first terminal device to the second terminal device;

[0206] The fourth post-determination unit is used to determine whether the target network device loses a data packet.

[0207] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0208] It should be understood that in various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0209] It can be understood that the device embodiments described above are schematic. For example, the division of the modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0210] A computer-readable storage medium is also provided in an embodiment of the present application for storing instructions. When the instructions are executed by a processor of a computing device, the computing device implements the communication method provided in any one of the embodiments of the present application.

[0211] A computer program product is also provided in an embodiment of the present application. The computer program product includes a computer program code. When the computer program code is executed on a computing device, the computing device implements the communication method provided in any embodiment of the present application.

[0212] A network device is also provided in an embodiment of the present application, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, a communication method applied to a network device provided in any embodiment of the present application is implemented.

[0213] A terminal device is also provided in an embodiment of the present application, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, a communication method applied to the terminal device provided in any embodiment of the present application is implemented.

[0214] An embodiment of the present application further provides a collector, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the communication method applied to the collector provided in any embodiment of the present application is implemented.

[0215] A communication device is also provided in an embodiment of the present application, and the communication device has the functions of the network device / terminal device / collector provided in any embodiment of the present application.

[0216] A communication device is also provided in an embodiment of the present application, and the communication device may be the network device / terminal device / collector described in any embodiment of the present application, or a chip set in the network device / terminal device / collector. The communication device includes a memory, a communication interface, and a processor, wherein the memory is used to store computer programs or instructions, and the processor is coupled to the memory and the communication interface. When the processor executes the computer program or instruction, the communication device executes the communication method applied to the network device / terminal device / collector provided in any embodiment of the present application.

[0217] A chip system is provided in an embodiment of the present application, and the chip system includes a processor for implementing the functions of the network device / terminal device / processor described in any embodiment of the present application, for example, receiving or processing the data and / or information involved in the communication method applied to the network device / terminal device / collector. In one possible design, the chip system also includes a memory, and the memory is used to store program instructions and / or data. The chip system can be composed of chips, and can also include chips and other discrete devices.

[0218] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiment of the present application, which should be covered within the protection scope of the embodiment of the present application.

[0219] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions provided in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents, and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions provided in the various embodiments of the present application.

Claims

1. A communication method, applied to a network device, characterized in that: The method comprises: receiving a data packet from a first node, and determining a data stream to which the data packet belongs, wherein the first node is a previous hop of the network device, and the first node includes a first terminal device or a first network device; determining a first statistical number of data packets belonging to the data flow that have been received by the network device; Determining whether the data packet includes a first header, the first header including a device identifier of the first node and a second statistical number of data packets belonging to the data flow that have been sent by the first node; When the data packet includes the first header, determine whether the difference between the second statistical quantity and the first statistical quantity is greater than a set value; when the difference is greater than the set value, send the data packet including the second header to the collector, wherein the second header includes the first statistical quantity and the device identification of the network device.

2. The method according to claim 1, characterized in that Also includes: In the case where the data packet includes the first header, the data packet including the second header is sent to a second node, the second node is a next hop of the network device, and the second node includes a second terminal device or a second network device.

3. The method according to claim 1, characterized in that The second header is located between the first header and the payload in the data packet.

4. The method according to claim 1, characterized in that: The determining whether the data packet includes the first header includes: determining whether the data packet includes the first header according to a preset identifier, wherein the first header includes the preset identifier.

5. The method according to claim 1, characterized in that The determining whether the data packet includes the first header comprises: determining whether the data packet includes the first header according to indication information, wherein the indication information is located in an optional item included in a transport layer protocol header of the data packet.

6. The method according to claim 1, characterized in that After determining whether the difference between the second statistical quantity and the first statistical quantity is greater than a set value, the method further includes: setting the first statistical quantity to an initial value.

7. The method according to any one of claims 1 to 6, characterized in that: Prior to determining a first statistical number of data packets belonging to the data flow that have been received by the network device, the method further includes: Determining whether the data packet includes another header, the other header indicating that the data packet is the first data packet belonging to the data stream sent by the first terminal device; In the case where the other header is included in the data packet, the data packet is sent to the collector and the second node respectively, and the current statistical number of data packets belonging to the data flow received by the network device is recorded as 1, the second node is the next hop of the network device, and the second node includes a second terminal device or a second network device.

8. A communication method, characterized in that: Applied to a terminal device, the method comprises: Obtaining a data packet to be sent, and determining the data stream to which the data packet belongs; Determining a current statistical number of data packets belonging to the data flow that have been sent by the terminal device; When the current statistical quantity meets the preset conditions, the data packet including the first header is sent to the network device, the first header including the device identification of the terminal device and the first statistical number of data packets belonging to the data flow sent by the terminal device, and the difference between the first statistical number and the current statistical number is 1, so that after the network device receives the data packet, it can judge that the first header also adds the device identification of the first node and the second statistical number of data packets belonging to the data flow sent by the first node, and when the difference between the second statistical number and the statistical number of the data packet by the network device is greater than the set value, it is determined to send the data packet including the second header to the collector, wherein the second header includes the statistical number of the data packet by the network device and the device identification of the network device, and the first node is the previous hop of the network device.

9. The method according to claim 8, characterized in that The first header is located between a transport layer protocol header and a payload included in the data packet.

10. The method according to claim 8, characterized in that The method further includes: when the current statistical quantity does not meet a preset condition, sending the data packet to the network device and adding 1 to the current statistical quantity.

11. The method according to claim 8, characterized in that After sending the data packet including the first header to the network device, the method further includes: setting the current statistical quantity to an initial value.

12. The method according to claim 8, characterized in that The first header also includes a preset identifier, and the preset identifier is used to indicate that the data packet includes the first header.

13. The method according to claim 8, characterized in that The data packet also includes indication information, which is located in an optional item included in the transport layer protocol header of the data packet, and the indication information is used to indicate whether the data packet includes the first header.

14. The method according to any one of claims 8 to 13, characterized in that The method further comprises: Before determining the current statistical number of data packets belonging to the data flow that have been sent by the terminal device, the method further includes: Determining whether the data packet is the first data packet belonging to the data flow sent by the terminal device; In the case where the data packet is the first data packet belonging to the data stream sent by the terminal device, the data packet including another header is sent to the network device, and the current statistical number of data packets belonging to the data stream sent by the network device is recorded as 1, and the other header is used to indicate that the data packet is the first data packet belonging to the data stream sent by the terminal device.

15. A communication method, characterized in that: Applied to a collector, the method comprises: receiving a first data packet from a network device; Determine a first header from the first data packet, wherein the first header includes a device identifier of a first node, the first node is a node in the previous hop of the network device where the data packet is lost, and the first node includes a first terminal device or a first network device; Determining, according to the device identifier of the first node, that the first node loses a data packet; Among them, the first data packet also includes a second header, the second header includes a first statistical number of data packets in the data stream to which the first data packet has been received by the network device, the first header also includes a second statistical number of data packets in the data stream to which the first data packet has been sent by the first node, and the first node is determined based on the difference between the first statistical number and the second statistical number being greater than a set value.

16. The method according to claim 15, characterized in that The step of determining a first header from the first data packet includes: Determine at least two headers from the payload included in the first data packet according to the preset identifier, each of the headers including the preset identifier; A first header is determined from the at least two headers according to respective positions of the at least two headers in the payload.

17. The method according to claim 15 or 16, characterized in that Also includes: receiving second data packets from a plurality of network devices respectively, and recording the receiving times corresponding to the receiving of each of the data packets, wherein the payload of the second data packet includes another header, and the other header is used to indicate that the payload is the first data packet belonging to a data stream sent by the first terminal device; In the case where the indication information from the second terminal device is not received, a target network device is determined from each of the network devices, and the corresponding receiving time when the collector receives the second data packet from the target network device is the maximum value of each of the receiving times; wherein the indication information is sent to the collector by the second terminal device after receiving the effective load sent by the first terminal device to the second terminal device, and the indication information is used to indicate that the second terminal device has received the effective load sent by the first terminal device to the second terminal device; It is determined that the target network device loses data packets.

18. A computer-readable storage medium for storing instructions, which, when executed by a processor of a computing device, causes the computing device to implement the method of any one of claims 1 to 7, claims 8 to 14, or claims 15 to 17.

19. A network device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.

20. A terminal device comprising a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, the method according to any one of claims 8 to 14 is implemented.

21. A collector, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 15 to 17 is implemented.

Citation Information

Cited By

  • Devices, systems, and methods for handling network device counters

    US20240154768A1