CN118353811A - Network state detection method, device, computer equipment and storage medium - Google Patents

Network state detection method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN118353811A
CN118353811A CN202410775369.3A CN202410775369A CN118353811A CN 118353811 A CN118353811 A CN 118353811A CN 202410775369 A CN202410775369 A CN 202410775369A CN 118353811 A CN118353811 A CN 118353811A
Authority
CN
China
Prior art keywords
call
data packet
protocol
response
packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410775369.3A
Other languages
Chinese (zh)
Inventor
张丁文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Volcano Engine Technology Co Ltd
Original Assignee
Beijing Volcano Engine Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Volcano Engine Technology Co Ltd filed Critical Beijing Volcano Engine Technology Co Ltd
Priority to CN202410775369.3A priority Critical patent/CN118353811A/en
Publication of CN118353811A publication Critical patent/CN118353811A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present disclosure relates to the technical field of data communication, and discloses a method, a device, a computer device and a storage medium for detecting a network state, wherein a call data packet matched with a current detection scene is constructed, the call device sends the call data packet to a receiving device, and then the receiving condition of the corresponding call data packet returned by the receiving device is determined. The call data packet and the response data packet are both constructed based on a preset protocol, a service field in the call data packet and the response data packet can be used for representing a call response service type, a type field in the call data packet can be used for representing a call path of a current detection scene, and a type field in the response data packet can be used for representing a response path. The method can be used for business office, a group of call answering service is formed by a group of corresponding call data packets and answering data packets, the network state between the calling equipment and the receiving equipment can be accurately described, the network state can be further improved in a targeted manner aiming at different network state indexes, and the network performance is improved.

Description

