CN115941541A - Method, device, network equipment and readable storage medium for detecting network connection - Google Patents

Method, device, network equipment and readable storage medium for detecting network connection Download PDF

Info

Publication number
CN115941541A
CN115941541A CN202211659677.7A CN202211659677A CN115941541A CN 115941541 A CN115941541 A CN 115941541A CN 202211659677 A CN202211659677 A CN 202211659677A CN 115941541 A CN115941541 A CN 115941541A
Authority
CN
China
Prior art keywords
network
target server
detection
detecting
connection
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
CN202211659677.7A
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.)
Shenzhen Skyworth Digital Technology Co Ltd
Original Assignee
Shenzhen Skyworth Digital 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 Shenzhen Skyworth Digital Technology Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN202211659677.7A priority Critical patent/CN115941541A/en
Publication of CN115941541A publication Critical patent/CN115941541A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of network test, in particular to a method, a device, network equipment and a readable storage medium for detecting network connection, wherein the method comprises the following steps: sending a link detection request to the target server based on a preset set frequency; when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal; and assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message. According to the invention, the network connection stability of the network equipment is improved and the network operation and maintenance cost is saved by improving the network detection accuracy of the existing network connection detection mode.

Description

Method, device, network equipment and readable storage medium for detecting network connection
Technical Field
The present invention relates to the field of network testing technologies, and in particular, to a method and an apparatus for detecting network connection, a network device, and a readable storage medium.
Background
With the continuous development of the internet, network devices such as gateway devices, router devices and terminal networking devices are rapidly popularized in daily life of people, and users have higher requirements on the network connection stability of the network devices.
At present, the existing network connection detection method usually maintains link connection by sending a message, for example, a method of an lcp request/response, an arp message detection and a heartbeat message in Point-to-Point Protocol Over Ethernet (PPPoE) dialing detects whether there is data interaction between the two parties, and then determines whether the network is disconnected. For example, the existing arp message has the following conditions, (1) detection inaccuracy: arp spoofing can lead to a false belief that the network is connected; (2) insecurity: flooding at arp will result in data being intercepted; (3) non-timeliness: in practical applications, sometimes the arp of the device does not respond in time, for example, the upper level does not receive the arp or does not respond to frequent arp requests again. In other words, although the existing technical specification can maintain basic link detection under the conventional condition, under the constraints of the actual use environment and the complicated network environment, the conditions of interception, discarding, network attack and the like existing in the detection message in the transmission process of the message easily cause the abnormality of the conventional link detection, and further cause detection errors, thereby affecting the normal network connection and causing the network disconnection. For example, when an operator deploys equipment, a normal detection message is intercepted before entering a cell, so that the detection message of the equipment end cannot normally reach a service end, and meanwhile, the message of the service end is also intercepted when reaching the home of a user, so that the connection of the user is unstable; in addition, there is also network packet attack, and the upper level device may not be protected or is not protected properly, and discarding the normal detection packet may also cause the network connection to be abnormal, so that the network device is disconnected from the upper level device.
In summary, the existing network connection detection method has the technical problems of unstable network connection of the network device and high operation and maintenance cost due to poor network detection accuracy.
Disclosure of Invention
The invention mainly aims to provide a method, a device, network equipment and a readable storage medium for detecting network connection, and aims to improve the network connection stability of the network equipment and save the network operation and maintenance cost by improving the network detection accuracy of the existing network connection detection mode.
In order to achieve the above object, the present invention provides a method for detecting a network connection, where the method for detecting a network connection is applied to a network device, the network device is connected to a target server, and the method for detecting a network connection includes:
sending a link detection request to the target server based on a preset set frequency;
when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal;
and assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
Optionally, the step of assembling a detection packet according to the network anomaly information corresponding to the network link state includes:
after determining the network abnormal information corresponding to the network link state, acquiring a historical domain name in a preset cache list;
and assembling a detection message based on the historical domain name, wherein the historical domain name refers to the domain name which is successfully detected at the historical moment.
Optionally, the step of assembling a detection packet based on the historical domain name includes:
after the domain name resolution server address corresponding to the historical domain name is obtained, the historical domain names are recombined into a complete data packet, wherein the number of the historical domain names is multiple;
and taking the complete data packet as the detection message.
Optionally, after obtaining the historical domain name in the preset cache list, the method further includes:
deleting the plurality of historical domain names from the cache list to obtain a deleted cache list, wherein the deleted cache list comprises other domain names except the plurality of historical domain names.
Optionally, the step of detecting the network connection between the network device and the target server according to the probe packet includes:
sending domain name tasks corresponding to the plurality of historical domain names in the detection message to the target server at the same time;
if a message result returned by the target server according to the detection message is received within second preset time, determining that the network connection between the network equipment and the target server is normal;
and if the message result returned by the target server according to the detection message is not received within second preset time, sending network detection information to the plurality of standby servers.
Optionally, after the step of sending the network probing information to a plurality of preset standby servers, the method further includes:
if a detection response returned by the standby server according to the network detection information is received within a third preset time, establishing connection with the standby server corresponding to the detection response;
if a detection response returned by the standby server according to the network detection information is not received within a third preset time, disconnecting the connection with the standby server;
and retransmitting the connection request to the target server to establish the connection between the network equipment and the target server, and returning to the step of executing the link detection request transmitted to the server based on the preset set frequency.
Optionally, after the step of sending a link detection request to the target server based on a preset set frequency, the method further includes:
when a response returned by the target server for the link detection request is received within a first preset time, determining that the network link state between the network equipment and the target server is normal;
and acquiring network normal information corresponding to the network link state, and maintaining the connection between the network equipment and the target server according to the network normal information and a preset keep-alive mechanism.
In addition, to achieve the above object, the present invention further provides a device for detecting network connection, including:
the sending module is used for sending a link detection request to the target server based on a preset set frequency;
the response module is used for determining that the network link state between the network equipment and the target server is abnormal when a response returned by the target server for the link detection request is not received within a first preset time;
and the detection module is used for assembling a detection message according to the network abnormal information corresponding to the network link state and detecting the network connection between the network equipment and the target server according to the detection message.
The functional modules of the device for detecting network connection implement the steps of the method for detecting network connection of the present invention as described above when running.
In addition, to achieve the above object, the present invention further provides a network device, which includes a memory, a processor, and a program for detecting network connection stored in the memory and operable on the processor, wherein the program for detecting network connection implements the steps of the method for detecting network connection when executed by the processor.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium having a program for detecting a network connection stored thereon, the program, when executed by a processor, implementing the steps of the above method for detecting a network connection.
The method for detecting the network connection is applied to the network equipment, and firstly, a link detection request is sent to the target server based on preset set frequency; when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal, then assembling a detection message according to network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
Different from the traditional network connection detection mode, the network equipment acquires the historical domain name in the preset cache list after determining the network abnormal information corresponding to the network link state, assembles the detection message based on the historical domain name, and then detects the network connection between the network equipment and the target server through the detection message, thereby effectively avoiding the technical problems that the network detection accuracy of the network connection between the network equipment and the target server is poor due to the restriction of the network environment (such as network message attack) in the existing network connection detection, so that the network detection accuracy of the network equipment is unstable and the operation and maintenance cost is high.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a method for detecting network connection according to the present invention;
FIG. 2 is a schematic flow chart of a request involved in an embodiment of the method for detecting network connection according to the present invention;
FIG. 3 is a schematic diagram of a device module for detecting network connection according to the present invention;
fig. 4 is a schematic structural diagram of a network device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
An embodiment of the present invention provides a method for detecting a network connection, and referring to fig. 1, fig. 1 is a schematic flow diagram of a first embodiment of the method for detecting a network connection according to the present invention.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application.
In this embodiment, the method for detecting network connection of the present invention is applied to a network device that detects a connection link between the network device and a target server, and includes:
step S10: sending a link detection request to the target server based on a preset set frequency;
in this embodiment, according to the connection between the network device and the target server, the network device transmits a link detection request to the target server based on a preset set frequency.
The network device is a dedicated hardware device for interconnecting nodes such as a server, a PC, and an application terminal to constitute an information communication network. The network devices may include information network devices, communication network devices, network security devices, etc., in other words, the network devices include, but are not limited to, optical modems, routers, gateway devices, etc.
The target Server includes, but is not limited to, a Domain Name Server (DNS Server), which may be understood as a Server that performs Domain Name (Domain Name) and IP address (IP address) conversion corresponding to the Domain Name (Domain Name), in other words, the DNS Server is also called a Domain Name system, and may be understood as software that translates a Domain Name into an IP address.
The link detection request may be understood as request information for automatically detecting whether a connection link between the network device and the target server is normal.
The set frequency may be understood as a frequency nested within a link detection protocol corresponding to the link detection request, e.g. nested in PPPoE dialing.
Step S20: when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal;
in this embodiment, according to the connection between the network device and the target server, the network device determines, within a first preset time, whether a response returned by the target server for the link detection request is received; and if a response returned by the target server to the link detection request is not received within the first preset time, determining that the network link state between the network equipment and the target server is abnormal.
It should be noted that the case that the network link state between the network device and the target server is abnormal may include the following cases: due to an external network, for example, a network packet attack may cause the target server to mistakenly discard a response returned to the link detection request, or cause a response returned by the target server for the link detection request to fail to reach the network device due to the setting of the target server, so that the network device cannot receive the response returned by the target server for the link detection request within the first preset time.
In this embodiment, if a response returned by the target server for the link detection request is not received within the first preset time, it is determined that the network link state between the network device and the target server is abnormal, which is to acquire network abnormal information corresponding to the network link state, and further detect the connection between the network device and the target server according to the network abnormal information.
Further, in another embodiment, according to the connection between the network device and the target server, the network device confirms whether a response returned by the target server for the link detection request is received within a first preset time; if a response returned by the target server for the link detection request is received within a first preset time, determining that the network link state between the network device and the target server is normal, acquiring network normal information corresponding to the network link state, and maintaining the connection between the network device and the server according to the network normal information and a preset keep-alive mechanism, so that the normal network connection between the network device and the server can be continuously maintained.
Step S30: and assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
In this embodiment, the network device includes a domain name resolution module and a detection module, and the network device acquires network anomaly information corresponding to a network link state and sends the network anomaly information to the domain name resolution module. At the moment, after the network abnormal information is received, a historical domain name in a preset cache list is obtained through a domain name resolution module, a detection message is assembled based on the historical domain name, and then the detection message is sent to a target server according to the connection between the network equipment and the target server. At this time, whether a detection response returned by the target server for the network detection information is received or not is confirmed within a second preset time through the detection module, so that the network connection between the network equipment and the target server is detected.
In this embodiment, the network device sends network anomaly information to the domain name resolution module, assembles a detection packet according to the network anomaly information through the domain name resolution module, and then sends the detection packet to the target server according to the connection between the network device and the server. At this time, whether a detection response returned by the target server according to the network detection information is received or not is confirmed by the detection module within the second preset time, so that the defect of unstable network connection existing in the conventional detection of network connection connectivity is effectively overcome, for example, connection such as DHCP, PPPoE dialing and the like is avoided, but the detection is not limited to the two types of detection, when the connection state between the network equipment and the target server is further detected, the network detection accuracy of the network equipment is effectively improved, the situation that the connection between the network equipment and the server is unstable due to unnecessary disconnection is reduced, the network connection stability of the network equipment and the user experience are further improved, and on the other hand, the maintenance cost of an operator is also saved.
In summary, the method for detecting network connection of the present invention is applied to a network device, and firstly, a link detection request is sent to a target server based on a preset frequency; when the response returned by the target server to the link detection request is not received within the first preset time, determining that the network link state between the network equipment and the target server is abnormal, then assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
Different from the traditional network connection detection mode, the network equipment acquires the historical domain name in the preset cache list after determining the network abnormal information corresponding to the network link state, assembles the detection message based on the historical domain name, and then detects the network connection between the network equipment and the target server through the detection message, thereby effectively avoiding the technical problems that the network detection accuracy of the network connection between the network equipment and the target server is poor due to the restriction of the network environment (such as network message attack) in the existing network connection detection, so that the network detection accuracy of the network equipment is unstable and the operation and maintenance cost is high.
Further, based on the first embodiment of the invention for detecting network connection, a second embodiment of the invention for detecting network connection is proposed.
In this embodiment, the step S30: and assembling a detection message according to the network abnormal information corresponding to the network link state, and further comprising the following implementation steps.
Step S301: after determining the network abnormal information corresponding to the network link state, acquiring a historical domain name in a preset cache list;
in this embodiment, after determining the network abnormal information corresponding to the network link state, the domain name resolution module of the network device is used to obtain the historical domain name in the preset cache list.
It should be noted that the number of the historical domain names is multiple, and the historical domain names refer to domain names which are successfully detected at historical time; in addition, the domain name resolution module may be expressed in the form of a DNS module, and the historical domain names may be expressed in the form of DNS cache domain names.
For example, after determining the network abnormal information corresponding to the network link state, the information that the network is not available (i.e., the network abnormal information) is sent to the domain name resolution module, and since the historical domain name can be understood as the domain name that the network device can successfully access at the historical time when the network is normally connected, that is, the website corresponding to the historical domain name can be normally displayed through the human-computer interaction window of the network device, and one historical domain name corresponds to one website. At this time, a plurality of historical domain names are randomly acquired in a preset cache list through the domain name resolution module, so that the phenomenon that a network link between the network equipment and the target server is judged by mistake when a website corresponding to a new domain name (namely, a non-historical domain name) is closed is eliminated, and the accuracy of network detection and inspection of the network equipment is further improved.
Step S302: assembling a detection message based on the historical domain name, wherein the historical domain name refers to a domain name which is successfully detected at a historical moment;
in this embodiment, the network device first obtains the domain name resolution server addresses corresponding to the historical domain names through the domain name resolution module, then recombines the historical domain names into a complete data packet through the domain name resolution module, and uses the complete data packet as a detection message.
Further, in other possible embodiments, the step S302: the method for assembling the detection message based on the historical domain name can further comprise the following implementation steps.
Step S3021: after the domain name resolution server address corresponding to the historical domain name is obtained, the historical domain names are recombined into a complete data packet, wherein the number of the historical domain names is multiple;
in this embodiment, the network device first obtains a domain name resolution server address corresponding to a historical domain name through a domain name resolution module, where each historical domain name corresponds to a domain name resolution server address, and then recombines a plurality of historical domain names into a complete data packet through the domain name resolution module.
Step S3022: and taking the complete data packet as the detection message.
In this embodiment, the domain name resolution module of the network device uses the complete data packet as a detection packet.
Further, in some possible embodiments, in the step S301: after obtaining the historical domain name in the preset cache list, the method for detecting network connection may further include the following implementation steps.
Step A10: deleting the plurality of historical domain names from the cache list to obtain a deleted cache list, wherein the deleted cache list comprises other domain names except the plurality of historical domain names. .
In this embodiment, the domain name resolution module deletes the plurality of historical domain names from the preset cache list, so as to obtain a deleted cache list, where the deleted cache list includes other domain names except the plurality of historical domain names.
It should be noted that the plurality of historical domain names may be understood as domain names that are resolved by the domain name resolution module, that is, each historical domain name corresponds to a domain name resolution server address. If the plurality of historical domain names are not deleted from the preset cache list, the cache list has domain name resolution server addresses corresponding to the historical domain names acquired by the domain name resolution module, and then the network device can directly initiate access to the domain name resolution server addresses in the domain name resolution module through the detection module.
Further, in some possible embodiments, the step S30: detecting the network connection between the network device and the target server according to the probe packet, which may further include the following implementation steps.
Step S303: sending domain name tasks corresponding to the plurality of historical domain names in the detection message to the target server at the same time;
in this embodiment, according to the connection between the network device and the server, the domain name tasks corresponding to the plurality of historical domain names in the detection message are simultaneously sent to the target server through the detection module of the network device.
Step S304: if a message result returned by the target server according to the detection message is received within a second preset time, determining that the network connection between the network equipment and the target server is normal;
in this embodiment, according to the connection between the network device and the server, a detection module of the network device determines whether a message result returned by the target server according to the detection message is within a second preset time; if the message result is received within the second preset time, the network connection between the network equipment and the target server is normal, in other words, at the moment, the network equipment and the target server are normally connected without disconnection, so that the user can be ensured to normally surf the internet.
It should be noted that the result of the end of message may be understood as a response of the target server to any one of the domain name tasks.
The second preset time can be understood as the time specified by a plurality of parallel domain name tasks, and can be customized according to the requirement of a user.
Further, in another embodiment, according to the connection between the network device and the server, when the server can obtain the message result within the second preset time, other domain name tasks performed synchronously are released in time, so that the network occupancy rate is effectively reduced. And simultaneously, the server sends the message result to a detection module of the network equipment.
Step S305: and if the message result returned by the target server according to the detection message is not received within second preset time, sending network detection information to the plurality of standby servers.
In this embodiment, if the message result is not received within the second preset time, the network detection information is sent to the plurality of standby servers through the detection module of the network device.
It should be noted that the network probing information may be understood as a link connection request sent to a plurality of preset standby servers through the probing module.
For example, 2s does not receive the message result returned by the target server according to the detection message, and the network device may send network detection information to a plurality of standby servers, so as to increase the reliability of network inspection.
In this embodiment, sending network probe information to multiple standby servers through a probe module of a network device is used to optimize connection between the network device and a target server, for example, the target server may also receive an attack or cannot perform normal network connection with the network device due to other reasons.
Further, in other possible embodiments, in the step S305: the method of detecting a network connection may further include the following implementation steps after the step of sending network probe information to the plurality of standby servers.
Step B10: if a detection response returned by the standby server according to the network detection information is received within a third preset time, establishing connection with the standby server corresponding to the detection response;
in this embodiment, the network device determines, by the detection module, whether a detection response returned by any one of the plurality of standby servers according to the network detection information is received within a third preset time; if a detection response returned by any one of the standby servers according to the network detection information is received within the third preset time, the network device establishes connection with the standby server corresponding to the detection response, that is, the network device and the standby server corresponding to the detection response can perform normal network connection, so that the use experience of a user and the maintenance cost of an operator are further improved, and the use environment of a network is improved.
Step B20: if a detection response returned by the standby server according to the network detection information is not received within a third preset time, disconnecting the connection with the standby server;
in this embodiment, if the detection module does not receive the detection response returned by each standby server according to the network detection information within the third preset time, the network device disconnects the connection with the standby server.
In another embodiment, referring to fig. 2, fig. 2 is a schematic diagram of a request flow related to an embodiment of the method for detecting a network connection according to the present invention. Step B20: disconnecting the connection with the standby server may further include the following implementation steps.
In this embodiment, when the network device sends the network probe information to the standby servers for 3 times continuously through the probe module, and no probe response returned by each standby server according to the network probe information is received within the third preset time, the network device will execute a step of disconnecting the connection with the target server.
Step B30: and re-sending a connection request to the target server to establish the connection between the network equipment and the target server, and returning to execute the step of sending a link detection request to the target server based on the preset set frequency.
In this embodiment, the network device will resend the connection request to the target server to establish the connection between the network device and the target server, and return to the step of sending the link detection request to the target server based on the preset set frequency.
Further, in some possible embodiments, in the step S10: after the step of sending the link detection request to the target server based on the preset set frequency, the method of detecting network connection may further include the following implementation steps.
Step C10: when a response returned by the server for the link detection request is received within a first preset time, determining that the network link state between the network equipment and the target server is normal;
in this embodiment, according to the connection between the network device and the server, the network device determines whether a response returned by the server for the link detection request is received within a first preset time; and if a response returned by the server for the link detection request is received within the first preset time, determining that the network link state between the network equipment and the server is normal.
Step C20: and acquiring network normal information corresponding to the network link state, and maintaining the connection between the network equipment and the target server according to the network normal information and a preset keep-alive mechanism.
In this embodiment, the network device obtains the network normal information corresponding to the network link state, and maintains the connection between the network device and the target server according to the network normal information and the preset keep-alive mechanism, thereby improving the network connection stability of the network device.
Furthermore, the invention also provides a device for detecting network connection. Referring to fig. 3, fig. 3 is a schematic diagram of a device module for detecting network connection according to the present invention.
The device for detecting network connection of the invention comprises:
a sending module H01, configured to send a link detection request to the target server based on a preset set frequency;
a response module H02, configured to determine that a network link state between the network device and the target server is abnormal when a response returned by the target server for the link detection request is not received within a first preset time;
and the detection module H03 is used for assembling a detection message according to the network abnormal information corresponding to the network link state and detecting the network connection between the network equipment and the target server according to the detection message.
Optionally, the detecting module H03 may further include:
the acquisition unit is used for acquiring a historical domain name in a preset cache list after determining network abnormal information corresponding to the network link state;
and the assembling unit is used for assembling the detection message based on the historical domain name, wherein the historical domain name refers to the domain name which is successfully detected at the historical moment.
Optionally, the detection module H03 may further include:
the combination unit is used for recombining the historical domain names into a complete data packet after acquiring the domain name resolution server addresses corresponding to the historical domain names, wherein the number of the historical domain names is multiple;
and the detection message determining unit is used for taking the complete data packet as the detection message.
Optionally, the detection module H03 may further include:
and the deleting unit is used for deleting the historical domain names from the cache list to obtain a deleted cache list, wherein the deleted cache list comprises other domain names except the historical domain names.
Optionally, the detection module H03 may further include:
a parallel sending unit, configured to send domain name tasks corresponding to the multiple historical domain names in the detection packet to the target server at the same time;
the first receiving unit is used for determining that the network connection between the network equipment and the target server is normal if a message result returned by the target server according to the detection message is received within second preset time;
and the detection information sending unit is used for sending network detection information to the plurality of standby servers if the message result returned by the target server according to the detection message is not received within second preset time.
Optionally, the detecting module H03 may further include:
the first connection unit is used for establishing connection with the standby server corresponding to the detection response if the detection response returned by the standby server according to the network detection information is received within a third preset time;
a disconnection unit, configured to disconnect the target server if a detection response returned by the standby server according to the network detection information is not received within a third preset time;
and a returning unit, configured to resend the connection request to the target server to establish a connection between the network device and the target server, and return to the step of executing the link detection request sent to the server based on the preset set frequency.
Optionally, the sending module H01 may further include:
a link state determining unit, configured to determine that a network link state between the network device and the target server is normal when a response returned by the target server for the link detection request is received within a first preset time;
and the maintaining unit is used for acquiring network normal information corresponding to the network link state and maintaining the connection between the network equipment and the target server according to the network normal information and a preset keep-alive mechanism.
The functional modules of the device for detecting network connection implement the steps of the method for detecting network connection of the present invention as described above when running.
In addition, the invention also provides network equipment. Referring to fig. 4, fig. 4 is a schematic structural diagram of a network device according to an embodiment of the present invention. The network device according to the embodiment of the present invention may specifically be a device for detecting network connection for local operation.
As shown in fig. 4, a network device according to an embodiment of the present invention may include: a processor 1001, e.g. a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005 and a perception unit 1006. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a Wi-Fi interface).
A memory 1005 is provided on the network device body, and the memory 1005 stores a program that realizes corresponding operations when executed by the processor 1001. The memory 1005 is also used to store parameters for use by the network device. The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the network device configuration shown in fig. 4 does not constitute a limitation of network devices and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 4, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a program of a network device, which detects a network connection.
In the network device shown in fig. 4, the processor 1001 may be configured to call a program of the network device stored in the memory 1005 to detect a network connection, and perform the following operations:
sending a link detection request to the target server based on a preset set frequency;
when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal;
and assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
after determining the network abnormal information corresponding to the network link state, acquiring a historical domain name in a preset cache list;
and assembling a detection message based on the historical domain name, wherein the historical domain name refers to the domain name which is successfully detected at the historical moment.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
after the domain name resolution server address corresponding to the historical domain name is obtained, the historical domain names are recombined into a complete data packet, wherein the number of the historical domain names is multiple;
and taking the complete data packet as the detection message.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
deleting the plurality of historical domain names from the cache list to obtain a deleted cache list, wherein the deleted cache list comprises other domain names except the plurality of historical domain names.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
sending domain name tasks corresponding to the plurality of historical domain names in the detection message to the target server at the same time;
if a message result returned by the target server according to the detection message is received within second preset time, determining that the network connection between the network equipment and the target server is normal;
and if the message result returned by the target server according to the detection message is not received within second preset time, sending network detection information to the plurality of standby servers.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
if a detection response returned by the standby server according to the network detection information is received within a third preset time, establishing connection with the standby server corresponding to the detection response;
if a detection response returned by the standby server according to the network detection information is not received within a third preset time, disconnecting the target server from the standby server;
and re-sending a connection request to the target server to establish the connection between the network equipment and the target server, and returning to execute the step of sending a link detection request to the server based on the preset set frequency.
The processor 1001 may be configured to invoke a program of the network device stored in the memory 1005 to detect a network connection and perform the following operations:
when a response returned by the target server for the link detection request is received within a first preset time, determining that the network link state between the network equipment and the target server is normal;
and acquiring network normal information corresponding to the network link state, and maintaining the connection between the network equipment and the target server according to the network normal information and a preset keep-alive mechanism.
In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, please refer to fig. 5, where fig. 5 is a schematic structural diagram of the computer-readable storage medium according to an embodiment of the present invention. The computer readable storage medium has stored thereon a program for detecting a network connection, which when executed by a processor implements the steps of the method for detecting a network connection described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or system comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. With this understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a network device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for detecting network connection, wherein the method for detecting network connection is applied to a network device, the network device is connected with a target server, and the method for detecting network connection comprises:
sending a link detection request to the target server based on a preset set frequency;
when a response returned by the target server for the link detection request is not received within a first preset time, determining that the network link state between the network equipment and the target server is abnormal;
and assembling a detection message according to the network abnormal information corresponding to the network link state, and detecting the network connection between the network equipment and the target server according to the detection message.
2. The method for detecting network connection according to claim 1, wherein the step of assembling the probe packet according to the network anomaly information corresponding to the network link status comprises:
after determining the network abnormal information corresponding to the network link state, acquiring a historical domain name in a preset cache list;
and assembling a detection message based on the historical domain name, wherein the historical domain name refers to the domain name which is successfully detected at the historical moment.
3. The method for detecting network connectivity according to claim 2, wherein the step of assembling a probe packet based on the historical domain name comprises:
after the domain name resolution server address corresponding to the historical domain name is obtained, the historical domain names are recombined into a complete data packet, wherein the number of the historical domain names is multiple;
and taking the complete data packet as the detection message.
4. The method for detecting network connection according to claim 3, wherein after obtaining the historical domain name in the preset cache list, the method further comprises:
deleting the plurality of historical domain names from the cache list to obtain a deleted cache list, wherein the deleted cache list comprises other domain names except the plurality of historical domain names.
5. The method according to claim 3, wherein the step of detecting the network connection between the network device and the target server according to the probe packet comprises:
sending domain name tasks corresponding to the plurality of historical domain names in the detection message to the target server at the same time;
if a message result returned by the target server according to the detection message is received within second preset time, determining that the network connection between the network equipment and the target server is normal;
and if the message result returned by the target server according to the detection message is not received within second preset time, sending network detection information to the plurality of standby servers.
6. The method for detecting a network connection of claim 5, wherein after the step of sending network probe information to a plurality of standby servers, the method further comprises:
if a detection response returned by the standby server according to the network detection information is received within a third preset time, establishing connection with the standby server corresponding to the detection response;
if the detection response returned by the standby server according to the network detection information is not received within third preset time, disconnecting the target server;
and retransmitting the connection request to the target server to establish the connection between the network equipment and the target server, and returning to the step of executing the link detection request transmitted to the server based on the preset set frequency.
7. The method for detecting network connection according to claim 1, wherein after the step of transmitting a link detection request to the target server based on a preset set frequency, the method further comprises:
when a response returned by the target server for the link detection request is received within a first preset time, determining that the network link state between the network equipment and the target server is normal;
and acquiring network normal information corresponding to the network link state, and maintaining the connection between the network equipment and the target server according to the network normal information and a preset keep-alive mechanism.
8. An apparatus for detecting a network connection, the apparatus comprising:
the sending module is used for sending a link detection request to the target server based on a preset set frequency;
the response module is used for determining that the network link state between the network equipment and the target server is abnormal when a response returned by the target server for the link detection request is not received within a first preset time;
and the detection module is used for assembling a detection message according to the network abnormal information corresponding to the network link state and detecting the network connection between the network equipment and the target server according to the detection message.
9. A network device comprising a memory, a processor and a program for detecting network connections stored on the memory and executable on the processor, wherein the processor implements the steps of the method for detecting network connections according to any one of claims 1 to 7 when executing the program for detecting network connections.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a program for detecting a network connection, which when executed by a processor implements the steps of the method for detecting a network connection according to any one of claims 1 to 7.
CN202211659677.7A 2022-12-22 2022-12-22 Method, device, network equipment and readable storage medium for detecting network connection Pending CN115941541A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211659677.7A CN115941541A (en) 2022-12-22 2022-12-22 Method, device, network equipment and readable storage medium for detecting network connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211659677.7A CN115941541A (en) 2022-12-22 2022-12-22 Method, device, network equipment and readable storage medium for detecting network connection

