Network delay detection method, device and computer-readable storage medium
By extracting and analyzing the packet header information of network data packets, and calculating the transmission time with the server feedback data, the problems of low detection efficiency and poor universality in the prior art are solved, and efficient network delay detection is achieved.
Patent Information
- Application Number
- CN202111165155.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The existing network delay detection methods require the deployment of specific services on the client and server side, resulting in low detection efficiency and poor universality.
By obtaining network data packets sent by the client, extracting packet header information, identifying packet types, analyzing the transmission time, and calculating the transmission time with the server feedback data, network delay detection is realized.
There is no need to modify or deploy third-party servers, which improves the detection efficiency and versatility of network delay detection.
Smart Images

Figure CN115914037B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a network delay detection method, device and computer-readable storage medium. Background Art
[0002] In recent years, with the rapid development of internet technology, more and more network applications have become part of our daily lives. However, due to bandwidth limitations and network coverage, applications still experience certain network delays during operation. Large delays often impact application performance, necessitating network delay testing. Existing network delay testing typically deploys specific transceiver protocols on the application client or specific server ports, testing content communication between the client and server to detect network delays.
[0003] During the research and practice of the existing technology, the inventors of the present invention found that the existing network delay detection methods all require the deployment of specific services on both the client and the server. Once an application is changed, redeployment is required, which greatly reduces the versatility of network delay detection. As a result, the detection efficiency of network delay detection is greatly reduced. Summary of the Invention
[0004] Embodiments of the present invention provide a network delay detection method, device, and computer-readable storage medium, which can improve the detection efficiency of network delay detection.
[0005] A network delay detection method, comprising:
[0006] Get the network data packets sent by the client in the current network;
[0007] Extracting packet header information from the network data, and performing data packet identification processing based on the packet header information to obtain the data packet type of the network data packet;
[0008] Parsing the packet header information according to the packet type to obtain the sending time of the network packet;
[0009] When feedback data returned by the server for the network data packet is received, fusing the reception time of the feedback data with the transmission time to calculate the transmission time of the network data packet;
[0010] The transmission time of the network data packet is detected and processed to obtain the network delay of the current network.
[0011] Accordingly, an embodiment of the present invention provides a network delay detection device, comprising:
[0012] An acquisition unit, used to acquire network data packets sent by clients in the current network;
[0013] an identification unit, configured to extract packet header information of the network data packet and perform data packet identification processing based on the packet header information to obtain a data packet type of the network data packet;
[0014] A parsing unit, configured to parse the packet header information according to the packet type to obtain the sending time of the network packet;
[0015] a calculation unit, configured to, upon receiving feedback data returned by the server for the network data packet, fuse the reception time of the feedback data with the transmission time to calculate the transmission time of the network data packet;
[0016] The detection unit is used to detect and process the transmission time of the network data packet to obtain the network delay of the current network.
[0017] Optionally, in some embodiments, the parsing unit can be specifically used to identify the packet identifier of the network packet in the packet header information when the packet type is a traffic packet; obtain the transmission information of the current network, and filter out the target transmission information corresponding to the packet identifier in the transmission information; and parse and process the target transmission information to determine the sending time of the network packet.
[0018] Optionally, in some embodiments, the parsing unit can be specifically used to identify the number of times the network data packet is sent and the basic sending time of each sending in the target transmission information; determine the sending type of the network data packet based on the number of sending times; and filter out the sending time of the network data packet from the basic sending time based on the sending type.
[0019] Optionally, in some embodiments, the parsing unit can be specifically used to determine that the sending type of the network data packet is normal sending when the number of sending times is once; and to determine that the sending type of the network data packet is the first retransmission when the number of sending times is twice.
[0020] Optionally, in some embodiments, the parsing unit can be specifically used to use the basic sending time as the sending time of the network data packet when the sending type is normal sending; when the sending type is the first retransmission, filter out the basic sending time with the earliest sending time from the basic sending time as the sending time of the network data packet.
[0021] Optionally, in some embodiments, the detection unit can be specifically used to add the transmission time of the network data packet to a preset delay data log to obtain a delay data log; return to execute the step of obtaining the network data packet transmitted in the current network until receiving the disconnection data control packet sent by the client, and obtain the target delay data log within the detection period, and the detection period is the time between starting the network delay detection service and stopping the network delay detection service; perform statistical processing on the transmission time in the target delay data log to obtain the network delay of the current network.
[0022] Optionally, in some embodiments, the detection unit can be specifically used to classify the transmission time in the target delay data log according to the sending type of the network data packet corresponding to the transmission time to obtain normal transmission time and retransmission transmission time; weight the normal transmission time and retransmission transmission time, and merge the weighted normal transmission time and weighted retransmission transmission time to obtain the network delay of the current network.
[0023] Optionally, in some embodiments, the detection unit can be specifically used to count the first number of normal transmission time and the second number of retransmission transmission time in the target delay data log; determine the weighting coefficient of the normal transmission time and the retransmission transmission time based on the first number and the second number; and weight the normal transmission time and the retransmission transmission time based on the weighting coefficient.
[0024] Optionally, in some embodiments, the detection unit can be specifically used to fuse the weighted normal transmission time and the weighted retransmission transmission time to obtain the fused transmission time; based on the first quantity and the second quantity, calculate the time average of the fused transmission time to obtain the network delay of the current network.
[0025] Optionally, in some embodiments, the network delay detection device may further include a control unit, which may be specifically used to extract a control identifier from the packet header information when the data packet type is a data control packet, and determine the control type of the network data packet based on the control identifier; when the control type is to establish a connection, start a network delay detection service for the current network, and detect the network delay of the current network based on the network delay detection service; when the control type is to disconnect, stop the network delay detection service, and detect the network delay of the current network based on the current delay data log within the detection period.
[0026] Optionally, in some embodiments, the control unit can be specifically used to return to execute the step of obtaining the network data packet sent by the client in the current network until the data packet type of the network data packet is a traffic data packet, and the target network data packet is obtained; when the target network data packet is a data packet in the network connection corresponding to the network delay detection service, the packet header information of the target network data packet is parsed and processed to obtain the sending time of the target network data packet to detect the network delay of the current network.
[0027] Optionally, in some embodiments, the identification unit can be specifically used to identify the communication protocol corresponding to the network data packet in the packet header information to determine the packet format of the network data packet; when the packet format is the target packet format, extract the identification information of the network data packet from the packet header information; and determine the packet type of the network data packet based on the identification information.
[0028] In addition, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is configured to run the application program in the memory to implement the network delay detection method provided by an embodiment of the present invention.
[0029] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps in any one of the network delay detection methods provided in the embodiments of the present invention.
[0030] In an embodiment of the present invention, after obtaining a network data packet sent by a client in the current network, header information of the network data packet is extracted, and data packet identification processing is performed based on the header information to obtain the data packet type of the network data packet. Based on the data packet type, the header information is parsed to obtain the sending time of the network data packet. When feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are integrated to calculate the transmission time of the network data packet. Then, the transmission time of the network data packet is detected to obtain the network delay of the current network. Since the solution obtains the network data packet sent by the client and determines the sending time and receiving time of the network data based on the header information and feedback data, thereby obtaining the transmission time of the network data packet and calculating the network delay of the current network based on the transmission time, no modification or deployment of a third-party server is required. Therefore, it can be widely applied to various networked smart devices, thereby greatly increasing the versatility of detecting network delays and thus improving the detection efficiency of network delay detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0032] Figure 1 Schematic diagram of a scenario of a network delay detection method provided by an embodiment of the present invention;
[0033] Figure 2 1 is a flow chart of a network delay detection method provided by an embodiment of the present invention;
[0034] Figure 3 is a schematic diagram of packet header information of a network data packet provided by an embodiment of the present invention;
[0035] Figure 4 This is a schematic diagram of the normal transmission process of a network data packet provided by an embodiment of the present invention;
[0036] Figure 5 is a schematic diagram of packet loss during network data packet transmission provided by an embodiment of the present invention;
[0037] Figure 6 is a schematic diagram of establishing a connection in a current network provided by an embodiment of the present invention;
[0038] Figure 7 This is a schematic diagram of disconnection in the current network provided by an embodiment of the present invention;
[0039] Figure 8 is a schematic diagram of processing three types of network data packets provided by an embodiment of the present invention;
[0040] Figure 9 This is a schematic diagram of a flow chart of network delay detection for a current network provided by an embodiment of the present invention;
[0041] Figure 10 1 is a schematic diagram of the architecture of a network delay detection device provided by an embodiment of the present invention;
[0042] Figure 11 is a schematic diagram of the protocol layers of current network transmission provided by an embodiment of the present invention;
[0043] Figure 12 1 is a schematic diagram of network delay evaluation provided by an embodiment of the present invention;
[0044] Figure 13 is another flow chart of the network delay detection method provided by an embodiment of the present invention;
[0045] Figure 141 is a schematic structural diagram of a network delay detection device provided by an embodiment of the present invention;
[0046] Figure 15 is another structural diagram of the network delay detection device provided by an embodiment of the present invention;
[0047] Figure 16 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] Embodiments of the present invention provide a network delay detection method, device, and computer-readable storage medium. The network delay detection device can be integrated into an electronic device, which can be a server, a terminal, or other device.
[0050] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to these. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0051] For example, see Figure 1 Taking the network delay device integrated into an electronic device as an example, after the electronic device obtains the network data packet sent by the client in the current network, it extracts the header information of the network data packet, and identifies the data packet based on the header information to obtain the data packet type of the network data packet. According to the data packet type, the header information is parsed to obtain the sending time of the network data packet. When the feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are fused to calculate the transmission time of the network data packet. Then, the transmission time of the network data packet is detected to obtain the network delay of the current network, thereby improving the detection efficiency of network delay detection.
[0052] It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0053] This embodiment will be described from the perspective of a network delay detection device. The network delay device can be specifically integrated into an electronic device, which can be a server or a terminal. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), a wearable device, a virtual reality device, or other smart devices that can detect network delays.
[0054] A network delay detection method, comprising:
[0055] Obtain the network data packet sent by the client in the current network, extract the header information of the network data packet, and identify the data packet based on the header information to obtain the data packet type of the network data packet. According to the data packet type, parse the header information to obtain the sending time of the network data packet. When receiving the feedback data returned by the server for the network data packet, fuse the receiving time of the received feedback data and the sending time to calculate the transmission time of the network data packet. Detect the transmission time of the network data packet to obtain the network delay of the current network.
[0056] like Figure 2 As shown, the specific process of the network delay detection method is as follows:
[0057] 101. Get the network data packets sent by the client in the current network.
[0058] There are several ways to obtain network data packets sent by the client in the current network, which can be as follows:
[0059] For example, when there is network traffic in the current network, the network traffic at the IP layer is directly captured through the API interface of the local virtual network card, and the currently transmitted network data packets are extracted from the network traffic, thereby obtaining the network data packets sent by the client in the current network.
[0060] There are many ways to capture network traffic. For example, on the Android platform, you can capture the IP layer traffic of the local device through VPNService, or on the iOS platform, you can capture the IP layer traffic of the local device through VPN Extension, or on Windows and Linux platforms, you can also achieve traffic capture capabilities through network filtering drivers or virtual network cards.
[0061] 102. Extract packet header information from the network data packet, and perform data packet identification processing based on the packet header information to obtain the data packet type of the network data packet.
[0062] The packet header information is used to indicate the packet type of the network packet. The network packet here can be a TCP packet. The packet header information can be as follows: Figure 3 As shown, the packet header information contains multiple flags, such as SYN, ACK, and SEQ. These flags can be used to accurately identify and serve as the time points for connection initiation, analysis, and termination.
[0063] Among them, the data packet type is used to indicate the role of the network data packet in the current network connection, which can include traffic data packets and data control packets. The so-called traffic data packets can be understood as data packets in the data flow sent by the client to the server, and the data control packets can be understood as data packets containing control data sent between the client or the server for establishing or disconnecting the connection.
[0064] There are many ways to extract the header information of network data packets, which can be as follows:
[0065] For example, the packet header information can be directly extracted from the network packet to obtain the packet header information, or the information in the network packet can be classified according to the storage location, and based on the classification result, the information stored in the header of the network packet can be filtered out to obtain the packet header information.
[0066] After extracting the packet header information, the packet can be identified and processed. There are many ways to identify and process the packet, which can be as follows:
[0067] For example, the communication protocol corresponding to the network data packet can be identified in the packet header information to determine the packet format of the network data packet. When the packet format is the target packet format, the identification information of the network data packet is extracted from the packet header information, and the packet type of the network data packet is determined based on the identification information.
[0068] There are various ways to determine the packet format of a network packet. For example, the packet header information can be compared with the packet header information of packets corresponding to each communication protocol to determine the communication protocol corresponding to the obtained network packet. The so-called communication protocol is the protocol followed by the client and server for communication, which generally includes the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). When the communication protocol corresponding to the network packet is TCP, the format of the network packet can be a TCP packet. When the communication protocol corresponding to the network packet is UDP, the format of the network packet can be a UDP packet.
[0069] Among them, the target data packet format can be a TCP data packet. Therefore, when the network data packet is a TCP data packet, the identification information of the network data packet can be extracted from the packet header information. The identification information here can be understood as the identification of one or more flag bits, which can include data identification, control identification and sequence number identification. For example, the data identification can be Data, the control identification can be ACK, FIN or SYN, the sequence number identification can be SEQ, and so on.
[0070] After extracting the identification information, the data packet type of the network data can be determined. There are many ways to determine the data packet type. For example, when the identification information is a data identifier, the data packet type of the network data packet can be determined as a traffic data packet. When the identification information is a control identifier, the data packet type of the network data packet can be determined as a data control packet.
[0071] 103. According to the type of the data packet, the packet header information is parsed and processed to obtain the sending time of the network data packet.
[0072] Among them, the sending time can be the starting time for calculating the network delay of the network data packet, such as the time when the network data packet is sent by the client or server, or the time when the network data packet is captured. For lost network data packets, the sending time can also be the time when the network data packet is sent for the first time.
[0073] There are many ways to parse and process the packet header information, which can be as follows:
[0074] For example, when the data packet type is a traffic data packet, the data packet identifier of the network data packet can be identified in the packet header information, the transmission information of the current network can be obtained, and the target transmission information corresponding to the data packet identifier can be filtered out in the transmission information. The target transmission information is parsed and processed to determine the sending time of the network data packet.
[0075] The data packet identifier may be a sequence number (seq) of the network data packet, which is used to identify the identity or name of the network data packet.
[0076] The transmission information can be understood as the sending information or receiving information corresponding to all network data packets captured in the current network, etc. Screening out the target transmission information corresponding to the data identifier in the transmission information can be understood as obtaining the sending information or receiving information of the network data packet, etc.
[0077] After filtering out the target transmission information, the target transmission information can be parsed and processed to determine the sending time of the network data packet. There are many ways to parse and process. For example, the number of times the network data packet is sent and the basic sending time of each sending can be identified in the target transmission information. According to the number of sending times, the sending type of the network data packet is determined. Based on the sending type, the sending time of the network data packet is filtered out in the basic sending time.
[0078] Among them, based on the number of transmissions, the transmission type of the network data packet can be determined. There are many ways to determine the transmission type. For example, when the number of transmissions is one, the transmission type of the network data packet is determined to be normal transmission. When the number of transmissions is two, the transmission type of the network data packet is determined to be the first repetition. The so-called normal transmission can be understood as the client sending a network data packet to the server, the server receiving the network data normally, and returning feedback data of successful reception to the client, and marking the sequence number of the next network data packet expected to be received, such as Figure 4 When the server fails to receive the network data packet, packet loss occurs, as shown in Figure 5 As shown, at this time, the server cannot return feedback data of successful reception to the client. After the client does not receive feedback data within the preset time, it resends the network data packet. At this time, the sending type of the network data can be retransmission. Retransmission means resending the network data in the case of packet loss. If the server still does not receive the network data packet after resending, it will continue to resend it. Therefore, retransmission can also include first retransmission or non-first retransmission.
[0079] Among them, in the case of packet loss, packet loss will make the calculation of the transmission time (RTT) of the network data packet complicated, such as Figure 5As shown, after the network data packets of sequence 1, 2, 3, and 4 are sent out, the server returns ack=2, which means that 1 has been received, but 2, 3, and 4 have not been received yet. At this time, packet 2 may have been lost, and the server has received packets 3 and 4. However, TCP design requires continuous confirmation of acks, so the client can only transmit through RTO timeout or Fast Retransmit mechanism. Either mechanism will cause the acks of 3 and 4 to be inaccurate. To better measure the RTT of sequence number 2, we also need to consider the retransmission ambiguity, that is, when we retransmit the packet of seq=2 and receive ack=3 (or more than 3), it may be due to the ack from the first packet transmission, or it may be due to the retransmission. This solution considers retransmission as a time-consuming part, so this solution will use the earliest basic sending time as the starting point of the delay, and the time of the last confirmed ack as the end point.
[0080] After determining the sending type of the network data packet, the sending time of the network data packet can be filtered out from the basic sending time. There are many ways to filter out the time. For example, when the sending type is normal sending, the basic sending time is used as the sending time of the network data packet. When the sending type is the first retransmission, the basic sending time with the earliest sending time is filtered out from the basic sending time as the sending time of the network data packet. The so-called basic time can be the time when the network data packet is sent from the client each time. When the network data packet is retransmitted for the first time, the number of basic sending times can be determined to be 2, one is the earliest sending time, and the other is the time of retransmission. Therefore, it is necessary to filter out the earliest sending time, mainly because for the first retransmission of the network data packet, retransmission is also a time-consuming part.
[0081] Optionally, when the data packet type is a data control packet, the control identifier can also be extracted from the packet header information, and based on the control identifier, the control type of the network data packet can be determined. When the control type is to establish a connection, the network delay detection service for the current network is started, and the network delay of the current network is detected based on the network delay detection service. When the control type is to disconnect, the network delay detection service is stopped, and the network delay of the current network is detected based on the target delay data log within the detection period.
[0082] The control flag can be information indicating whether a network connection is established or disconnected. For example, SYN can be information indicating whether a network connection is established, while FIN can be information indicating whether a network connection is disconnected. Therefore, there are multiple ways to determine the control type of a network packet based on the control flag. For example, if the control flag is SYN, the control type of the network packet can be determined to be connection establishment (network connection), while if the control flag is FIN, the control type of the network packet can be determined to be connection disconnection.
[0083] When the control type is to establish a connection, the server and client can establish a connection according to the TCP protocol. The way to establish a connection can be as follows: Figure 6 As shown, after the network connection between the client and the server is established, the network delay detection service for the current network can be started. Then, based on the network delay detection service, the network delay of the current network can be detected. There are many ways to detect. For example, you can return to the step of obtaining the network data packet sent by the client in the current network until the data packet type of the network data packet is a traffic data packet, obtain the target network data packet, and detect the network connection corresponding to the target network data packet. When the target network data packet is a data packet in the network connection corresponding to the network delay detection service, the packet header information of the target network data packet is parsed and processed to obtain the sending time of the target network data packet to detect the network delay of the current network.
[0084] When the control type is disconnect, the network connection between the client and the server can be disconnected. The disconnection method can be as follows: Figure 7 When the network connection between the client and the server is disconnected, the network delay detection service can be stopped, and the network delay of the current network can be detected based on the current delay data log within the detection period. There are many detection methods. For example, the transmission time in the current delay data log can be classified according to the transmission type of the network data packet corresponding to the transmission time to obtain the current normal transmission time and the current retransmission transmission time. The current normal transmission time and the current retransmission transmission time are then merged to obtain the current network delay.
[0085] 104. When feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are merged to calculate the transmission time of the network data packet.
[0086] Among them, the transmission time can be the time it takes for a network data packet to be transmitted in the network connection of the current network. The transmission process can include the client sending the network data packet to the server, and after the server receives the network data packet, it returns feedback data for the network data packet to the client. The so-called feedback data can be data used by the server to notify the client to confirm that the network data packet has been received, for example, it can be an ACK identifier corresponding to the seq of the network data packet.
[0087] The receiving time may be understood as the time of receiving the feedback data returned by the server confirming the receipt of the network data packet. For example, the receiving time may be the time of receiving the feedback data returned by the server carrying the ACK identifier corresponding to the seq of the network data packet.
[0088] In the process of continuous network transmission and reception, the client will send network data packets. At the same time, there is a seq in the header of the network data packet for counting. When the server receives the client's packet, it will generate an ack tag and mark the sequence number of the next network data packet it expects to receive, that is, seq.Client+1. Statistics are taken every time a network data packet is sent and received. In this way, the duration of each network data packet transmission (Round Trip Time, RTT) can be calculated. Specifically, it can be shown as formula (1):
[0089] RTT[Client.seq]=r[Client.seq+1]- s[Client.seq](1)
[0090] RTT is used as the transmission time of the network data packet. Therefore, the reception time and the sending time of the feedback data are integrated to calculate the transmission time of the network data. There are many ways to calculate it, which are as follows:
[0091] For example, when the sending type of a network data packet is normal sending, the time interval between the basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When the sending type of a network data packet is the first retransmission, the time interval between the earliest basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When the sending type of a network data packet is not the first retransmission, there is no need to sample the network data, and therefore, there is no need to calculate the transmission time of the network data packet. Therefore, it can be found that sampling and analyzing network data packets does not mean that all network data packets are sampled, as shown in Table 1.
[0092] Table 1
[0093]
[0094] Among them, the normal sequence packet can be understood as a network data packet with a normal transmission type, the first retransmission packet can be understood as a network data packet with a first retransmission type, and the data packet after the retransmission packet and before the normal sequence packet can be understood as a network data packet that is not the first retransmission. Since the transmission of network data packets in the network connection can be continuous, after the first retransmission data packet is generated, the network data packet will be retransmitted until the network congestion ends. After the network congestion ends, there will be no more retransmissions. At this time, the sending and receiving time of the normal sequence packet is restored to be counted, so as to obtain the transmission time of the network data packet. Therefore, it can be found that in this scheme, network data packets are divided into three categories for processing during the process of sending and receiving network data. These three categories of network data are normal network data packets (no retransmission occurs), network data packets that are retransmitted for the first time, and network data packets that are not retransmitted for the first time. Specifically, they can be as follows Figure 8 As described above, for normal network data packets that have not triggered retransmission, it is necessary to count the RTT of the network data packet. For the network data packet that is retransmitted for the first time, it is necessary to filter out the basic sending time of the earliest sending, so as to estimate the RTT of the network data packet. The network data packets that are not retransmitted for the first time are ignored, that is, no sampling is performed. When it is detected that the data traffic has returned to normal, that is, no retransmission (retransmission) is triggered, the RTT of subsequent normal network data packets continues to be counted.
[0095] 105. Detect and process the transmission time of the network data packet to obtain the network delay of the current network.
[0096] Among them, network latency can be understood as the round-trip time it takes for a data packet in the data traffic to be sent from the user's client to the server and then immediately returned from the server to the client during the operation of the application.
[0097] There are many ways to detect and process the transmission time of network data packets, which can be as follows:
[0098] For example, the transmission time of the network data packet is added to the preset delay data log to obtain the delay data log, and the step of obtaining the network data packet transmitted in the current network is returned to execute until the disconnection data control packet sent by the client is received, and the target delay data log within the detection period is obtained. The transmission time in the target delay data log is statistically processed to obtain the network delay of the current network.
[0099] The detection period may be the time between starting the network delay detection service and stopping the network delay detection service. Therefore, the target delay data log within the detection period includes the transmission time of the network data packets that can be sampled within the entire detection period.
[0100] Among them, there are many ways to perform statistical processing on the transmission time in the target delay data log. For example, according to the sending type of the network data packet corresponding to the transmission time, the transmission time in the target delay data log is classified to obtain the normal transmission time and the retransmission transmission time, the normal transmission time and the retransmission transmission time are weighted, and the weighted normal transmission time and the weighted retransmission transmission time are integrated to obtain the network delay of the current network.
[0101] The normal transmission time may be the transmission time of a normally transmitted network data packet, and the retransmission transmission time may be the transmission time of a first retransmission of the network data packet. There are various ways to weight the normal transmission time and the retransmission transmission time. For example, a first number of normal transmission times and a second number of retransmission transmission times may be counted in the target delay data log. Based on the first number and the second number, weighting coefficients for the normal transmission time and the retransmission transmission time may be determined. The normal transmission time and the retransmission transmission time may be weighted based on the weighting coefficients.
[0102] Among them, there are many ways to determine the weighting coefficient based on the first quantity and the second quantity. For example, the ratio between the first quantity and the total amount of transmission time can be calculated to obtain the first ratio, and the first ratio is used as the weighting coefficient of normal transmission time. The ratio between the second quantity and the total amount of transmission time can be calculated to obtain the second ratio, and the second ratio is used as the weighting coefficient of retransmission time. Alternatively, the quantity ratio between the first quantity and the second quantity can be calculated, and the weighting coefficient corresponding to the quantity ratio can be filtered out from the preset weighting coefficient set to obtain the weighting coefficient of normal transmission time and retransmission transmission time. Alternatively, the first quantity can be used as the weighting coefficient of normal transmission time, and the second quantity can be used as the weighting coefficient of retransmission time.
[0103] After weighting the normal transmission time and the retransmission transmission time based on the weighting coefficient, the weighted normal transmission time and the weighted retransmission transmission time can be fused. There are many ways to fuse them. For example, the weighted normal transmission time and the weighted retransmission time can be fused to obtain the fused transmission time. According to the first quantity and the second quantity, the time mean of the fused transmission time is calculated to obtain the network delay of the current network. Specifically, it can be shown as formula (2):
[0104]
[0105] in, is the network delay of the current network, As the basic sending time, The earliest basic sending time, is the receiving time, is the first number of normal transmission time in the target delay data log, is the second number of retransmission times in the target delay data log, is the weighting coefficient corresponding to the first quantity, is the weighting coefficient of the second quantity.
[0106] The process of detecting the network delay of the current network can be as follows: Figure 9 As shown, the network traffic is captured, and the network data packets sent by the client are extracted from the network traffic; the packet header information of the network data packet is extracted, and the packet header information is identified and processed to obtain the packet format of the network data packet; when the packet format of the network data packet is a TCP data packet, the packet type of the TCP data is determined; when the TCP data packet is a flow data packet, the network connection corresponding to the flow data packet is determined; when the flow data packet is a network connection corresponding to the network delay detection, the sending type of the flow data packet is identified; when the sending type of the flow data packet is normal sending, the first transmission time of the flow data packet is calculated through the sending time and receiving time of the flow data packet; when the sending type of the flow data packet is normal sending, the first transmission time of the flow data packet is calculated through the sending time and receiving time of the flow data packet. When the sending type is the first retransmission, the sending time is filtered out from the basic sending time, and the second transmission time of the traffic data packet is estimated based on the receiving time, and the first transmission time and the second transmission time are added to the preset delay data log to obtain the target delay data log; when the TCP data packet is a data control packet, the control type of the data control packet is determined. When the control type is to establish a connection, the network delay detection service is started, and the network delay of the current network is detected based on the network delay detection service. When the control type is to disconnect, the network delay detection service is stopped, and the first transmission time and the second transmission time in the target delay data log are weightedly calculated to obtain the network delay detection result of the network to be detected. Among them, in the entire network delay detection process, the network delay detection device can be divided into two parts, one is the network traffic capture part (Capture), and the other is the network traffic analysis part (Analysis). Both parts are implemented at the client daunt level, which can be specifically as follows Figure 10 As shown in the figure, the network traffic capture section primarily aims to capture all network transmission and reception data in the local environment. The network traffic analysis section primarily aims to analyze the data from the network traffic capture device. This data analysis allows calculation of network latency between the client and a specific server. TCP communication analysis is divided into three phases: connection establishment, data transmission and reception, and disconnection. First, TCP communication establishes a connection, clearly marked by the SYN=1 flag. After the connection is established, the data transmission and reception phase begins. Each TCP IP packet contains several control flags. The data transmission and reception before disconnection is the primary step in evaluating network latency.
[0107] Among them, in network transmission, the entire network is a protocol package from a client to a server, which contains multiple protocol layers, which can be specifically Figure 11 As shown, while latency and quality testing can theoretically be performed at various protocol layers, this solution focuses on the TCP protocol at the Transport Layer to evaluate network latency. Furthermore, it can be seen that this solution does not require deployment on a specific server; it can be used as long as the server provides TCP connections. This is very helpful in third-party proxy and VPN scenarios, and in balancing node selection and performance.
[0108] Among them, network delay detection can be applied to the accelerator to evaluate the delay of the connection in the application before and after acceleration. Taking the application as a game as an example, after starting the accelerator for acceleration, the output evaluation page containing the evaluated network delay can be as follows: Figure 12 In most cases, games and network acceleration services cannot share data. Therefore, only TCP-based network latency assessment solutions that do not require additional deployment can complete the task of evaluating network latency.
[0109] As can be seen from the above, after obtaining the network data packet sent by the client in the current network, the embodiment of the present application extracts the header information of the network data packet and performs data packet identification processing based on the header information to obtain the data packet type of the network data packet. According to the data packet type, the header information is parsed and processed to obtain the sending time of the network data packet. When the feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are merged to calculate the transmission time of the network data packet. Then, the transmission time of the network data packet is checked and processed to obtain the network delay of the current network. Since the scheme obtains the network data packet sent by the client and determines the sending time and receiving time of the network data based on the header information and feedback data, thereby obtaining the transmission time of the network data packet and calculating the network delay of the current network based on the transmission time, there is no need to modify or deploy a third-party server, so it can be widely used in various networked smart devices, thereby greatly increasing the versatility of detecting network delays, and therefore, can improve the detection efficiency of network delay detection.
[0110] The method described in the above embodiment will be further described in detail below with examples.
[0111] In this embodiment, the network delay detection device is specifically integrated into an electronic device, and the electronic device is a terminal.
[0112] like Figure 13 As shown in FIG, a network delay detection method, the specific process is as follows:
[0113] 201. The terminal obtains a network data packet sent by a client in the current network.
[0114] For example, when there is network traffic on the current network, the terminal can capture the IP layer traffic of the local device through the VPN Service on the Android platform, or through the VPN Extension on the iOS platform. Alternatively, on Windows and Linux platforms, the terminal can also obtain the IP layer traffic of the local device through the network filter driver or virtual network card. The currently transmitted network data packets are extracted from the network traffic to obtain the network data packets sent by the client on the current network.
[0115] 202. The terminal extracts header information of the network data packet and performs data packet identification processing based on the header information to obtain a data packet type of the network data packet.
[0116] For example, the terminal can directly extract the packet header information from the network data packet to obtain the packet header information. Alternatively, the terminal can classify the information in the network data packet according to the storage location and, based on the classification results, filter out the information stored in the header of the network data packet to obtain the packet header information. The packet header information is compared with the packet header information of the data packet corresponding to each communication protocol to determine the communication protocol corresponding to the obtained network data packet. When the communication protocol corresponding to the network data packet is TCP, the format of the network data packet can be a TCP data packet. When the communication protocol corresponding to the network data packet is UDP, the format of the network data packet can be a UDP data packet.
[0117] When the data packet format is a TCP data packet, the terminal can extract the identification information of the network data packet from the packet header information. When the identification information is a data identifier, it can be determined that the data packet type of the network data packet is a traffic data packet. When the identification information is a control identifier, it can be determined that the data packet type of the network data packet is a data control packet.
[0118] 203. When the data packet type is a data control packet and the control type is to establish a connection, the terminal starts a network delay detection service to detect the network delay of the current network.
[0119] For example, when the data packet type is a data control packet, the terminal extracts the control identifier from the packet header information and determines the control type of the network data packet based on the control identifier. When the control type is to establish a connection, the network delay detection service for the current network is started, and the step of obtaining the network data packet sent by the client in the current network is returned to execute until the data packet type of the network data packet is a traffic data packet. The target network data packet is obtained, and the network connection corresponding to the target network data packet is detected. When the target network data packet is a data packet in the network connection corresponding to the network delay detection service, the sending time of the target network data packet is determined based on the packet header information of the target network data to detect the network delay of the current network.
[0120] 204. When the data packet type is a traffic data packet, the terminal parses the packet header information to obtain the sending time of the network data packet.
[0121] For example, when the data packet type is a traffic data packet, the terminal identifies the serial number identifier seq of the network data packet in the packet header information, obtains the transmission information of the current network, and filters out the target transmission information corresponding to the serial number identifier seq in the transmission information.
[0122] The terminal identifies the number of times the network data packet has been sent and the basic sending time for each transmission in the target transmission information. If the number of times the network data packet has been sent is one, the terminal determines the sending type of the network data packet to be normal. If the number of times the network data packet has been sent is two, the terminal determines the sending type of the network data packet to be first repetition. If the sending type is normal, the basic sending time is used as the sending time of the network data packet. If the sending type is first repetition, the basic sending time with the earliest sending time is selected from the basic sending times and used as the sending time of the network data packet.
[0123] 205. When receiving feedback data returned by the server for the network data packet, the terminal fuses the receiving time and the sending time of the feedback data to calculate the transmission time of the network data packet.
[0124] For example, when the sending type of a network data packet is normal sending, the time interval between the basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When the sending type of the network data packet is the first retransmission, the time interval between the earliest basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When the sending type of the network data packet is not the first retransmission, there is no need to sample the network data, and therefore, there is no need to calculate the transmission time of the network data packet.
[0125] 206. When the data packet type is a data control packet and the control type is disconnection, the terminal stops the network delay detection service and detects the network delay of the current network based on the target delay data log within the detection period.
[0126] For example, when the data packet type is a data control packet, the terminal extracts the control identifier from the packet header information and determines the control type of the network data packet based on the control identifier. When the control type is disconnected, the terminal can stop the network delay detection service and classify the transmission time in the current delay data log according to the sending type of the network data packet corresponding to the transmission time to obtain the current normal transmission time and the current retransmission transmission time, and then merge the current normal transmission time and the current retransmission transmission time to obtain the network delay of the current network.
[0127] 207. The terminal detects and processes the transmission time of the network data packet to obtain the current network delay.
[0128] For example, the terminal adds the transmission time of the network data packet to the preset delay data log to obtain the delay data log, returns to execute the step of obtaining the network data packet transmitted in the current network, and receives the disconnection data control packet sent by the client to obtain the target delay data log within the detection period.
[0129] The terminal classifies the transmission times in the target delay data log according to the transmission type of the network data packets corresponding to the transmission times to obtain normal transmission times and retransmission transmission times. A first number of normal transmission times and a second number of retransmission transmission times are respectively counted in the target delay data log. The ratio between the first number and the total amount of transmission time is calculated to obtain a first ratio, which is used as a weighting coefficient for the normal transmission time. The ratio between the second number and the total amount of transmission time is calculated to obtain a second ratio, which is used as a weighting coefficient for the retransmission transmission time. Alternatively, the ratio between the first number and the second number can be calculated, and the weighting coefficient corresponding to the ratio can be selected from a preset set of weighting coefficients to obtain the weighting coefficients for the normal transmission time and the retransmission transmission time. Alternatively, the first number can be used as the weighting coefficient for the normal transmission time, and the second number can be used as the weighting coefficient for the retransmission transmission time. Based on the weighting coefficients, the normal transmission time and the retransmission transmission time are weighted.
[0130] The terminal merges the weighted normal transmission time and the weighted retransmission time to obtain the merged transmission time, and calculates the time mean of the merged transmission time according to the first quantity and the second quantity to obtain the network delay of the current network, which can be specifically shown in formula (2).
[0131] As can be seen from the above, after the server in the embodiment of the present application obtains the network data packet sent by the client in the current network, it extracts the header information of the network data packet and performs data packet identification processing based on the header information to obtain the data packet type of the network data packet. According to the data packet type, the header information is parsed and processed to obtain the sending time of the network data packet. When the feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are merged to calculate the transmission time of the network data packet. Then, the transmission time of the network data packet is detected to obtain the network delay of the current network. Since the solution obtains the network data packet sent by the client and determines the sending time and receiving time of the network data based on the header information and feedback data, thereby obtaining the transmission time of the network data packet and calculating the network delay of the current network based on the transmission time, there is no need to modify or deploy a third-party server, so it can be widely used in various networked smart devices, thereby greatly increasing the versatility of detecting network delays, and therefore, the detection efficiency of network delay detection can be improved.
[0132] In order to better implement the above method, an embodiment of the present invention also provides a network delay detection device, which can be integrated into an electronic device, such as a server or terminal, and the terminal may include a tablet computer, a laptop computer and / or a personal computer.
[0133] For example, Figure 14 As shown, the network delay detection device may include an acquisition unit 301, an identification unit 302, a parsing unit 303, a calculation unit 304 and a detection unit 305, as follows:
[0134] (1) Acquisition unit 301;
[0135] The acquisition unit 301 is configured to acquire a network data packet sent by a client in the current network.
[0136] For example, the acquisition unit 301 can be specifically used to directly capture the network traffic of the IP layer through the API interface of the local virtual network card when there is network traffic in the current network, extract the currently transmitted network data packets from the network traffic, and thus obtain the network data packets sent by the client in the current network.
[0137] (2) Identification unit 302;
[0138] The identification unit 302 is configured to extract packet header information from a network data packet and perform packet identification processing based on the packet header information to obtain a packet type of the network data packet.
[0139] For example, the identification unit 302 can be specifically used to extract the information of the data packet header in the network data packet, thereby obtaining the header information, or it can also classify the information in the network data packet according to the storage location, and based on the classification result, filter out the information stored in the header in the network data packet, thereby obtaining the header information, and identify the communication protocol corresponding to the network data packet in the header information to determine the data packet format of the network data packet. When the data packet format is the target data packet format, the identification information of the network data packet is extracted from the header information, and based on the identification information, the data packet type of the network data packet is identified.
[0140] (3) parsing unit 303;
[0141] The determining unit 303 is configured to parse the packet header information according to the packet type to obtain the sending time of the network packet.
[0142] For example, the determination unit 303 can be specifically used to identify the data packet identifier of the network data packet in the packet header information when the data packet type is a traffic data packet, obtain the transmission information of the current network, and filter out the target transmission information corresponding to the data packet identifier in the transmission information, parse and process the target transmission information, and obtain the sending time of the network data packet.
[0143] (4) computing unit 304;
[0144] The calculation unit 304 is configured to, when receiving feedback data returned by the server for the network data packet, fuse the reception time of the feedback data with the transmission time to calculate the transmission time of the network data packet.
[0145] For example, the calculation unit 304 can be specifically used to directly calculate the time interval between the basic sending time and the receiving time of the network data packet when feedback data returned by the server for the network data packet is received and the sending type of the network data packet is normal sending, thereby obtaining the transmission time of the network data packet. When feedback data returned by the server for the network data packet is received and the sending type of the network data packet is the first retransmission, the time interval between the earliest basic sending time and the receiving time of the network data packet can be directly calculated, thereby obtaining the transmission time of the network data packet.
[0146] (5) Detection unit 305;
[0147] The detection unit 305 is used to detect the transmission time of the network data packet to obtain the network delay of the current network.
[0148] For example, the detection unit 305 can be specifically used to add the transmission time of the network data packet to the preset delay data log, obtain the delay data log, return to execute the step of obtaining the network data packet transmitted in the current network, until the disconnection data control packet sent by the client is received, obtain the target delay data log within the detection period, and count the transmission time in the target delay data log to obtain the network delay of the current network.
[0149] Optionally, the network delay detection device may further include a control unit 306, such as Figure 15 As shown, the specific details can be as follows:
[0150] The control unit 306 starts or stops the network delay detection service to detect the network of the current network when the data packet type is a data control packet.
[0151] For example, the control unit 306 can be specifically used to extract the control identifier from the packet header information when the data packet type is a data control packet, and determine the control type of the network data packet based on the control identifier; when the control type is to establish a connection, start the network delay detection service for the current network, and detect the network delay of the current network based on the network delay detection service; when the control type is to disconnect, stop the network delay detection service, and detect the network delay of the current network based on the target delay data log within the detection period.
[0152] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can be found in the previous method embodiments and will not be repeated here.
[0153] As can be seen from the above, in the embodiment of the present application, after the acquisition unit 301 acquires the network data packet sent by the client in the current network, the identification unit 302 extracts the header information of the network data packet and performs data packet identification processing based on the header information to obtain the data packet type of the network data packet. The parsing unit 303 parses the header information according to the data packet type to obtain the sending time of the network data packet. When the calculation unit 304 receives the feedback data returned by the server for the network data packet, it merges the receiving time and sending time of the received feedback data to calculate the transmission time of the network data packet. Then, the detection unit 305 detects the transmission time of the network data packet to obtain the network delay of the current network. Since the scheme obtains the network data packet sent by the client and determines the sending time and receiving time of the network data based on the header information and feedback data, thereby obtaining the transmission time of the network data packet and calculating the network delay of the current network based on the transmission time, there is no need to modify or deploy a third-party server, so it can be widely used in various networked smart devices, thereby greatly increasing the versatility of detecting network delays, and thus can improve the detection efficiency of network delay detection.
[0154] An embodiment of the present invention further provides an electronic device, such as Figure 16 , which shows a schematic structural diagram of an electronic device involved in an embodiment of the present invention, specifically:
[0155] The electronic device may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 16 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0156] Processor 401 is the control center of the electronic device, connecting the various parts of the entire electronic device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the electronic device and processes data, thereby performing overall testing of the electronic device. Optionally, processor 401 may include one or more processing cores; preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, and the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0157] Memory 402 can be used to store software programs and modules. Processor 401 executes various functional applications and data processing by running the software programs and modules stored in memory 402. Memory 402 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as sound playback or image playback); the data storage area may store data generated based on the use of the electronic device. Furthermore, memory 402 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, memory 402 may also include a memory controller to provide processor 401 with access to memory 402.
[0158] The electronic device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0159] The electronic device may further include an input unit 404, which may be configured to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0160] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions as follows:
[0161] Obtain the network data packet sent by the client in the current network, extract the header information of the network data packet, and perform data packet identification processing based on the header information to obtain the data packet type of the network data packet. According to the data packet type, parse the header information to obtain the sending time of the network data packet. When receiving the feedback data returned by the server for the network data packet, fuse the receiving time and sending time of the received feedback data to calculate the transmission time of the network data packet. Detect the transmission time of the network data packet to obtain the network delay of the current network.
[0162] For example, when network traffic is flowing on a current network, the electronic device directly captures IP layer network traffic via a VPN (virtual private network), extracts the currently transmitted network data packets from the network traffic, and thereby obtains the network data packets sent by the client on the current network. The electronic device then extracts packet header information from the network data packets to obtain header information. Alternatively, the electronic device may classify the information in the network data packets by storage location and, based on the classification results, filter out information stored in the header of the network data packets to obtain header information. The electronic device then identifies the communication protocol corresponding to the network data packet in the header information to determine the packet format of the network data packet. If the packet format is the target packet format, the electronic device extracts identification information from the header information and, based on this identification information, identifies the packet type of the network data packet. If the packet type is a traffic packet, the electronic device identifies the packet identifier in the header information to obtain transmission information on the current network. The electronic device then filters out target transmission information corresponding to the packet identifier from the transmission information and parses the target transmission information to obtain the transmission time of the network data packet. When receiving feedback data returned by the server for a network data packet, and the sending type of the network data packet is normal sending, the time interval between the basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When receiving feedback data returned by the server for a network data packet, and the sending type of the network data packet is first retransmission, the time interval between the earliest basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. The transmission time of the network data packet is added to the preset delay data log to obtain the delay data log, and the step of obtaining the network data packet transmitted in the current network is returned to execute until the disconnection data control packet sent by the client is received, and the target delay data log within the detection period is obtained. The transmission time in the target delay data log is counted to obtain the network delay of the current network. When the data packet type is a data control packet, the control identifier is extracted from the packet header information, and based on the control identifier, the control type of the network data packet is determined. When the control type is to establish a connection, the network delay detection service for the current network is started, and the network delay of the current network is detected based on the network delay detection service. When the control type is to disconnect, the network delay detection service is stopped, and the network delay of the current network is detected based on the target delay data log within the detection period.
[0163] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0164] As can be seen from the above, after obtaining the network data packet sent by the client in the current network, the embodiment of the present application extracts the header information of the network data packet and performs data packet identification processing based on the header information to obtain the data packet type of the network data packet. According to the data packet type, the header information is parsed and processed to obtain the sending time of the network data packet. When the feedback data returned by the server for the network data packet is received, the receiving time and the sending time of the received feedback data are integrated to calculate the transmission time of the network data packet. Then, the transmission time of the network data packet is detected to obtain the network delay of the current network. Since the scheme obtains the network data packet sent by the client and determines the sending time and receiving time of the network data based on the header information and feedback data, thereby obtaining the transmission time of the network data packet and calculating the network delay of the current network based on the transmission time, there is no need to modify or deploy a third-party server, so it can be widely used in various networked smart devices, thereby greatly increasing the versatility of detecting network delays, and therefore, the detection efficiency of network delay detection can be improved.
[0165] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0166] To this end, an embodiment of the present invention provides a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute the steps of any of the network delay detection methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:
[0167] Obtain the network data packet sent by the client in the current network, extract the header information of the network data packet, and perform data packet identification processing based on the header information to obtain the data packet type of the network data packet. According to the data packet type, parse the header information to obtain the sending time of the network data packet. When receiving the feedback data returned by the server for the network data packet, fuse the receiving time of the received feedback data and the sending time to calculate the transmission time of the network data packet. Detect the transmission time of the network data packet to obtain the network delay of the current network.
[0168] For example, when network traffic is flowing on the current network, the IP layer network traffic is directly captured via a VPN (virtual private network). The currently transmitted network data packets are extracted from the network traffic, thereby obtaining the network data packets sent by the client on the current network. The packet header information is extracted from the network data packets to obtain the header information. Alternatively, the information in the network data packets can be classified by storage location. Based on the classification results, the information stored in the header of the network data packets is filtered to obtain the header information. The communication protocol corresponding to the network data packet is identified in the header information to determine the packet format of the network data packet. If the packet format is the target packet format, the network data packet identification information is extracted from the header information. Based on this identification information, the packet type of the network data packet is identified. If the packet type is a traffic packet, the packet identifier of the network data packet is identified in the header information to obtain the current network transmission information. The transmission information is then filtered to obtain the target transmission information corresponding to the packet identifier. The target transmission information is then parsed to obtain the sending time of the network data packet. When receiving feedback data returned by the server for a network data packet, and the sending type of the network data packet is normal sending, the time interval between the basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. When receiving feedback data returned by the server for a network data packet, and the sending type of the network data packet is first retransmission, the time interval between the earliest basic sending time and the receiving time of the network data packet can be directly calculated to obtain the transmission time of the network data packet. The transmission time of the network data packet is added to the preset delay data log to obtain the delay data log, and the step of obtaining the network data packet transmitted in the current network is returned to execute until the disconnection data control packet sent by the client is received, and the target delay data log within the detection period is obtained. The transmission time in the target delay data log is counted to obtain the network delay of the current network. When the data packet type is a data control packet, the control identifier is extracted from the packet header information, and based on the control identifier, the control type of the network data packet is determined. When the control type is to establish a connection, the network delay detection service for the current network is started, and the network delay of the current network is detected based on the network delay detection service. When the control type is to disconnect, the network delay detection service is stopped, and the network delay of the current network is detected based on the target delay data log within the detection period.
[0169] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0170] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0171] Since the instructions stored in the computer-readable storage medium can execute the steps of any network delay detection method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any network delay detection method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0172] According to one aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in various optional implementations of the aforementioned network delay detection or network delay evaluation aspects.
[0173] The above is a detailed introduction to a network delay detection method, device, and computer-readable storage medium provided in an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method of the present invention and its core concept. At the same time, for those skilled in the art, based on the concept of the present invention, there may be changes in the specific implementation methods and application scope. In summary, the contents of this specification should not be understood as limiting the present invention.
Claims
1. A network delay detection method, characterized in that: include: Get the network data packets sent by the client in the current network; Extracting packet header information from the network data packet, and performing data packet identification processing based on the packet header information to obtain a data packet type of the network data packet, wherein the data packet type includes a flow data packet and a data control packet, and the packet header information includes a data packet identifier and a control identifier; parsing the data packet identifier of the traffic data packet to obtain a sending time of the traffic data packet; Determining a control type of the data control packet according to the control identifier of the data control packet, determining a time to start and a time to stop a network delay detection service according to the control type, and determining a detection period of the traffic data packet according to the time to start and the time to stop the network delay detection service; When feedback data returned by the server for the traffic data packet is received, a receiving time of the feedback data and the sending time are integrated within the detection period to calculate the transmission time of the traffic data packet; The transmission time of the traffic data packet is detected and processed to obtain the network delay of the current network.
2. The network delay detection method according to claim 1, characterized in that: The parsing the data packet identifier of the traffic data packet to obtain the sending time of the traffic data packet includes: Acquire the transmission information of the current network, and filter out the target transmission information corresponding to the data packet identifier from the transmission information; The target transmission information is parsed to determine the sending time of the traffic data packet.
3. The network delay detection method according to claim 2, characterized in that: The parsing and processing the target transmission information to determine the sending time of the traffic data packet includes: Identifying the number of times the traffic data packet is sent and the basic sending time of each sending in the target transmission information; Determining the sending type of the traffic data packet according to the number of sending times; Based on the sending type, the sending time of the traffic data packet is filtered out from the basic sending time.
4. The network delay detection method according to claim 3, characterized in that: The determining, according to the number of transmissions, the transmission type of the traffic data packet includes: When the number of transmissions is one, determining that the transmission type of the traffic data packet is normal transmission; When the number of transmissions is two, it is determined that the transmission type of the traffic data packet is the first retransmission.
5. The network delay detection method according to claim 4, characterized in that: The filtering out the sending time of the traffic data packet from the basic sending time based on the sending type includes: When the sending type is normal sending, the basic sending time is used as the sending time of the traffic data packet; When the sending type is the first retransmission, the basic sending time with the earliest sending time is selected from the basic sending times as the sending time of the traffic data packet.
6. The network delay detection method according to any one of claims 1 to 5, characterized in that: The detecting and processing the transmission time of the traffic data packet to obtain the network delay of the current network includes: Adding the transmission time of the traffic data packet to a preset delay data log to obtain a delay data log; Returning to the step of obtaining the network data packets transmitted in the current network until receiving the disconnection data control packet sent by the client, obtaining the target delay data log within the detection period, where the detection period is the time between starting the network delay detection service and stopping the network delay detection service; Statistical processing is performed on the transmission time in the target delay data log to obtain the network delay of the current network.
7. The network delay detection method according to claim 6, characterized in that: The statistical processing of the transmission time in the target delay data log to obtain the network delay of the current network includes: Classify the transmission time in the target delay data log according to the transmission type of the traffic data packet corresponding to the transmission time to obtain a normal transmission time and a retransmission transmission time; The normal transmission time and the retransmission transmission time are weighted, and the weighted normal transmission time and the weighted retransmission transmission time are merged to obtain the network delay of the current network.
8. The network delay detection method according to claim 7, characterized in that: The weighting of the normal transmission time and the retransmission transmission time includes: Counting the first number of normal transmission times and the second number of retransmission times in the target delay data log; determining weighting coefficients of the normal transmission time and the retransmission transmission time based on the first number and the second number; Based on the weighting coefficients, the normal transmission time and the retransmission transmission time are weighted respectively.
9. The network delay detection method according to claim 8, characterized in that: The fusing the weighted normal transmission time and the weighted retransmission transmission time to obtain the network delay of the current network includes: The weighted normal transmission time and the weighted retransmission transmission time are combined to obtain a combined transmission time; The time mean of the fused transmission time is calculated according to the first number and the second number to obtain the network delay of the current network.
10. The network delay detection method according to any one of claims 1 to 5, characterized in that: The control type includes establishing a connection and disconnecting a connection; and determining the detection period of the traffic data packet according to the time of starting the network delay detection service and the time of stopping the network delay detection service includes: When the control type is establishing a connection, starting a network delay detection service for the current network, and detecting a startup network delay of the current network based on the network delay detection service; When the control type is the disconnection, stopping the network delay detection service, and detecting the stopping network delay of the current network based on the current delay data log within the detection period; A detection period for the traffic data packet is determined according to the start network delay and the stop network delay.
11. The network delay detection method according to claim 10, characterized in that: The detecting the startup network delay of the current network based on the network delay detection service includes: Returning to the step of obtaining the network data packet sent by the client in the current network, until the data packet type of the network data packet is the traffic data packet, and obtaining the target network data packet; When the target network data packet is a data packet in the network connection corresponding to the network delay detection service, the packet header information of the target network data packet is parsed and processed to obtain the sending time of the target network data packet to detect the startup network delay of the current network.
12. The network delay detection method according to any one of claims 1 to 5, characterized in that: The identifying and processing of the data packet based on the packet header information to obtain the data packet type of the network data packet includes: Identifying the communication protocol corresponding to the network data packet in the packet header information to determine the data packet format of the network data packet; When the data packet format is the target data packet format, extracting identification information of the network data packet from the packet header information; Based on the identification information, a data packet type of the network data packet is determined.
13. A network delay detection device, characterized in that: include: An acquisition unit, used to acquire network data packets sent by clients in the current network; an identification unit, configured to extract header information of a network data packet and perform data packet identification processing based on the header information to obtain a data packet type of the network data packet, wherein the data packet type includes a flow data packet and a data control packet, and the header information includes a data packet identifier and a control identifier; A parsing unit, configured to parse the data packet identifier of the traffic data packet to obtain a sending time of the traffic data packet; a period detection unit, configured to determine a control type of the data control packet according to the control identifier of the data control packet, determine a time to start and a time to stop the network delay detection service according to the control type, and determine a detection period of the traffic data packet according to the time to start and the time to stop the network delay detection service; a calculation unit, configured to, upon receiving feedback data returned by the server for the traffic data packet, fuse the reception time of the feedback data and the transmission time within the detection period to calculate the transmission time of the traffic data packet; The detection unit is used to detect and process the transmission time of the traffic data packet to obtain the network delay of the current network.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the network delay detection method according to any one of claims 1 to 12 are implemented.
15. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to execute the steps in the network delay detection method according to any one of claims 1 to 12.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the network delay detection method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Coordination mechanism method of multiple-hop underwater acoustic network data transmission
CN105813130A
System and method for estimation of round trip times within a TCP based data network
US20100238828A1