Network state detection method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of data communications technologies, and in particular, to a method and apparatus for detecting a network state, a computer device, and a storage medium.
Background
Virtual Private Networks (VPN) are commonly used in communication methods for connecting private networks between large enterprises or communities, and use tunneling protocols to achieve functions such as sender authentication, message confidentiality, and accuracy. A particular communication protocol is typically employed when using a virtual private network. Wireguard is a high-performance virtual private network protocol, which has the characteristics of simplicity, high efficiency, easy use, high security and the like, and is one of the great concerns in modern VPN solutions.
The network reachability, the network rate, the maximum data transmission amount and other indexes can be used for judging the network state, and accurately sensing the influence of the network link on the tunnel is beneficial to improving the network performance. When Wireguard protocols are used, it is often difficult to accurately understand the current network link state, which may affect network performance.
Disclosure of Invention
In view of this, the present disclosure provides a method, an apparatus, a computer device and a storage medium for detecting a network state, so as to solve the problem that the current network state cannot be determined.
In a first aspect, the present disclosure provides a method for detecting a network state, the method including:
Constructing a call data packet matched with a current detection scene, wherein the call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to represent a call answering service type, and a type field in the preset protocol is set to represent a call path in the current detection scene;
Transmitting the call data packet to a receiving device, and judging whether a response data packet corresponding to the call data packet returned by the receiving device is received, wherein the response data packet is constructed based on the preset protocol, and in the response data packet, a service field in the preset protocol is set to represent the call response service type, and a type field in the preset protocol is set to represent a response path in the current detection scene;
and determining the network state corresponding to the current detection scene according to the receiving condition of the response data packet represented by the judging result.
The network state detection method provided by the embodiment includes the steps of firstly determining a current detection scene, constructing a call data packet matched with the current detection scene, sending the call data packet to the receiving device by the call device, and then determining the receiving condition of the corresponding call data packet returned by the receiving device. The call data packet and the response data packet are both constructed based on a preset protocol, service fields in the call data packet and the response data packet can be used for representing call response service types, type fields in the call data packet can be used for representing a call path of a current detection scene, type fields in the response data packet can be used for representing a response path of the current detection scene, a group of corresponding call data packet and response data packet form a group of call response service, after the call response service is realized, network states between calling equipment and receiving equipment can be accurately described, the network states can be further improved pertinently aiming at different network state indexes, and the network performance is improved.
In a second aspect, the present disclosure provides a detection apparatus for a network state, including:
constructing a call module, constructing a call data packet matched with a current detection scene, wherein the call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to represent a call answering service type, and a type field in the preset protocol is set to represent a call path in the current detection scene;
A response receiving module, configured to send the call data packet to a receiving device, and determine whether a response data packet corresponding to the call data packet returned by the receiving device is received, where the response data packet is constructed based on the preset protocol, and in the response data packet, a service field in the preset protocol is set to represent the call response service type, and a type field in the preset protocol is set to represent a response path in the current detection scenario;
And the state determining module is used for determining the network state corresponding to the current detection scene according to the receiving condition of the response data packet represented by the judging result.
In a third aspect, the present disclosure provides a computer device comprising: the memory and the processor are in communication connection with each other, the memory stores computer instructions, and the processor executes the computer instructions, thereby executing the network state detection method according to the first aspect or any implementation manner corresponding to the first aspect.
In a fourth aspect, the present disclosure provides a computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method for detecting a network state according to the first aspect or any one of the embodiments corresponding thereto.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the prior art, the drawings that are required in the detailed description or the prior art will be briefly described, it will be apparent that the drawings in the following description are some embodiments of the present disclosure, and other drawings may be obtained according to the drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flow diagram of a method of detecting network status according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a configuration of a preset protocol according to an embodiment of the present disclosure;
FIG. 3 is a schematic illustration of a scenario of a method of detecting network status according to an embodiment of the present disclosure;
FIG. 4 is a flow chart of another method of detecting network status according to an embodiment of the present disclosure;
FIG. 5 is a schematic illustration of a scenario of another network state detection method according to an embodiment of the present disclosure;
FIG. 6 is a flow chart of a method of detecting a further network state according to an embodiment of the present disclosure;
FIG. 7 is a flow chart of a method of detecting a further network state according to an embodiment of the disclosure;
FIG. 8 is a schematic flow diagram of a scenario of a method of detecting network status according to an embodiment of the present disclosure;
Fig. 9 is a block diagram of a network state detection apparatus according to an embodiment of the present disclosure;
Fig. 10 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been illustrated in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather, these embodiments are provided so that this disclosure will be more thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
In describing embodiments of the present disclosure, the term "comprising" and its like should be taken to be open-ended, i.e., including, but not limited to. The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions are also possible below.
In this context, unless explicitly stated otherwise, performing a step "in response to a" does not mean that the step is performed immediately after "a", but may include one or more intermediate steps.
It will be appreciated that the data (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) involved in the present technical solution should comply with the corresponding legal regulations and the requirements of the relevant regulations.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the relevant users, which may include any type of rights subjects, such as individuals, enterprises, groups, etc., should be informed and authorized by appropriate means of the types of information, usage ranges, usage scenarios, etc. involved in the present disclosure according to relevant legal regulations.
For example, in response to receiving an active request from a user, prompt information is sent to the relevant user to explicitly prompt the relevant user that the operation requested to be performed will need to obtain and use information to the relevant user, so that the relevant user may autonomously select whether to provide information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operation of the technical solution of the present disclosure according to the prompt information.
As an alternative but non-limiting implementation manner, in response to receiving an active request from a relevant user, the prompt information may be sent to the relevant user, for example, in a popup window, where the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
Office security generally relates to security management of networks, identities and terminals, and digital office is safer, more efficient and easier to use by realizing private network networking, access control, management of terminals in the private network and information security protection. The security management at the network level can ensure that private networks such as office networks and the like can safely and efficiently operate, and further ensure that business data can be safely transmitted and stored. The safety management of the identity layer can improve the identity authentication efficiency and safety of the user accessing the private network. The security management of the terminal layer can realize the unified management of terminal equipment in a private network, data leakage prevention and terminal threat protection, thereby ensuring the security of enterprise data.
In practical application, the security management of the network, the identity and the terminal can be technically associated with a plurality of technical branches such as networking strategy, network access and control, remote access, unified terminal management, terminal detection and response, enterprise data leakage prevention, identity authentication management and the like, so that digital office is simpler, more efficient and easier to fall to the ground.
Wireguard is an open source VPN that is easy to configure, fast and secure, and by utilizing the latest encryption technology, a faster, simpler and more compact general VPN can be provided, which can be deployed more easily on various low-end devices and high-end servers. There is no call answering service in the current Wireguard protocol, so it is difficult to accurately know the current network state from end to end of the tunnel, and the network state may include various indexes such as network reachability, network delay, etc.
Based on this, the present disclosure provides a private extension protocol for the case that Wireguard protocol has no call answering service, which can be used for business office, and the call answering service in the private extension protocol can be used to determine network status, including core indexes such as network reachability, network delay, maximum data bearing capacity, etc., so that subsequent operations can be performed for various network statuses.
According to an embodiment of the present disclosure, there is provided an embodiment of a method for detecting a network state, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different from that herein.
In this embodiment, a method for detecting a network state is provided, fig. 1 is a flowchart of a method for detecting a network state according to an embodiment of the disclosure, and as shown in fig. 1, the flowchart includes the following steps:
Step S101, constructing a call data packet matched with the current detection scene.
The call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to characterize a call answering service type, and a type field in the preset protocol is set to characterize a call path in a current detection scenario.
The preset protocol is a private extension protocol provided by the present disclosure, and the structure of the private extension protocol may be the same as that of the Wireguard protocol, and may be specifically shown in fig. 2. Wherein the service field is Wireguard type, which may characterize the call answering service type. The type in fig. 2 is a type field, which may represent a call path in a current detection scenario, that is, a detection scenario specified in a call answering service type, wherein the call path refers to a path from a calling device to a receiving device. The value of the service field can be expanded to more service types according to actual demands, each service type can realize one or more application scenes, and in actual application, a call data packet corresponding to the current detection scene can be constructed according to the actual demands.
Taking "type: =0x81 (1 byte)" in fig. 2 as an example, a call answering service is currently shown, and the call answering service can be used for various scenarios of detecting network states, including network availability detection, network speed measurement, MTU detection, and the like. "type: =13 (1 byte)" in fig. 2 represents an Echo service, and is further applicable to a velocimetry service. In addition, the reserved field in the private extension protocol has a length of 3 bytes, is a reserved field, and can be additionally extended according to actual requirements, for example, when the current protocol is unavailable, special flags can be identified; the length of the Protocol Version is 2 bytes, and when 'Protocol Version: =0' indicates that the Protocol is currently the 0 th edition speed measuring packet Protocol (small end sequence); code represents a status Code for describing the current operation status, taking fig. 2 as an example, "Code: =0" represents the status of the call answering service; the Seq represents a sequence number, which can be used to represent a group of call replies, and indicates that a pair of uplink datagrams and downlink datagrams are respectively a pair of call and reply by the same unique Seq, that is, in a call reply operation, the values of the Seq in a call data packet and a response data packet are the same; payload is a Payload field, which represents the data content carried by the current data packet, and customizable Payload allows the current service to deliver related payloads according to different application scenarios, so as to have better expansibility and richer data expression capability in the loaded scenario.
The first 6 bytes in the private extension protocol may be structured identically to Wireguard to ensure that the state of the currently described network link is consistent with the state of the tunnel in the actual network link.
Step S102, sending a call data packet to the receiving equipment, and judging whether a response data packet corresponding to the call data packet returned by the receiving equipment is received or not.
The reply data packet is constructed based on a preset protocol, and in the reply data packet, a service field in the preset protocol is set to represent a call reply service type, and a type field in the preset protocol is set to represent a reply path in a current detection scene.
The call data packet is sent by the calling device to the receiving device, which may return a response data packet within a certain time based on the received call data packet. The receiving device may not return the reply packet due to network delay, network link failure, etc. Therefore, after sending out the call packet to the receiving device, it is necessary to determine whether or not the response packet returned from the receiving device is received, and further, to perform the subsequent operation.
The response data packet is constructed based on a preset protocol, which in the present disclosure may be a proprietary extension protocol, and the structure and field description of the protocol are described in step S101. The service fields in the response packet may be used to characterize the call response service type, as are the call packets and the corresponding service fields in the response packet for the same service type. For example, when the service type is a call answering service, the service fields in the call packet and the answering packet are both set to "type: =0x81 (1 byte)". In the response data packet, a type field in the preset protocol is set to characterize a response path in the current detection scene, and the response path is from the receiving device to the calling device. In the same application scenario, the type fields of the call data packet and the response data packet respectively represent the call path and the response path corresponding to the application scenario. Taking the current detection scenario as an example of network availability detection, a type field in a call packet is used for representing Ping service, a type is marked with 8, and correspondingly, a type field in a received response packet is used for representing Pong service, and a type is marked with 0.
Step S103, according to the receiving condition of the response data packet represented by the judging result, determining the network state corresponding to the current detection scene.
Based on the determination of the receiving condition of the response data packet in step S102, the receiving condition may include various information such as whether the response data packet is received, a time stamp of the received response data packet, a counting condition of the response data packet, and the like. Specifically, when the response data packet sent by the receiving device is not received, the receiving condition is no; when receiving the response data packet sent by the receiving device, the receiving situation is yes. When receiving the reply data packet, the receiving case further includes a time interval from when the call data packet is sent to when the reply data packet is received. When a plurality of call packets are periodically transmitted within a period of time, a plurality of response packets may be received for each call packet, and the reception may further include counting the received response packets. The counting method of the response data packet may be different for different detection scenes, and in particular, corresponding operations may be executed for actual situations.
And determining the network state corresponding to each detection scene according to the receiving condition of the response data packet, taking the current detection scene as an example of a speed measurement scene, and calculating the network delay condition according to the returning time of the response data packet in the receiving condition so as to finish the speed measurement.
After determining the network state, the method can further execute subsequent operations according to the current detection scene, taking the current detection scene as network availability detection as an example, and when determining that the network state is unreachable, performing node switching or protocol switching according to actual conditions.
According to the network state detection method provided by the embodiment, firstly, a call data packet matched with a current detection scene is constructed, call equipment sends the call data packet to receiving equipment, and then the receiving condition of the corresponding call data packet returned by the receiving equipment is determined, wherein the process is shown in fig. 3. The call data packet and the response data packet are both constructed based on a preset protocol, service fields in the call data packet and the response data packet can be used for representing call response service types, type fields in the call data packet can be used for representing a call path of a current detection scene, type fields in the response data packet can be used for representing a response path of the current detection scene, a group of corresponding call data packet and response data packet form a group of call response service, after the call response service is realized, network states between calling equipment and receiving equipment can be accurately described, the network states can be further improved pertinently aiming at different network state indexes, and the network performance is improved.
In this embodiment, a method for detecting a network state is provided, when a current detection scenario indicates network availability detection, a type field in a call packet is set to a first value, a type field in a response packet corresponding to the call packet is set to a second value by a device, a load field in the call packet is null, the first value indicates a call path of the network availability detection, the second value indicates a response path of the network availability detection, and at least one established detection tunnel is provided between a calling device and a receiving device that send the call packet, where each detection tunnel has a respective communication protocol. Fig. 4 is a flowchart of a method of detecting a network state according to an embodiment of the present disclosure, as shown in fig. 4, the flowchart including the steps of:
Step S201, constructing a call data packet matched with the current detection scene.
When the current detection scene is network availability detection, the method can be used for detecting whether the network is available. And respectively establishing detection tunnels between the calling equipment and the receiving equipment under the supporting condition of the communication protocol by the current calling equipment, wherein the protocols can comprise UDP protocol, TCP protocol and the like, when the calling equipment supports a plurality of communication protocols, establishing detection tunnels corresponding to each protocol, and starting corresponding detection aiming at different detection tunnels, namely constructing call data packets corresponding to each detection tunnel. When the current detection scenario is network availability detection, the type field in the call packet is set to a first value, specifically, the first value is 8, i.e., the type flag is 8, indicating Ping service.
Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S202, sending a call data packet to the receiving device, and judging whether a response data packet corresponding to the call data packet returned by the receiving device is received.
Specifically, the step S202 includes:
Step S2021, for any of the target probe tunnels, sends the call packet to the receiving device multiple times based on the first time interval.
The calling device continuously transmits the calling data packet to the receiving device for a plurality of times at a first time interval, and when the calling device supports a plurality of communication protocols, the multi-item mark detection tunnels between the calling device and the receiving device established based on different communication protocols can respectively transmit the calling data packet to the receiving device for a plurality of times through each target detection tunnel.
Step S2022, for any of the transmitted call packets, determines whether a response packet corresponding to the call packet returned by the receiving device is received through the target detection tunnel within the first timeout period.
Each probe has its corresponding first timeout period, and the set first timeout period may be different for different target probe tunnels. And judging whether response data packets corresponding to each sent call data packet are received or not, and obtaining a judging result. The type field in the reply packet is set to a second value, specifically, a second value of 0, i.e., type flag of 0, indicating the Pong service.
Step S203, according to the receiving condition of the response data packet represented by the judging result, determining the network state corresponding to the current detection scene.
Specifically, the step S203 includes:
Step S2031, identifying the receiving condition of the response data packet corresponding to each call data packet from the determination result, and updating the availability information of the target detection tunnel based on the identified receiving condition;
Based on the judgment result obtained in the above step, the receiving condition of the response data packet corresponding to each call data packet is identified, wherein the receiving condition comprises whether the response data packet is received, the time interval of the received response data packet, the count of the corresponding response data packet and the like. For the detection scenario in this embodiment, when the availability of the network is detected, certain processing is performed on the information in the receiving situation according to a set rule, so as to determine availability information related to the target detection tunnel, where the availability information may include indexes such as availability times and unavailability times. The determination method of the availability information may be determined according to the following steps a1 and a 2.
In some optional embodiments, step S2031 includes:
Step a1, for any call data packet sent, when a response data packet is received through a target detection tunnel within a first timeout period, clearing unavailable times and increasing available times;
and a step a2, when the response data packet is not received through the target detection tunnel within the first timeout period, the available times are cleared, and the unavailable times are increased.
For each label probe tunnel, there is its corresponding availability information. For each transmitted call data packet, it is determined whether a response data packet corresponding to the call data packet is received, and when the response data packet is received, the available number or the unavailable number is determined according to whether the time interval between transmitting the call data packet and receiving the response data packet exceeds the first timeout period.
In step S2032, if the number of times of unavailability represented by the availability information is greater than or equal to the first threshold, it is determined that the current network state is unavailable.
The first threshold is set as the maximum number of the unavailable times of the target detection tunnel, and when the unavailable times represented by the availability information are larger than or equal to the first threshold, the unavailable times of the target detection tunnel corresponding to the availability information are determined. When the object detection tunnel is not available, it indicates that the network link from the calling device to the receiving device is not available, i.e. the current network state is not available.
In some alternative embodiments, after determining that the current network state is not available, the method further comprises:
Step a3, judging whether the receiving equipment supports protocol switching;
when the receiving device supports more than one protocol and the target detection tunnel has a plurality of protocols, judging whether the receiving can switch the protocols.
When the receiving device supports only one protocol, the current receiving device is switched to a redundant receiving device.
And a step a4, when the receiving equipment supports protocol switching, switching from the target detection tunnel to the standby detection tunnel, wherein the available times of the availability information characterization of the standby detection tunnel is larger than or equal to a second threshold value.
The backup detection tunnel refers to other detection tunnels except the target detection tunnel which is determined to be unavailable, the second threshold is set to be the minimum number of the available times of the backup detection tunnel, and when the available times represented by the availability information are greater than or equal to the second threshold, the backup detection tunnel is determined to be available.
And when the receiving equipment supports protocol switching and the availability times of the availability information characterization of the standby detection tunnel is greater than or equal to a second threshold value, switching the target detection tunnel into the standby detection tunnel.
Step a5, when the receiving device does not support protocol switching, or there is no available backup probe tunnel, switching from the current receiving device to the redundant receiving device.
And when the available times of the standby detection tunnel are smaller than a second threshold value, indicating that the standby detection tunnel is not available, and switching the current receiving device into the redundant receiving device under the condition that the receiving device does not support protocol switching and the standby detection tunnel is not available. The priority of protocol switching is greater than that of the switching of the receiving equipment, and the switching of the receiving equipment is carried out under the condition that the protocol is not switchable.
Before switching the receiving device, it is also necessary to determine whether the current receiving device can be switched, when the receiving device only supports one protocol or does not support switching the detection tunnel, it is necessary to meet the requirement that the unavailable times or the downlink traffic time interval of the target detection tunnel reach the node switching threshold, and when the unavailable times or the latest downlink traffic time interval reach the corresponding node switching threshold, the receiving device is switched.
In some alternative embodiments, the method further comprises:
and a step a6 of judging whether the time interval of the last received downlink flow is larger than or equal to a third threshold value if the unavailable times represented by the availability information is smaller than the first threshold value.
When the number of times of unavailability of the target detection tunnel is smaller than the first threshold, the target detection tunnel may be considered to be available, i.e. network transmission may be performed between the calling device and the receiving device, but it cannot be determined whether data transmission may be performed between the calling device and the receiving device, i.e. traffic of the data transmission tunnel between the calling device and the receiving device is not necessarily through. Traffic can not be forwarded due to protocol failure or encryption and decryption failure, and in practical application, the network can be understood to be on, but the browser can not access the target page.
The third threshold value refers to the maximum value of the time interval of the last received downstream traffic. The last received downlink traffic time interval and the availability information are indexes for judging whether the network is available or not, and represent the out-of-band situation and the in-band situation respectively. It is further necessary to determine whether the last received downlink traffic interval is greater than or equal to a third threshold.
Step a7, judging whether the receiving equipment supports protocol switching or not when the time interval of the last received downlink flow is larger than or equal to a third threshold value;
when the last received downlink traffic time interval is greater than or equal to the third threshold, the target probe tunnel may be deemed unavailable. In this embodiment, it may be set that heartbeat packets are sent from the calling device to the receiving device at fixed time intervals, and if no heartbeat packet is received within a certain time, it may be considered that the tunnel corresponding to the current communication protocol is unavailable.
When the receiving device supports more than one protocol and a plurality of target detection tunnels exist, judging whether the receiving device can switch the protocols.
When the receiving device supports only one protocol, the current receiving device is switched to a redundant receiving device.
And a step a8, when the receiving equipment supports protocol switching, switching from the target detection tunnel to the standby detection tunnel, wherein the available times of the availability information characterization of the standby detection tunnel is larger than or equal to a second threshold value.
And when the receiving equipment supports protocol switching and the availability times of the availability information characterization of the standby detection tunnel is greater than or equal to a second threshold value, switching the target detection tunnel into the standby detection tunnel. In particular as described in step a4 above.
When the receiving device does not support protocol switching, or there is no available backup probe tunnel, switching from the current receiving device to the redundant receiving device. In particular as described in step a5 above.
In some alternative embodiments, after determining that the current network state is not available, the method further comprises:
Step a9, after switching the detection tunnel or switching the receiving device, resetting the availability information of the target detection tunnel and the standby detection tunnel.
After switching the probe tunnels or switching the receiving device, the availability information of all the probe tunnels is reset.
In some embodiments, as shown in fig. 5, taking an example that the calling device supports two communication protocols of UDP and TCP, the communication protocols corresponding to UDP and TCP are respectively established, and probing is respectively initiated.
And identifying the receiving condition of the response data packet corresponding to each call data packet, and updating the availability information of the target detection tunnel based on the identified receiving condition. And determining the available times and the unavailable times of each detection tunnel and the downlink flow time interval in the current mode according to the availability information. Judging whether the current detection tunnel is in a dual-stack mode or not, if not, judging whether the unavailable times of the current detection tunnel are larger than or equal to a switching node threshold value, and if so, switching the nodes; and when the unavailable times of the current detection tunnel are smaller than the switching node threshold value, judging whether the time interval of the last downlink flow is larger than or equal to the switching node threshold value, if so, switching the nodes, and if not, ending the detection flow.
If the dual stack mode is supported, judging whether the current operation is in the UDP mode or the TCP mode, if the current operation is in the UDP mode, judging whether the unavailable times of the detection tunnel corresponding to the UDP are larger than or equal to a refreshing threshold value, if so, continuously judging whether the available times of the detection tunnel corresponding to the TCP are larger than or equal to a UDP2TCP threshold value, and if so, carrying out protocol switching, namely switching the UDP into the TCP. And when the available times of the detection tunnel corresponding to the TCP is smaller than a second threshold value, further judging whether the unavailable times of the detection tunnel of the UDP reach a UDP2TCP threshold value, if so, performing node switching, and if not, ending detection. And judging whether the downlink traffic time interval of the detection tunnel corresponding to the UDP reaches a switching protocol threshold value or not when the unavailable times of the detection tunnel corresponding to the UDP is smaller than a refreshing threshold value, if so, switching the UDP into the TCP when the available times of the detection tunnel of the TCP reaches a UDP2TCP threshold value, otherwise, switching the nodes when the downlink traffic time interval reaches a node switching threshold value. The judging flow in the TCP mode is identical to the UDP mode, and will not be described here.
The method for detecting network status provided in this embodiment is applied to a network availability detection scenario, and based on a call answering service, calls and answers can be continuously performed between two ends of an established tunnel, and availability information of the corresponding tunnel is determined by detecting receiving conditions of answering data packets corresponding to each call data packet, where each detection tunnel is established based on different communication protocols. When a certain detection tunnel is determined to be unavailable, the detection tunnel or the receiving equipment can be switched in time, so that the availability of the network tunnel is ensured.
In this embodiment, a network state detection method is provided, when a current detection scene indicates that a transmission unit detects, a type field in a call packet is set to a first value, a type field in a response packet corresponding to the call packet is set to a second value, the first value indicates a call path detected by the transmission unit, the second value indicates a response path detected by the transmission unit, and a length of a load field in the call packet is set to a specified message length. Fig. 6 is a flowchart of a method of detecting a network state according to an embodiment of the present disclosure, as shown in fig. 6, the flowchart including the steps of:
step S301, constructing a call packet matching the current detection scenario.
The current detection scenario characterizes the transmission unit detection, i.e. the MTU (Maximum Transmission Unit ) detection. The MTU is used to describe the maximum amount of data that can be transmitted at one time in the current network environment. Adjusting the MTU is an important aspect of network tuning, particularly in some special scenarios, such as through a Virtual Private Network (VPN) or using certain network technologies (e.g., IPv 6). By optimizing the MTU, the network transmission efficiency can be improved, the retransmission of fragments and data packets can be reduced, and the network performance can be improved.
When used for MTU probing, the type field in the constructed call packet is set to a first value, i.e., type is marked 8, indicating Ping service. Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S302, a call data packet is sent to the receiving device, and whether a response data packet corresponding to the call data packet returned by the receiving device is received is judged.
Specifically, the step S302 includes:
in step S3021, when the receiving device supports the first protocol and the second protocol at the same time and the current protocol is the first protocol, the call packet is sent to the receiving device multiple times based on the second time interval.
The reliability of the first protocol is weaker than the reliability of the second protocol.
The MTU detection occurs in a virtual private network, which is established with the current network card MTU specified by the current device operating system. The Payload field in the call packet is Payload, and is set to a specified message length, where in this embodiment, the message length is the current network card MTU. In Payload, the basic contents of the protocol are removed, and the other contents are filled with 0's to a specified message length.
When the detection is started, the maximum length of the MTU can be used as the length of the appointed data message. Taking the first protocol as a UDP protocol and taking the second protocol as a TCP protocol as an example, when the calling equipment simultaneously supports the UDP protocol and works in the UDP protocol, starting MTU detection, and otherwise ending the MTU detection flow. And sending the call data packets to the receiving device uninterruptedly for a plurality of times according to the second time interval.
Step S3022, for any of the transmitted call packets, determines whether a response packet corresponding to the call packet returned by the receiving device is received within the second timeout period.
And judging whether a response data packet returned by the receiving device can be received within a second timeout period after each call data packet is sent out, wherein the response data packet corresponds to the call data packet. The type field in the reply packet is set to a second value, specifically, a second value of 0, i.e., type flag of 0, indicating the Pong service.
Step S303, according to the receiving condition of the response data packet represented by the judging result, determining the network state corresponding to the current detection scene.
Specifically, the step S303 includes:
step S3031, counting the number of response data packets;
step S3032, when the number of response data packets reaches the preset detection threshold, it is determined that the length of the currently loadable transmission unit is the designated message length.
The preset detection threshold is an index which is set according to actual requirements and can be used for judging whether the current network link can bear the current MTU length. The preset probing threshold may be set to 1, which indicates that when 1 response packet is received, the current MTU length may be considered to be carried by the current network link, that is, the length of the designated packet is taken as the length of the transmission unit that may be carried by the current tunnel.
Taking MTU length as 1420 as an example, setting to send three call data packets with the message length, for any operation of sending out call data packets, if receiving a response data packet corresponding to any call data packet, it can be considered that the current network link can bear MTU with 1420 length, and ending MTU detection.
In some optional embodiments, after step S3031, when the number of reply packets does not reach the preset detection threshold, the method further includes:
step b1, decreasing the designated message length based on a preset rule.
When the number of the response data packets does not reach the preset detection threshold, in this embodiment, it may be considered that, for each call data packet, the corresponding response data packet is not received within the second timeout period, which indicates that the current network link cannot bear the current MTU length, and the designated message length needs to be decremented, that is, the MTU length is decremented.
Taking MTU length as 1420 as an example, if the call packet sent with the MTU length as 1420 does not receive the corresponding response packet within the second timeout period, the MTU length may be decremented by 1420 according to a set rule (e.g., decrementing by 200 each time).
And b2, retransmitting the call data packet to the receiving equipment for a plurality of times based on a second time interval, and judging whether a response data packet corresponding to the call data packet returned by the receiving equipment is received within a second timeout period.
After the length field is changed, the call data packet is retransmitted, and whether the response data packet returned by the receiving device can be received within a second timeout period after the call data packet is sent out each time is judged, wherein the response data packet corresponds to the call data packet.
And b3, counting the number of the response data packets received in the second timeout period, and determining that the current transmission unit length cannot bear the designated message length when the number of the response data packets does not reach the preset detection threshold and the designated message length reaches the minimum length threshold.
And sending multiple call data packets based on each length field and counting whether corresponding response data packets are received, and for each length field, if no response data packet is received, namely the number of the response data packets is 0, decrementing the designated message length in the length field until the data message length in the length field is the minimum length threshold value and the corresponding response data packet is not received yet, wherein the current transmission unit length can be considered as not bearing the designated message length, namely the current network link can not bear the current MTU.
In some optional embodiments, after determining that the current transmission unit length cannot carry the specified message length in the step b3, the method further includes:
And b4, switching the current protocol of the receiving equipment from the first protocol to the second protocol.
In some embodiments, taking the first protocol as a UDP protocol and the second protocol as a TCP protocol as an example, when the receiving device supports both the UDP protocol and currently works in the UDP protocol, the MTU detection is started, and otherwise, the MTU detection flow is ended. And sending the call data packets to the receiving device uninterruptedly for a plurality of times according to the second time interval. Starting to send out a call data packet with the MTU length of 1420, setting up to send the call data packet for each length field for three times, if any one of the three times receives a corresponding response data packet within a second timeout period, considering that the current network tunnel can bear the current MTU, and ending the detection. And when the corresponding response data packet is not received in the second timeout period for three times, recording as one detection failure, changing the data message length, retransmitting the calling data packet for at most three times, and the like, until the data message length reaches the set minimum value, if the corresponding response data packet is not received in the second timeout period, the continuous failure can be considered to exceed the maximum failure threshold, the current network tunnel can be considered to be not capable of bearing the current MTU, and the UDP protocol is switched to the TCP protocol.
According to the network state detection method provided by the embodiment, the call response service is used for carrying out transmission unit detection (MTU detection), the data fragments with the designated data message length can be constructed between the tunnels, whether the current network tunnel can bear the current data message length or not is further judged, the data message length is set to be the length of the MTU, the data message length can be reduced according to actual conditions, a call data packet is sent, the receiving condition of the response data packet is detected, and the method is used for judging whether the current network tunnel can bear the current MTU or not, and if not, protocol switching is carried out. The method can avoid the influence of the MTU limitation on the protocol, further improve the network transmission efficiency, reduce the retransmission of fragments and data packets, and improve the network performance.
In this embodiment, a network state detection method is provided, when a current detection scene represents a speed measurement scene, a type field in a call data packet is set to a third value, a type field in a response data packet corresponding to the call data packet is set to a fourth value, a load field in the call data packet is null, the third value represents a call path of the speed measurement scene, and the fourth value represents a response path of the speed measurement scene. Fig. 7 is a flowchart of a method of detecting a network state according to an embodiment of the present disclosure, as shown in fig. 7, the flowchart including the steps of:
step S401, constructing a call data packet matched with the current detection scene.
When the current detection scenario is a speed measurement scenario, the type field in the call packet is set to a third value, specifically, type may be marked 13, indicating Echo service, and the payload field in the call packet is null.
Please refer to step S101 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S402, sending a call data packet to the receiving device, and judging whether a response data packet corresponding to the call data packet returned by the receiving device is received.
And initiating corresponding speed measurement based on the supporting condition of the calling equipment on the communication protocol, and preferentially initiating UDP speed measurement when the UDP protocol is supported, and sending a calling data packet to the receiving equipment based on the set protocol.
Please refer to step S102 in the embodiment shown in fig. 1 in detail, which is not described herein.
Step S403, according to the receiving condition of the response data packet represented by the judging result, determining the network state corresponding to the current detection scene.
Specifically, the step S403 includes:
Step S4031, when the number of the transmitted call data packets reaches the threshold of the speed measurement times, calculating the time interval between each time of receiving the response data packet and transmitting the call data packet, and judging whether the time interval exceeds the third timeout period.
The speed measurement frequency threshold value refers to the maximum frequency of speed measurement, and can be set according to actual conditions. And under the condition that the response data packet is received, recording the time interval between the response data packet received each time and the call data packet transmitted, and judging whether the time interval exceeds a third timeout duration.
If the response data packet is not received within the third timeout period, the speed measurement can be considered to be timeout.
In step S4032, the time interval exceeds the third timeout period, and the time interval is counted as a timeout time interval.
If the time interval exceeds the third timeout period, the time interval is a timeout time interval, which can be regarded as a speed measurement timeout.
And step S4033, marking the time interval as an effective time interval when the time interval does not exceed the third timeout period, and calculating the average value of all the effective time intervals to determine the network delay of the first protocol corresponding to the speed measurement scene.
The effective Time interval may be counted as a Round-Trip Time (RTT), which refers to the Time interval between sending data from the sender and receiving an acknowledgement from the receiver. In network communications, RTT is typically used to measure the time required for a packet to return to a sender from the sender to the receiver. Network applications and protocols typically use RTT to measure network performance, optimize data transmission, and determine the stability of network connections.
When the speed measurement times reach a speed measurement times threshold, namely the number of the transmitted calling data packets reach the speed measurement times threshold, calculating the average value of all effective time intervals, and taking the average value as the network delay of the current first protocol.
In some alternative embodiments, the method further comprises:
and step c1, when the number of the overtime time intervals reaches a speed measurement frequency threshold, switching the first protocol into the second protocol, and determining the network delay of the second protocol corresponding to the speed measurement scene.
And when the number of the timeout time intervals reaches a speed measurement frequency threshold, indicating that no effective RTT exists, switching the first protocol into the second protocol, and measuring the speed based on the second protocol, thereby determining the network delay of the second protocol. The speed measurement process may refer to the above steps S4031 to S4033.
In some embodiments, taking the example that the current calling device supports the UDP protocol and the TCP protocol, a speed measurement flow is initiated according to the supporting states of the current calling device for the two protocols, and the speed measurement flow is shown in fig. 8. If two protocols are supported simultaneously, UDP speed measurement is initiated preferentially. And if the corresponding response data packet is received within the third timeout period for each sent call data packet, taking the time interval between the received response data packet and the sent call data packet as one RTT, recording the RTT, and completing one speed measurement. If no response is received within the third timeout period, the speed measurement is considered to be timeout, and meanwhile, the speed measurement process is finished once. After the speed measurement flow is finished, detecting whether the speed measurement is finished for 3 times at present, and if the speed measurement is not finished, initiating the next speed measurement. If the speed measurement is completed for 3 times, the speed measurement flow marked as the current protocol is ended. After the speed measurement flow of the current protocol is finished, checking whether effective RTT exists, if so, taking an average value of all the effective RTT, and recording as current network delay; if no effective RTT exists and the current speed measurement protocol is UDP, the speed measurement of the TCP is initiated, and the network delay of the TCP is taken as the network delay of the speed measurement scene.
According to the network state detection method provided by the embodiment, the current network delay can be described by calculating the time interval, the influence of network jitter on the speed measurement result can be reduced by taking the average value of the result through measuring the speed for multiple times, the speed measurement efficiency is effectively improved, the speed can be measured for multiple times in a shorter time, and the automatic route selection function can be better realized.
The embodiment also provides a device for detecting a network state, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides a network state detection apparatus, as shown in fig. 9, including:
Constructing a call module 501, namely constructing a call data packet matched with a current detection scene, wherein the call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to represent a call response service type, and a type field in the preset protocol is set to represent a call path in the current detection scene;
A reply receiving module 502, configured to send the call data packet to a receiving device, and determine whether a reply data packet corresponding to the call data packet returned by the receiving device is received, where the reply data packet is constructed based on the preset protocol, and in the reply data packet, a service field in the preset protocol is set to represent the call reply service type, and a type field in the preset protocol is set to represent a reply path in the current detection scenario;
And a state determining module 503, configured to determine a network state corresponding to the current detection scenario according to the receiving condition of the response data packet represented by the determination result.
In some alternative embodiments, when the current detection scenario indicates a network availability probe, a type field in the call data packet is set to a first value, a type field in a response data packet corresponding to the call data packet is set to a second value, a load field in the call data packet is null, the first value indicates a call path of the network availability probe, the second value indicates a response path of the network availability probe, and at least one probe tunnel is established between a calling device sending the call data packet and the receiving device, wherein each probe tunnel has a respective communication protocol.
In some alternative embodiments, when the current detection scenario characterizes network availability probes, the reply receive module 502 includes:
a first sending unit, configured to send a call packet to the receiving device for any target detection tunnel multiple times based on a first time interval;
The first judging unit is used for judging whether a response data packet corresponding to the call data packet returned by the receiving device is received through the target detection tunnel within a first timeout period for any sent call data packet.
In some alternative embodiments, the status determination module 503 includes:
The available information determining unit is used for identifying the receiving condition of the response data packet corresponding to each call data packet from the judging result and updating the availability information of the target detection tunnel based on the identified receiving condition;
and the tunnel judging unit is used for determining that the current network state is unavailable if the unavailable times represented by the availability information are greater than or equal to a first threshold value.
In some alternative embodiments, the available information determining unit includes:
The available times determining subunit is used for clearing the unavailable times and increasing the available times when the response data packet is received through the target detection tunnel within the first timeout period for any sent call data packet;
and the unavailable frequency determining subunit is used for clearing the available frequency and increasing the unavailable frequency when the response data packet is not received through the target detection tunnel within the first timeout period.
In some alternative embodiments, the state determination module 503 further includes:
A protocol judging unit, configured to judge whether the receiving device supports protocol switching;
A tunnel switching unit, configured to switch from the target detection tunnel to a standby detection tunnel when the receiving device supports protocol switching, where an availability number of times represented by availability information of the standby detection tunnel is greater than or equal to a second threshold;
and the device switching unit is used for switching from the current receiving device to the redundant receiving device when the receiving device does not support protocol switching or no available standby detection tunnel exists.
In some alternative embodiments, the availability information determining unit further comprises:
the downlink flow judging subunit is used for judging whether the time interval of the downlink flow received last time is larger than or equal to a third threshold value if the unavailable times represented by the availability information is smaller than the first threshold value;
a protocol judging subunit, configured to judge whether the receiving device supports protocol switching when the time interval of the last received downlink traffic is greater than or equal to a third threshold;
And the tunnel switching subunit is used for switching from the target detection tunnel to a standby detection tunnel when the receiving equipment supports protocol switching, wherein the availability times of the availability information representation of the standby detection tunnel are larger than or equal to a second threshold value.
In some alternative embodiments, the state determination module 503 further includes:
and the information resetting unit is used for resetting the availability information of the target detection tunnel and the standby detection tunnel after switching the detection tunnel or switching the receiving equipment.
In some alternative embodiments, when the current detection scenario indicates that the transmission unit detects, the type field in the call packet is set to a first value, the type field in the response packet corresponding to the call packet is set to a second value, the first value indicates the call path detected by the transmission unit, the second value indicates the response path detected by the transmission unit, and the length of the payload field in the call packet is set to a specified message length.
In some alternative embodiments, when the current detection scene representation transmission unit detects, the reply receiving module 502 includes:
A second sending unit, configured to send the call packet to the receiving device multiple times based on a second time interval when the receiving device supports both a first protocol and a second protocol and the current protocol is the first protocol, where reliability of the first protocol is weaker than reliability of the second protocol;
And the second judging unit is used for judging whether the response data packet corresponding to the call data packet returned by the receiving equipment is received within a second timeout period for any sent call data packet.
In some alternative embodiments, the status determination module 503 includes:
a number counting unit, configured to count the number of the response data packets;
and the message determining unit is used for determining the length of the current transmission unit which can be carried as the length of the designated message when the number of the response data packets reaches a preset detection threshold value.
In some alternative embodiments, when the number of reply packets does not reach the preset detection threshold, the state determining module 503 further includes:
the length decrementing unit is used for decrementing the length of the specified message based on a preset rule;
A retransmission unit, configured to retransmit the call packet to the receiving device multiple times based on a second time interval, and determine whether a response packet corresponding to the call packet returned by the receiving device is received within a second timeout period;
And the re-statistics unit is used for counting the number of the response data packets received in the second timeout period, and determining that the current transmission unit length cannot bear the designated message length when the number of the response data packets does not reach a preset detection threshold and the designated message length reaches a minimum length threshold.
In some optional embodiments, after determining that the current transmission unit length cannot carry the specified message length, the apparatus further includes:
and the protocol switching module is used for switching the current protocol of the receiving equipment from the first protocol to the second protocol.
In some optional embodiments, when the current detection scenario represents a speed measurement scenario, the type field in the call packet is set to a third value, the type field in the response packet corresponding to the call packet is set to a fourth value, the load field in the call packet is null, the third value represents a call path of the speed measurement scenario, the fourth value represents a response path of the speed measurement scenario, and the state determining module 503 includes:
The time interval calculating unit is used for calculating the time interval between each time of receiving the response data packet and transmitting the call data packet when the number of the transmitted call data packets reaches a speed measurement frequency threshold value, and judging whether the time interval exceeds a third timeout duration;
The first recording unit is used for counting the time interval as a timeout time interval when the time interval exceeds a third timeout duration;
And the second recording unit is used for recording the time interval as an effective time interval when the time interval does not exceed the third timeout duration, and calculating the average value of all the effective time intervals to determine the network delay of the first protocol corresponding to the speed measurement scene.
In some alternative embodiments, the state determination module 503 further includes:
and the delay determining unit is used for switching the first protocol into the second protocol when the number of the timeout time intervals reaches a speed measuring frequency threshold value, and determining the network delay of the second protocol corresponding to the speed measuring scene.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
The network state detection device in this embodiment is in the form of a functional unit, where the unit refers to an ASIC (Application SPECIFIC INTEGRATED Circuit) Circuit, a processor and a memory that execute one or more software or firmware programs, and/or other devices that can provide the above functions.
The embodiment of the disclosure also provides a computer device, which is provided with the network state detection device shown in fig. 9.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a computer device according to an alternative embodiment of the disclosure, as shown in fig. 10, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 10 is illustrated in fig. 10.
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further include a hardware chip, among others. The hardware chip may be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods shown in implementing the above embodiments.
The memory 20 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid state disk; the memory 20 may also comprise a combination of the above types of memories.
The computer device also includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
The presently disclosed embodiments also provide a computer readable storage medium, and the methods described above according to the presently disclosed embodiments may be implemented in hardware, firmware, or as recordable storage medium, or as computer code downloaded over a network that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and is to be stored in a local storage medium, such that the methods described herein may be stored on such software processes on a storage medium using a general purpose computer, special purpose processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, a solid state disk or the like; further, the storage medium may also comprise a combination of memories of the kind described above. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Although embodiments of the present disclosure have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the disclosure, and such modifications and variations are within the scope defined by the appended claims.