Publications (1)

Publication Number Publication Date
CN115941541A true CN115941541A (en) 2023-04-07

Family

ID=86557460

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211659677.7A Pending CN115941541A (en) 2022-12-22 2022-12-22 Method, device, network equipment and readable storage medium for detecting network connection

Country Status (1)

Country Link
CN (1) CN115941541A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117354196A (en) * 2023-12-06 2024-01-05 广州通则康威科技股份有限公司 Link detection method and device based on network interface

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117354196A (en) * 2023-12-06 2024-01-05 广州通则康威科技股份有限公司 Link detection method and device based on network interface
CN117354196B (en) * 2023-12-06 2024-03-12 广州通则康威科技股份有限公司 Link detection method and device based on network interface

Similar Documents

Publication Publication Date Title
US10771396B2 (en) Communications network failure detection and remediation
US11171875B2 (en) Systems and methods of communications network failure detection and remediation utilizing link probes
US8667339B2 (en) Internet server apparatus and program causing a server apparatus to implement functions of preparation processing for direct connection of an appliance in a private network and a mobile terminal outside the private network
US20230344734A1 (en) Wireless Network Delay Processing Method and System, and Access Server
US8086732B1 (en) Method and apparatus for rate limiting client requests
CN110839046B (en) Multi-protocol intercommunication method and system
JP2005287045A (en) Method for discovery of device connected to ip network and device to carry out the method
CN108471369B (en) Network dialing method, device and storage medium
CN111130902B (en) Switch management method, device and storage medium
EP3682595B1 (en) Obtaining local area network diagnostic test results
CN115941541A (en) Method, device, network equipment and readable storage medium for detecting network connection
EP2890087B1 (en) System for notifying subscriber devices in ISP networks
CN107707689A (en) A kind of DHCP message processing method, Dynamic Host Configuration Protocol server and gateway device
US20080180524A1 (en) Remote monitoring control method of network camera
CN107517248B (en) Network connection method and device based on SDK
JP5084782B2 (en) Apparatus, method, and program for detecting a repeater
US9379939B2 (en) Self troubleshooting home router
CN111049741B (en) Method for improving communication reliability, communication system and terminal equipment
JP2004310194A (en) Method for checking condition of network and terminal device
CN104954187A (en) Method and device for determining state of CPE (customer premise equipment)
CN107968845B (en) DHCP server state detection method and device and DHCP relay
JP2001282656A (en) Unit and method for network device control
US11799840B2 (en) Failure detection device, failure detection method, and failure detection program
TWI816176B (en) Method and apparatus for performing internet reachability management with aid of indicator
CN116708285A (en) Network management method, device and system

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