CN111106983A - Method and device for detecting network connectivity - Google Patents

Method and device for detecting network connectivity Download PDF

Info

Publication number
CN111106983A
CN111106983A CN201911379330.5A CN201911379330A CN111106983A CN 111106983 A CN111106983 A CN 111106983A CN 201911379330 A CN201911379330 A CN 201911379330A CN 111106983 A CN111106983 A CN 111106983A
Authority
CN
China
Prior art keywords
public network
network server
access request
terminal equipment
specified access
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.)
Granted
Application number
CN201911379330.5A
Other languages
Chinese (zh)
Other versions
CN111106983B (en
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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201911379330.5A priority Critical patent/CN111106983B/en
Publication of CN111106983A publication Critical patent/CN111106983A/en
Application granted granted Critical
Publication of CN111106983B publication Critical patent/CN111106983B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method and a device for detecting network connectivity. In the application, the terminal equipment acquires the detection script from the logged forwarding equipment and sends a specified access request capable of accessing across domains to the public network server according to the detection script. Therefore, if the terminal equipment receives the response message of the specified access request within the preset time length, the terminal equipment is determined to be communicated with the public network server network; and if the response message of the specified access request is not received within the preset time length, determining that the network is not communicated with the public network server. Therefore, in the application, the terminal device can directly interact with the public network server according to the detection script of the forwarding device, the network connectivity of the terminal device and the public network server is determined according to whether the interaction is successful, and compared with the method for determining the network connectivity of the terminal device and the public network server by detecting the network connectivity of the forwarding device and the public network server, the detection result of the method is more accurate.

Description

Method and device for detecting network connectivity
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for detecting network connectivity.
Background
In a conventional network communication system, a terminal device is generally connected to a public network through a forwarding device. In order to detect the network connectivity between the terminal device and the public network server, the network connectivity between the forwarding device connected to the terminal device and the public network server is usually checked. Specifically, the forwarding device sends an ICMP request to the public network server, and determines the network connectivity between the forwarding device and the public network server according to whether an ICMP response is received. The method considers that the network connectivity of the forwarding equipment and the public network server is consistent with that of the terminal equipment, so that the detection result of the forwarding equipment is taken as the detection result of the terminal equipment.
In an actual network environment, however, the network connectivity of the forwarding device and the terminal device may not be consistent. For example, the terminal device may have multiple network cards, where a first network card is connected to the public network through the forwarding device, and a second network card is connected to the public network through the mobile network. In this case, if the forwarding device is not connected to the public network, the method may determine that the terminal device is not connected to the public network. In fact, the terminal device may communicate with the public network through the second network card. Obviously, the above detection result is erroneous.
Therefore, the method is used for detecting that the network connectivity of the terminal equipment and the public network is inaccurate.
Disclosure of Invention
In view of the above technical problems, the present application provides a method and an apparatus for detecting network connectivity, which can detect whether a network of a terminal device and a public network server is connected.
According to a first aspect of the present application, there is provided a method for detecting network connectivity, the method being applied to a terminal device, and the method including:
acquiring a detection script from a forwarding device logged in by the device; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server;
sending a specified access request which can be accessed in a cross-domain mode to a public network server based on the information indicated by the detection script;
if a response message of the specified access request returned by the public network server is received within a preset time length, determining that the terminal equipment is in network communication with the public network server;
and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
According to a second aspect of the present application, there is provided another method for detecting network connectivity, the method being applied to a forwarding device, and the method including:
sending a detection script to the terminal equipment logging in the forwarding equipment;
the detection script is used for indicating the terminal equipment to send a specified access request capable of accessing across domains to a public network server so that the terminal equipment sends the specified access request capable of accessing across domains to the public network server based on information indicated by the detection script, and if a response message of the specified access request returned by the public network server is received within a preset time, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
According to a third aspect of the present application, there is provided an apparatus for detecting network connectivity, the apparatus being applied to a terminal device, and the apparatus comprising:
the script acquisition unit is used for acquiring a detection script from the forwarding equipment logged in by the equipment; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server;
a request sending unit, configured to send a specified access request accessible across domains to a public network server based on the information indicated by the detection script;
the first determining unit is used for determining that the terminal equipment is in network communication with the public network server if a response message of the specified access request returned by the public network server is received within a preset time length;
and the second determining unit is used for determining that the terminal equipment is not communicated with the public network server network if the response message of the specified access request returned by the public network server is not received within the preset time length.
According to a fourth aspect of the present application, there is provided another apparatus for detecting network connectivity, the apparatus being applied to a forwarding device, and the apparatus including:
a script sending unit, configured to send a detection script to a terminal device that logs in the forwarding device;
the detection script is used for indicating the terminal equipment to send a specified access request capable of accessing across domains to a public network server so that the terminal equipment sends the specified access request capable of accessing across domains to the public network server based on information indicated by the detection script, and if a response message of the specified access request returned by the public network server is received within a preset time, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
In the application, the terminal equipment acquires the detection script from the logged forwarding equipment and sends a specified access request capable of accessing across domains to the public network server according to the detection script. Therefore, if the terminal equipment receives the response message of the specified access request returned by the public network server within the preset time length, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the public network server is not communicated with the network.
Therefore, in the application, the terminal device can directly interact with the public network server according to the detection script of the forwarding device, the network connectivity of the terminal device and the public network server is determined according to whether the interaction is successful, and compared with the method for determining the network connectivity of the terminal device and the public network server by detecting the network connectivity of the forwarding device and the public network server, the detection result of the method is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
Fig. 1 is a schematic diagram of an application scenario shown in an exemplary embodiment of the present application;
FIG. 2 is a flow chart illustrating a method for detecting network connectivity in accordance with an exemplary embodiment of the present application;
FIG. 3 is an interaction diagram illustrating a method for detecting network connectivity in accordance with an exemplary embodiment of the present application;
fig. 4 is a hardware structure diagram of a terminal device according to an exemplary embodiment of the present application;
FIG. 5 is a diagram illustrating an apparatus and method for detecting network connectivity according to an exemplary embodiment of the present application;
fig. 6 is a hardware structure diagram of a forwarding device according to an exemplary embodiment of the present application;
fig. 7 is a diagram illustrating another method for detecting network connectivity according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like 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. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario shown in an exemplary embodiment of the present application, where a network communication system shown in the figure includes a terminal device, a forwarding device, and a public network server, where the forwarding device may be a router, a switch, or an internet behavior management device, and the forwarding device may manage multiple terminal devices in a private network, and only a terminal device 1 and a terminal device 2 are shown in fig. 1 as an example.
In the network communication system shown in fig. 1, the terminal device and the forwarding device are both located in a private network, and the networks are interconnected, and the public network server is located in a public network. In an alternative embodiment, the devices in the private network communicate with the public network through the forwarding devices shown in the figure, or the devices in the private network communicate with the public network through other forwarding devices not shown in the figure; in another alternative embodiment, the devices in the private network are not connected to the public network. In order to detect the network connectivity between the terminal device in the private network and the public network server, the network connectivity between the forwarding device and the public network server is usually detected first, and the detection result is used as the network connectivity between the terminal device and the public network.
Specifically, the forwarding device sends an ICMP request to the public network server, and if an ICMP response returned by the public network server is received, it is determined that the forwarding device is communicated with the public network, so that it is determined that the terminal device is communicated with the public network; and if the ICMP response returned by the public network server is not received, determining that the forwarding equipment is not communicated with the public network, and determining that the terminal equipment is not communicated with the public network.
However, in the case of a terminal device with multiple network cards, the detection result may not be accurate.
For example, the terminal device 1 in fig. 1 is a multi-network card, where a first network card of the terminal device 1 is connected to a public network through a forwarding device, and a second network card is connected to the public network through a mobile network. In the case that the terminal device 1 has multiple network cards, if the forwarding device is not connected to the public network, the detection is performed according to the above method, so that it can be determined that the terminal device 1 is not connected to the public network. In fact, the detection method can only determine that the first network card of the terminal device 1 is not communicated with the public network, but cannot determine the network connectivity between the second network card of the terminal device 1 and the public network, so that the detection result of the network connectivity of the terminal device 1 is inaccurate.
In view of the above, the present application provides a method for detecting network connectivity. The method enables the terminal equipment to send the specified access request capable of accessing across domains to the public network server, and the terminal equipment can automatically select the network card interacting with the public network server according to the routing strategy. Therefore, if the terminal equipment receives a response message of a specified access request returned by the public network server within a preset time length, the terminal equipment is determined to be in network communication with the public network server; and if the terminal equipment does not receive a response message of the specified access request returned by the public network server within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for detecting network connectivity according to an exemplary embodiment of the present application, where the method is applied to a terminal device.
As shown in fig. 2, the method comprises the following steps:
step S201: the terminal equipment acquires a detection script from the forwarding equipment logged in by the equipment; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server.
In the application, the terminal device first initiates a request for accessing the login page of the forwarding device to the forwarding device through the browser or the client, and then based on the login page returned by the forwarding device, the terminal device can be triggered to acquire the detection script from the forwarding device in at least the following two ways.
The first method is as follows: and triggering the terminal equipment to acquire the detection script from the forwarding equipment by the instruction of the user to the login page. Specifically, the terminal device displays a login page returned by the forwarding device, where the login page includes a pre-deployed option for network connectivity detection, and if it is detected that the user triggers the network connectivity detection option, the terminal device sends a request for obtaining a detection script to the forwarding device, so that the forwarding device returns the detection script after receiving the request.
For example, the network connectivity check option may be an option that displays the word "network check" and is selected by the user by mouse clicking.
The second method comprises the following steps: and the terminal equipment automatically triggers to acquire the detection script from the forwarding equipment. Specifically, the terminal device initiates a request for accessing a login page of the forwarding device through a browser and the like, and when receiving the login page returned by the forwarding device, the terminal device not only displays the login page, but also automatically sends a request for acquiring a detection script to the forwarding device, so that the forwarding device returns the detection script after receiving the request.
Step S202: and the terminal equipment sends a specified access request which can be accessed across domains to the public network server based on the information indicated by the detection script.
The detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to the public network server. Optionally, the detection script may include an address of the public network server, a resource identification of the request, and an access request template.
First, the terminal device constructs a URL for accessing the public network server based on the address of the public network server and the requested resource identifier.
The address of the public network server can be the IP address or the domain name address of the public network server; the requested resource identification may be a parameter sent by the terminal device to the public network server for querying the requested resource.
For example, assuming that the address of the public network server is abc.com, the resource identifier requested by the terminal device is callback ═ jqueryanwork, and the resource identifier indicates that the public network server is requested for information about the network card usage rate of the public network server, then the URL constructed by the terminal device may be http:// abc.com/? callback ═ jQueryNetwork.
Then, the terminal device constructs a specified access request which can be accessed across domains based on the access request template.
The access request template may be a format template supporting cross-domain access requests, such as a JSONP format template.
And finally, the terminal equipment sends the specified access request to the public network server according to the URL.
It should be understood that, when the terminal device sends the specified access request to the public network server, the specified access request may be forwarded through a registered forwarding device, may also be forwarded through another forwarding device, or forwarded through a wireless network card, which is determined by a network environment where the terminal device is located and a routing policy of the terminal device, and is not limited specifically here.
Step S203: if the terminal equipment receives a response message of the specified access request returned by the public network server within a preset time length, determining that the terminal equipment is in network communication with the public network server;
step S204: and if the terminal equipment does not receive the response message of the specified access request returned by the public network server within the preset time length, determining that the network of the terminal equipment is not communicated with the public network server.
If the public network server receives the specified access request sent by the terminal device in step S202, a response message of the specified access request is returned to the terminal device. For example, if the identifier carried in the specified access request of the terminal device indicates that the network card usage rate of the public network server is queried, the public network server returns the network card usage rate of itself in the response message.
The terminal device presets an overtime duration, such as 5s, 10s and the like, and starts timing after sending the specified access request, if the terminal device receives a response message of the specified access request within the overtime duration, the terminal device is determined to be communicated with the public network server network; otherwise, if the terminal equipment does not receive the response message of receiving the specified access request within the timeout duration, determining that the terminal equipment is not communicated with the public network server network.
Thus, the flow shown in fig. 2 is completed.
In the application, the terminal equipment acquires the detection script from the logged forwarding equipment and sends a specified access request capable of accessing across domains to the public network server according to the detection script. Therefore, if the terminal equipment receives the response message of the specified access request returned by the public network server within the preset time length, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the public network server is not communicated with the network.
Therefore, in the application, the terminal device can directly interact with the public network server according to the detection script of the forwarding device, the network connectivity of the terminal device and the public network server is determined according to whether the interaction is successful, and compared with the method for determining the network connectivity of the terminal device and the public network server by detecting the network connectivity of the forwarding device and the public network server, the detection result of the method is more accurate.
In addition, other pages can be embedded into the login page of the forwarding device to display the detection result.
Optionally, the specified access request sent by the terminal device to the public network server may be a request in JSONP format.
If the terminal equipment is communicated with the public network server network, the public network server returns a corresponding response message in the JSONP format after receiving the JSONP request, and therefore the terminal equipment is embedded into the first page on the login page of the forwarding equipment when receiving the response message.
The first page is used for indicating the terminal equipment to be in network communication with a public network server. Alternatively, the first page may only show information of network connectivity, such as a hint page with the word "network connectivity" displayed; the first page may also show the content in the response message, for example, when the current network card usage rate of the public network server returned in the response message is higher, the first page is a prompt page including the network card usage rate.
And if the terminal equipment is not communicated with the public network server network, the public network server does not receive the request, so that the terminal equipment is embedded into the second page on the login page when the preset time length is over.
The second page is used for indicating that the terminal device is not connected with the public network server network, for example, the second page may be a prompt page with a "network connection" word displayed.
It can be understood that the JSONP request is a request for supporting cross-domain access, and in the case that the address of the public network server is different from the address of the login page of the forwarding device, the response message of the JSONP request returned by the public network server is not intercepted by the browser on the terminal device, so that the terminal device can receive the response message returned by the public network server as long as the terminal device is in network communication with the public network server.
A specific embodiment for implementing the method of the present application is described below by an interaction diagram shown in fig. 3.
As shown in fig. 3, the steps are as follows:
step S301: the terminal device accesses the login page of the forwarding device through the browser.
Step S302: when detecting that a user triggers an option for network connectivity detection deployed on a login page, the terminal device sends a request for acquiring a detection script to the logged forwarding device.
Step S303: after receiving the request for obtaining the detection script, the forwarding device sends the detection script containing the public network server address, the requested resource identifier and the access request template to the terminal device.
Step S304: and the terminal equipment constructs a request URL according to the public network server address in the detection script and the requested resource identifier, and constructs a request in a JSONP format based on the request template.
Then, the terminal device sends a JSONP request to the public network server indicated by the URL to request the resource indicated by the resource identifier.
In one case, the public network server receives the JSONP request, and then step S305 is executed.
Step S305: and after receiving the JSONP request, the public network server returns a response message of the JSONP request, wherein the response message carries the resource indicated by the resource identifier.
Step S306: and if the terminal equipment receives a response message returned by the public network server within a preset time length, determining that the terminal equipment is in network communication with the public network server, and simultaneously embedding a first page containing a network communication character into the login page by the terminal equipment.
Alternatively, if the public network server cannot receive the JSONP request, step S307 (not shown in the figure) is executed.
Step S307: and if the terminal equipment does not receive the response message returned by the public network server within the preset time length, determining that the terminal equipment is not communicated with the public network server network, and simultaneously embedding a second page containing the word of 'network not communicated' into the login page by the terminal equipment.
The flow shown in fig. 3 is completed.
The reason for the "cross-domain access request" is used in this application is described below:
generally, when a terminal device accesses a login page of a forwarding device, the terminal device may send an access request to a public network server through technologies such as Ajax (Asynchronous Javascript and Xml ), and when a response message of the access request returned by the public network server is received, embed a resource carried by the response message into the original login page.
However, when the terminal device accesses the login page through the browser, the browser requires that the requested object (i.e., the access request to the public network server) is homologous with the currently accessed page (i.e., the login page), otherwise, the browser intercepts the response message corresponding to the request. In the application, the request sent to the public network server and the login page of the forwarding device are not homologous, and if the traditional Ajax technology is used, the browser can intercept the response message, so that the detection result is incorrect.
For the above reasons, the present application proposes to use a specified access request that can be accessed across domains, so that no response message to the request, regardless of the request to the public network server, will be intercepted due to the same source policy of the browser.
Corresponding to the embodiment of the detection method of the illegal external connection equipment, the application also provides an embodiment of a device for detecting network connectivity.
The embodiment of the device for detecting network connectivity can be applied to terminal equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the terminal device where the device is located. From a hardware aspect, as shown in fig. 4, a hardware structure diagram of a terminal device where the network connectivity detection apparatus is located according to the present application is shown, where the terminal device where the apparatus is located in the embodiment may further include other hardware according to an actual function of the terminal device, in addition to the processor, the memory, the network output interface, and the nonvolatile memory shown in fig. 4, and details of this are not repeated.
Referring to fig. 5, fig. 5 is a block diagram of a detection apparatus for an illegal external connection device according to an exemplary embodiment of the present application. The device can be applied to a terminal device located in an intranet, and the device can include:
a script obtaining unit 501, configured to obtain a detection script from a forwarding device logged in by the device; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server;
a request sending unit 502, configured to send a specified access request accessible across domains to a public network server based on the information indicated by the detection script;
a first determining unit 503, configured to determine that the terminal device is in network communication with a public network server if a response message of the specified access request returned by the public network server is received within a preset time period;
a second determining unit 504, configured to determine that the terminal device is not in network communication with the public network server if a response message of the specified access request returned by the public network server is not received within a preset time period.
Optionally, the script obtaining unit includes:
a first obtaining subunit 505 (not shown in the figure), configured to, when detecting that a user triggers a network connectivity detection option deployed on a login page, obtain a detection script from a forwarding device logged in by the device; alternatively, the first and second electrodes may be,
a second obtaining subunit 506 (not shown in the figure), configured to, when receiving the login page returned by the forwarding device, obtain the detection script from the forwarding device logged in by the forwarding device;
the login page is used for indicating the terminal equipment to log in the forwarding equipment.
Optionally, the apparatus is further configured to:
when the terminal equipment is determined to be in network communication with a public network server, embedding a first page on the login page; the first page is used for indicating the terminal equipment to be in network communication with a public network server;
when the terminal equipment is determined to be not communicated with the public network server network, embedding a second page in the login page; and the second page is used for indicating that the terminal equipment is not communicated with the public network server network.
Optionally, the detection script includes an address of the public network server, a resource identifier of the request, and an access request template; the request sending unit includes:
a construction subunit 507 (not shown in the figure) for constructing a specified access request accessible across domains based on the access request template;
a sending subunit 508 (not shown in the figure) configured to construct a URL for accessing the public network server based on the address of the public network server and the requested resource identifier, and send the specified access request to the public network server based on the URL.
Thus, the block diagram of the apparatus shown in fig. 5 is completed.
The embodiment of the device for detecting network connectivity can be further applied to forwarding equipment. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a logical means, the apparatus is formed by reading, by a processor of a forwarding device in which the apparatus is located, corresponding computer program instructions in a non-volatile memory into an internal memory for execution. From a hardware aspect, as shown in fig. 6, for a hardware structure diagram of a forwarding device in which the apparatus for detecting network connectivity is located in the present application, except for the processor, the memory, the network output interface, and the nonvolatile memory shown in fig. 6, the forwarding device in which the apparatus is located in the embodiment may also include other hardware according to an actual function of the forwarding device, which is not described again.
Referring to fig. 7, fig. 7 is a block diagram of a detection apparatus for an illegal external connection device according to an exemplary embodiment of the present application. The device can be applied to a terminal device located in an intranet, and the device can include:
a script sending unit 701, configured to send a detection script to a terminal device that logs in the forwarding device;
the detection script is used for indicating the terminal equipment to send a specified access request capable of accessing across domains to a public network server so that the terminal equipment sends the specified access request capable of accessing across domains to the public network server based on information indicated by the detection script, and if a response message of the specified access request returned by the public network server is received within a preset time, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
Thus, the block diagram of the apparatus shown in fig. 7 is completed.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A method for detecting network connectivity, the method being applied to a terminal device, and the method comprising:
acquiring a detection script from a forwarding device logged in by the device; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server;
sending a specified access request which can be accessed in a cross-domain mode to a public network server based on the information indicated by the detection script;
if a response message of the specified access request returned by the public network server is received within a preset time length, determining that the terminal equipment is in network communication with the public network server;
and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
2. The method of claim 1, wherein the obtaining a detection script from a forwarding device logged in from the forwarding device comprises:
when detecting that a user triggers a network connectivity detection option deployed on a login page, acquiring a detection script from forwarding equipment logged in by the equipment; alternatively, the first and second electrodes may be,
when a login page returned by the forwarding equipment is received, acquiring a detection script from the forwarding equipment logged in by the equipment;
the login page is used for indicating the terminal equipment to log in the forwarding equipment.
3. The method of claim 2, wherein the specified access request is a JSONP request;
the method further comprises the following steps:
when the terminal equipment is determined to be in network communication with a public network server, embedding a first page on the login page; the first page is used for indicating the terminal equipment to be in network communication with a public network server;
when the terminal equipment is determined to be not communicated with the public network server network, embedding a second page in the login page; and the second page is used for indicating that the terminal equipment is not communicated with the public network server network.
4. The method of claim 1, wherein the detection script comprises an address of a public network server, a resource identifier of a request, and an access request template;
the sending of the specified access request accessible across domains to the public network server based on the information indicated by the detection script includes:
constructing a specified access request which can be accessed across domains based on the access request template;
and constructing a URL (uniform resource locator) for accessing the public network server based on the address of the public network server and the requested resource identifier, and sending the specified access request to the public network server based on the URL.
5. A method for detecting network connectivity, applied to a forwarding device, the method comprising:
sending a detection script to the terminal equipment logging in the forwarding equipment;
the detection script is used for indicating the terminal equipment to send a specified access request capable of accessing across domains to a public network server so that the terminal equipment sends the specified access request capable of accessing across domains to the public network server based on information indicated by the detection script, and if a response message of the specified access request returned by the public network server is received within a preset time, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
6. An apparatus for detecting network connectivity, the apparatus being applied to a terminal device, the apparatus comprising:
the script acquisition unit is used for acquiring a detection script from the forwarding equipment logged in by the equipment; the detection script is used for indicating the terminal equipment to send a specified access request which can be accessed in a cross-domain mode to a public network server;
a request sending unit, configured to send a specified access request accessible across domains to a public network server based on the information indicated by the detection script;
the first determining unit is used for determining that the terminal equipment is in network communication with the public network server if a response message of the specified access request returned by the public network server is received within a preset time length;
and the second determining unit is used for determining that the terminal equipment is not communicated with the public network server network if the response message of the specified access request returned by the public network server is not received within the preset time length.
7. The method of claim 1, wherein the script retrieving unit comprises:
the first obtaining subunit is used for obtaining a detection script from the forwarding equipment logged in by the equipment when detecting that a user triggers a network connectivity detection option deployed on a login page; alternatively, the first and second electrodes may be,
the second acquiring subunit is configured to acquire, when receiving the login page returned by the forwarding device, a detection script from the forwarding device logged in by the forwarding device;
the login page is used for indicating the terminal equipment to log in the forwarding equipment.
8. The method of claim 2, wherein the specified access request is a JSONP request;
the apparatus is further configured to:
when the terminal equipment is determined to be in network communication with a public network server, embedding a first page on the login page; the first page is used for indicating the terminal equipment to be in network communication with a public network server;
when the terminal equipment is determined to be not communicated with the public network server network, embedding a second page in the login page; and the second page is used for indicating that the terminal equipment is not communicated with the public network server network.
9. The method of claim 1, wherein the detection script comprises an address of a public network server, a resource identifier of a request, and an access request template;
the request sending unit includes:
the construction subunit is used for constructing a specified access request which can be accessed across domains based on the access request template;
and the sending subunit is used for constructing a URL (uniform resource locator) for accessing the public network server based on the address of the public network server and the requested resource identifier, and sending the specified access request to the public network server based on the URL.
10. An apparatus for detecting network connectivity, applied to a forwarding device, the apparatus comprising:
a script sending unit, configured to send a detection script to a terminal device that logs in the forwarding device;
the detection script is used for indicating the terminal equipment to send a specified access request capable of accessing across domains to a public network server so that the terminal equipment sends the specified access request capable of accessing across domains to the public network server based on information indicated by the detection script, and if a response message of the specified access request returned by the public network server is received within a preset time, the terminal equipment is determined to be in network communication with the public network server; and if the response message of the specified access request returned by the public network server is not received within the preset time length, determining that the terminal equipment is not communicated with the public network server network.
CN201911379330.5A 2019-12-27 2019-12-27 Method and device for detecting network connectivity Active CN111106983B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911379330.5A CN111106983B (en) 2019-12-27 2019-12-27 Method and device for detecting network connectivity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911379330.5A CN111106983B (en) 2019-12-27 2019-12-27 Method and device for detecting network connectivity

Publications (2)

Publication Number Publication Date
CN111106983A true CN111106983A (en) 2020-05-05
CN111106983B CN111106983B (en) 2021-09-21

Family

ID=70423841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911379330.5A Active CN111106983B (en) 2019-12-27 2019-12-27 Method and device for detecting network connectivity

Country Status (1)

Country Link
CN (1) CN111106983B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407383A (en) * 2021-06-30 2021-09-17 迈普通信技术股份有限公司 Main/standby system switching method and device, server and main/standby system
CN113747490A (en) * 2021-08-12 2021-12-03 Tcl通讯(宁波)有限公司 WIFI connectivity detection method and device, terminal equipment and storage medium
CN114629816A (en) * 2022-03-14 2022-06-14 京东科技信息技术有限公司 Method and system for detecting public network IP network state
CN114978942A (en) * 2022-05-13 2022-08-30 深信服科技股份有限公司 Router detection method and device, electronic equipment and storage medium

Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101030898A (en) * 2006-01-30 2007-09-05 丛林网络公司 Determining connectivity status for unnumbered inerfaces of a target network device
US20110167141A1 (en) * 2004-12-07 2011-07-07 Pure Networks, Inc. Network management
CN103269396A (en) * 2013-05-02 2013-08-28 百度在线网络技术(北京)有限公司 Method and system capable of conducting management on mobile terminal
CN103731850A (en) * 2013-12-12 2014-04-16 北京泰合佳通信息技术有限公司 Wireless network testing method based on mobile intelligent terminal
CN104168157A (en) * 2014-08-14 2014-11-26 中国联合网络通信集团有限公司 Network connectivity detection method and device
CN104219336A (en) * 2014-09-03 2014-12-17 深圳市腾讯计算机***有限公司 Method, device and system for implementing data connection
CN104699598A (en) * 2013-12-09 2015-06-10 腾讯科技(深圳)有限公司 Automatic testing method, device, equipment and system
CN105071995A (en) * 2015-08-28 2015-11-18 北京华青融天技术有限责任公司 Out-of-band network based network device patrolling method, device and system
US20170140253A1 (en) * 2015-11-12 2017-05-18 Xerox Corporation Multi-layer fusion in a convolutional neural network for image classification
CN107104838A (en) * 2017-05-15 2017-08-29 北京奇艺世纪科技有限公司 A kind of information processing method, server and terminal
CN107104854A (en) * 2017-04-12 2017-08-29 中国工商银行股份有限公司 Detection method, equipment and the system of terminal dual network interconnection
CN107347076A (en) * 2017-08-23 2017-11-14 杭州安恒信息技术有限公司 The detection method and device of SSRF leaks
CN107360036A (en) * 2017-08-04 2017-11-17 网宿科技股份有限公司 A kind of network failure locating method, terminal and server
CN108075933A (en) * 2016-11-11 2018-05-25 北京金山云网络技术有限公司 A kind of network interworking test method and device
CN108243025A (en) * 2016-12-23 2018-07-03 大唐移动通信设备有限公司 A kind of network test server-side, network test terminal and test method
US20180191856A1 (en) * 2016-12-29 2018-07-05 Synology Inc. Cross-domain communication methods and proxy servers using the same
WO2018137784A1 (en) * 2017-01-30 2018-08-02 Telefonaktiebolaget Lm Ericsson (Publ) Methods and apparatus for managing resource usage across domains in a communication network
CN108881211A (en) * 2018-06-11 2018-11-23 杭州盈高科技有限公司 A kind of illegal external connection detection method and device
CN109510738A (en) * 2018-12-14 2019-03-22 平安壹钱包电子商务有限公司 A kind of test method and equipment of communication link
CN109525461A (en) * 2018-11-27 2019-03-26 杭州迪普科技股份有限公司 A kind of test method of the network equipment, device, equipment and storage medium
US10291722B1 (en) * 2015-04-30 2019-05-14 Glance Networks, Inc. Method and apparatus for implementing co-browsing between domains
CN110166835A (en) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 Page display method, device and storage medium
US10452868B1 (en) * 2019-02-04 2019-10-22 S2 Systems Corporation Web browser remoting using network vector rendering

Patent Citations (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110167141A1 (en) * 2004-12-07 2011-07-07 Pure Networks, Inc. Network management
CN101030898A (en) * 2006-01-30 2007-09-05 丛林网络公司 Determining connectivity status for unnumbered inerfaces of a target network device
CN103269396A (en) * 2013-05-02 2013-08-28 百度在线网络技术(北京)有限公司 Method and system capable of conducting management on mobile terminal
CN104699598A (en) * 2013-12-09 2015-06-10 腾讯科技(深圳)有限公司 Automatic testing method, device, equipment and system
CN103731850A (en) * 2013-12-12 2014-04-16 北京泰合佳通信息技术有限公司 Wireless network testing method based on mobile intelligent terminal
CN104168157A (en) * 2014-08-14 2014-11-26 中国联合网络通信集团有限公司 Network connectivity detection method and device
CN104219336A (en) * 2014-09-03 2014-12-17 深圳市腾讯计算机***有限公司 Method, device and system for implementing data connection
US10291722B1 (en) * 2015-04-30 2019-05-14 Glance Networks, Inc. Method and apparatus for implementing co-browsing between domains
CN105071995A (en) * 2015-08-28 2015-11-18 北京华青融天技术有限责任公司 Out-of-band network based network device patrolling method, device and system
US20170140253A1 (en) * 2015-11-12 2017-05-18 Xerox Corporation Multi-layer fusion in a convolutional neural network for image classification
CN108075933A (en) * 2016-11-11 2018-05-25 北京金山云网络技术有限公司 A kind of network interworking test method and device
CN108243025A (en) * 2016-12-23 2018-07-03 大唐移动通信设备有限公司 A kind of network test server-side, network test terminal and test method
US20180191856A1 (en) * 2016-12-29 2018-07-05 Synology Inc. Cross-domain communication methods and proxy servers using the same
WO2018137784A1 (en) * 2017-01-30 2018-08-02 Telefonaktiebolaget Lm Ericsson (Publ) Methods and apparatus for managing resource usage across domains in a communication network
CN107104854A (en) * 2017-04-12 2017-08-29 中国工商银行股份有限公司 Detection method, equipment and the system of terminal dual network interconnection
CN107104838A (en) * 2017-05-15 2017-08-29 北京奇艺世纪科技有限公司 A kind of information processing method, server and terminal
CN107360036A (en) * 2017-08-04 2017-11-17 网宿科技股份有限公司 A kind of network failure locating method, terminal and server
CN107347076A (en) * 2017-08-23 2017-11-14 杭州安恒信息技术有限公司 The detection method and device of SSRF leaks
CN110166835A (en) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 Page display method, device and storage medium
CN108881211A (en) * 2018-06-11 2018-11-23 杭州盈高科技有限公司 A kind of illegal external connection detection method and device
CN109525461A (en) * 2018-11-27 2019-03-26 杭州迪普科技股份有限公司 A kind of test method of the network equipment, device, equipment and storage medium
CN109510738A (en) * 2018-12-14 2019-03-22 平安壹钱包电子商务有限公司 A kind of test method and equipment of communication link
US10452868B1 (en) * 2019-02-04 2019-10-22 S2 Systems Corporation Web browser remoting using network vector rendering

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
RAÜL MUÑOZ: "Transport Network Orchestration for End-to-End Multilayer Provisioning Across Heterogeneous SDN/OpenFlow and GMPLS/PCE Control Domains", 《 JOURNAL OF LIGHTWAVE TECHNOLOGY》 *
SALMAN MUSTAFA: "Decreased Cross-Domain Mutual Information in Schizophrenia From Dynamic Connectivity States", 《FRONTIERS IN NEUROSCIENCE》 *
刘江: "多级跨域访问控制管理相关技术研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
李自强: "域间路由连通不完全性分析", 《计算机工程与应用》 *
陈沪娟: "Linux下网络配置问答", 《网络安全和信息化》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407383A (en) * 2021-06-30 2021-09-17 迈普通信技术股份有限公司 Main/standby system switching method and device, server and main/standby system
CN113407383B (en) * 2021-06-30 2024-02-09 迈普通信技术股份有限公司 Main and standby system switching method and device, server and main and standby system
CN113747490A (en) * 2021-08-12 2021-12-03 Tcl通讯(宁波)有限公司 WIFI connectivity detection method and device, terminal equipment and storage medium
CN114629816A (en) * 2022-03-14 2022-06-14 京东科技信息技术有限公司 Method and system for detecting public network IP network state
CN114629816B (en) * 2022-03-14 2023-11-03 京东科技信息技术有限公司 Public network IP network state detection method and system
CN114978942A (en) * 2022-05-13 2022-08-30 深信服科技股份有限公司 Router detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111106983B (en) 2021-09-21

Similar Documents

Publication Publication Date Title
CN111106983B (en) Method and device for detecting network connectivity
US9847965B2 (en) Asset detection system
CN104767775B (en) Web application information push method and system
EP2837159B1 (en) System asset repository management
US8533581B2 (en) Optimizing security seals on web pages
US10805340B1 (en) Infection vector and malware tracking with an interactive user display
CN109981653B (en) Web vulnerability scanning method
CN109039987A (en) A kind of user account login method, device, electronic equipment and storage medium
US20170132669A1 (en) Resource Downloading Method and Device
CN105897947B (en) The Network Access Method and device of mobile terminal
CN112703496B (en) Content policy based notification to application users regarding malicious browser plug-ins
JP2012515956A5 (en)
CN113645253B (en) Attack information acquisition method, device, equipment and storage medium
CN107197462B (en) Wireless network type detection method and device and electronic equipment
WO2013155357A1 (en) Network address repository management
CN108063833B (en) HTTP DNS analysis message processing method and device
CN109672658B (en) JSON hijacking vulnerability detection method, device, equipment and storage medium
CN103581351B (en) The method and apparatus of network access
CN108076003A (en) The detection method and device of Session Hijack
CN110505116A (en) Power information acquisition system and penetration test method, device, readable storage medium storing program for executing
CN110392123B (en) Method, device and system for detecting outlet IP address
CN105099858A (en) Network instant messaging session method and system
CN104834588A (en) Permanent residence cross site script vulnerability detection method and apparatus
CN113810381A (en) Crawler detection method, web application cloud firewall, device and storage medium
US11614933B2 (en) Disabling a script based on indications of unsuccessful execution of the script

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
GR01 Patent grant
GR01 Patent grant