Claims (18)

1. A method for detecting a network state, the method comprising:
Constructing a call data packet matched with a current detection scene, wherein the call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to represent a call answering service type, and a type field in the preset protocol is set to represent a call path in the current detection scene;
Transmitting the call data packet to a receiving device, and judging whether a response data packet corresponding to the call data packet returned by the receiving device is received, wherein the response data packet is constructed based on the preset protocol, and in the response data packet, a service field in the preset protocol is set to represent the call response service type, and a type field in the preset protocol is set to represent a response path in the current detection scene;
and determining the network state corresponding to the current detection scene according to the receiving condition of the response data packet represented by the judging result.
2. The method of claim 1, wherein when the current detection scenario characterizes network availability detection, a type field in the call packet is set to a first value, a type field in a response packet corresponding to the call packet is set to a second value, a payload field in the call packet is empty, the first value characterizes a call path of network availability detection, the second value characterizes a response path of network availability detection, and at least one detection tunnel is established between a calling device sending the call packet and the receiving device, wherein each detection tunnel is provided with a respective communication protocol.
3. The method according to claim 2, wherein the step of transmitting the call packet to a receiving device and determining whether a response packet corresponding to the call packet returned by the receiving device is received includes:
for any target detection tunnel, sending a call data packet to the receiving equipment for a plurality of times based on a first time interval;
And judging whether a response data packet corresponding to the call data packet returned by the receiving equipment is received through the target detection tunnel within a first timeout period according to any sent call data packet.
4. The method according to claim 3, wherein the determining the network state corresponding to the current detection scenario according to the receiving condition of the response packet characterized by the determination result includes:
Identifying the receiving condition of the response data packet corresponding to each call data packet from the judging result, and updating the availability information of the target detection tunnel based on the identified receiving condition;
and if the unavailable times represented by the availability information are greater than or equal to a first threshold value, determining that the current network state is unavailable.
5. The method of claim 4, wherein the identifying, from the determination result, a reception condition of a response packet corresponding to each call packet, and updating the availability information of the target probe tunnel based on the identified reception condition, comprises:
For any transmitted call data packet, when a response data packet is received through the target detection tunnel within a first timeout period, clearing unavailable times and increasing available times;
And when the response data packet is not received through the target detection tunnel within the first timeout period, the available times are cleared, and the unavailable times are increased.
6. The method of claim 4, wherein after said determining that the current network state is not available, the method further comprises:
Judging whether the receiving equipment supports protocol switching;
when the receiving equipment supports protocol switching, switching from the target detection tunnel to a standby detection tunnel, wherein the availability times of the availability information characterization of the standby detection tunnel are larger than or equal to a second threshold value;
and when the receiving device does not support protocol switching or an available standby detection tunnel does not exist, switching from the current receiving device to the redundant receiving device.
7. The method according to claim 4, wherein the method further comprises:
if the unavailable times represented by the availability information are smaller than a first threshold, judging whether the time interval of the last received downlink flow is larger than or equal to a third threshold;
when the time interval of the last received downlink flow is greater than or equal to a third threshold value, judging whether the receiving equipment supports protocol switching;
and when the receiving equipment supports protocol switching, switching from the target detection tunnel to a standby detection tunnel, wherein the availability times of the availability information characterization of the standby detection tunnel are larger than or equal to a second threshold value.
8. The method of claim 4, wherein after said determining that the current network state is not available, the method further comprises:
after switching the probe tunnel or switching the receiving device, the availability information of the target probe tunnel and the backup probe tunnel is reset.
9. The method of claim 1, wherein when the current detection scenario characterizes the transmission unit detection, the type field in the call packet is set to a first value, the type field in the reply packet corresponding to the call packet is set to a second value, the first value characterizes the call path detected by the transmission unit, the second value characterizes the reply path detected by the transmission unit, and the length of the payload field in the call packet is set to a specified message length.
10. The method of claim 9, wherein the sending the call packet to the receiving device and determining whether a response packet corresponding to the call packet returned by the receiving device is received comprises:
when the receiving equipment supports a first protocol and a second protocol at the same time and the current protocol is the first protocol, sending the call data packet to the receiving equipment for a plurality of times based on a second time interval, wherein the reliability of the first protocol is weaker than that of the second protocol;
And judging whether a response data packet corresponding to the call data packet returned by the receiving equipment is received within a second timeout period for any sent call data packet.
11. The method according to claim 9, wherein the determining the network state corresponding to the current detection scenario according to the receiving condition of the response packet represented by the determination result includes:
counting the number of the response data packets;
and when the number of the response data packets reaches a preset detection threshold, determining the length of the current transmission unit which can be carried as the length of the designated message.
12. The method of claim 11, wherein when the number of response data packets does not reach a preset detection threshold, determining the network state corresponding to the current detection scenario according to the receiving condition of the response data packets represented by the determination result, further comprises:
decrementing the designated message length based on a preset rule;
re-sending the call data packet to the receiving equipment for multiple times based on a second time interval, and judging whether a response data packet corresponding to the call data packet returned by the receiving equipment is received within a second timeout period;
And counting the number of the response data packets received in the second timeout period, and determining that the current transmission unit length can not bear the designated message length when the number of the response data packets does not reach a preset detection threshold and the designated message length reaches a minimum length threshold.
13. The method of claim 10, wherein after determining that the current transport unit length is not capable of carrying the specified message length, the method further comprises:
and switching the current protocol of the receiving equipment from the first protocol to the second protocol.
14. The method according to claim 1, wherein when the current detection scenario indicates a speed measurement scenario, the type field in the call packet is set to a third value, the type field in the response packet corresponding to the call packet is set to a fourth value, the load field in the call packet is null, the third value indicates a call path of the speed measurement scenario, the fourth value indicates a response path of the speed measurement scenario, and the determining the network state corresponding to the current detection scenario according to the receiving condition of the response packet indicated by the determination result includes:
When the number of the transmitted call data packets reaches a speed measurement frequency threshold, calculating the time interval between each time of receiving the response data packets and transmitting the call data packets, and judging whether the time interval exceeds a third timeout duration;
when the time interval exceeds a third timeout period, counting the time interval as a timeout time interval;
And when the time interval does not exceed the third timeout duration, marking the time interval as an effective time interval, and calculating the average value of all the effective time intervals to determine the network delay of the first protocol corresponding to the speed measurement scene.
15. The method according to claim 14, wherein determining the network state corresponding to the current detection scenario according to the receiving condition of the response packet characterized by the determination result further comprises:
And when the number of the overtime time intervals reaches a speed measurement frequency threshold, switching the first protocol into the second protocol, and determining the network delay of the second protocol corresponding to the speed measurement scene.
16. A device for detecting a network condition, the device comprising:
constructing a call module, constructing a call data packet matched with a current detection scene, wherein the call data packet is constructed based on a preset protocol, and in the call data packet, a service field in the preset protocol is set to represent a call answering service type, and a type field in the preset protocol is set to represent a call path in the current detection scene;
A response receiving module, configured to send the call data packet to a receiving device, and determine whether a response data packet corresponding to the call data packet returned by the receiving device is received, where the response data packet is constructed based on the preset protocol, and in the response data packet, a service field in the preset protocol is set to represent the call response service type, and a type field in the preset protocol is set to represent a response path in the current detection scenario;
And the state determining module is used for determining the network state corresponding to the current detection scene according to the receiving condition of the response data packet represented by the judging result.
17. A computer device, comprising:
A memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of detecting a network state of any one of claims 1 to 15.
18. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of detecting a network state according to any one of claims 1 to 15.
CN202410775369.3A 2024-06-17 2024-06-17 Network state detection method, device, computer equipment and storage medium Pending CN118353811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410775369.3A CN118353811A (en) 2024-06-17 2024-06-17 Network state detection method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410775369.3A CN118353811A (en) 2024-06-17 2024-06-17 Network state detection method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN118353811A true CN118353811A (en) 2024-07-16

Family

ID=91824845

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410775369.3A Pending CN118353811A (en) 2024-06-17 2024-06-17 Network state detection method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118353811A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010043152A1 (en) * 2008-10-14 2010-04-22 华为技术有限公司 Method and apparatus for monitoring network state when calling
CN110381517A (en) * 2018-04-13 2019-10-25 广东赛特斯信息科技有限公司 The method of mobile device network state detection
CN116132324A (en) * 2022-12-28 2023-05-16 深圳市鸿合创新信息技术有限责任公司 Network state detection method and device, electronic equipment and storage medium
CN116743547A (en) * 2022-03-01 2023-09-12 中兴通讯股份有限公司 Network recovery method, data device, computer readable medium
CN117560304A (en) * 2024-01-10 2024-02-13 杭州映云科技有限公司 Network state monitoring method, system, equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010043152A1 (en) * 2008-10-14 2010-04-22 华为技术有限公司 Method and apparatus for monitoring network state when calling
CN110381517A (en) * 2018-04-13 2019-10-25 广东赛特斯信息科技有限公司 The method of mobile device network state detection
CN116743547A (en) * 2022-03-01 2023-09-12 中兴通讯股份有限公司 Network recovery method, data device, computer readable medium
CN116132324A (en) * 2022-12-28 2023-05-16 深圳市鸿合创新信息技术有限责任公司 Network state detection method and device, electronic equipment and storage medium
CN117560304A (en) * 2024-01-10 2024-02-13 杭州映云科技有限公司 Network state monitoring method, system, equipment and medium

Similar Documents

Publication Publication Date Title
US10666537B2 (en) Managing connections for data communications using heartbeat messaging
CN108199925B (en) Data sending method, receiving method and device
KR20130082070A (en) Communication apparatus and communication method
CN106612284B (en) Streaming data transmission method and device
US20090245252A1 (en) Communication terminal and retransmission request method
CN103907315A (en) Systems and methods for network quality estimation, connectivity detection, and load management
CN104823412A (en) Peer revival detection
CN103907373A (en) Systems and methods for network quality estimation, connectivity detection, and load management
CN113965482B (en) Data transmission method and device based on gRPC and storage medium
JP2003143250A (en) Substitute response method
CN103891252A (en) Systems and methods for network quality estimation, connectivity detection, and load management
CN112436924A (en) Data transmission method and electronic equipment
CN111884875A (en) Offline device determination method and device
CN103907314A (en) Systems and methods for network quality estimation, connectivity detection, and load management
CN111752803A (en) Method, device and medium for collecting and reporting buried point data
CN114363351B (en) Proxy connection suppression method, network architecture and proxy server
CN101141393B (en) Communication terminal and communication control method
CN108124504B (en) TFO transmission method, proxy server and system
CN103891207A (en) Systems and methods for network quality estimation, connectivity detection, and load management
CN118353811A (en) Network state detection method, device, computer equipment and storage medium
CN115866095A (en) Data transmission method and device, electronic equipment and storage medium
CN111953608B (en) Neighbor table entry management method and device, electronic equipment and storage medium
CN107820274B (en) Mobile network UDP (user Datagram protocol) service congestion processing method and base station
CN110099001B (en) Bidirectional forwarding detection time parameter negotiation method and device and electronic equipment
EP2951708B1 (en) Reporting errors on serial interfaces to application layers for flexible error handling approach selection

Legal Events

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