CN106714206B - Method and device for detecting wireless network access point connecting network - Google Patents

Method and device for detecting wireless network access point connecting network Download PDF

Info

Publication number
CN106714206B
CN106714206B CN201610872355.9A CN201610872355A CN106714206B CN 106714206 B CN106714206 B CN 106714206B CN 201610872355 A CN201610872355 A CN 201610872355A CN 106714206 B CN106714206 B CN 106714206B
Authority
CN
China
Prior art keywords
response data
access point
wireless network
content
network 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.)
Active
Application number
CN201610872355.9A
Other languages
Chinese (zh)
Other versions
CN106714206A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610872355.9A priority Critical patent/CN106714206B/en
Publication of CN106714206A publication Critical patent/CN106714206A/en
Application granted granted Critical
Publication of CN106714206B publication Critical patent/CN106714206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition

Abstract

The invention relates to a method and a device for detecting a wireless network access point connecting with a network. The method comprises the following steps: acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point; receiving first response data returned by the first appointed webpage according to the access request; and judging whether the first response data is matched with the content of the first appointed webpage, and if so, prompting the wireless network access point to successfully connect the network. The method and the device for detecting the connection of the wireless network access point to the network realize the detection that the wireless network access point can be connected to the network without performing ping operation, are suitable for the detection of various wireless network access point connection networks, and improve the detection universality.

Description

Method and device for detecting wireless network access point connecting network
Technical Field
The present invention relates to the field of network applications, and in particular, to a method and an apparatus for detecting a wireless network access point connecting to a network.
Background
WiFi is a technology that can interconnect terminals such as mobile terminals, personal computers, and the like. With the development of WiFi technology, WiFi hotspots (wireless network access points) are provided in many public places, and users can access a network through the wireless network access points to surf the internet. However, the quality of the WiFi hotspots is uneven, some WiFi hotspots even cannot surf the internet, some WiFi hotspots can be connected to the network only by inputting the mobile phone number for verification, and the user cannot know whether the connected WiFi hotspots can be connected to the network.
In order to detect whether a WiFi hotspot can connect to a network, a conventional method is to send an ICMP (Internet Control Message Protocol) packet to a server for ping, and analyze the packet for judgment, however, some WiFi hotspots prohibit ping operation, which results in that it is impossible to detect whether a wireless network access point can connect to a network.
Disclosure of Invention
Therefore, it is necessary to provide a method and an apparatus for detecting whether a wireless network access point is able to connect to a network, which can detect whether various wireless network access points are able to connect to the network, and improve the detection versatility, for the problem that it is not possible to detect whether some wireless network access points are able to connect to the network.
A method of detecting that a wireless network access point is connected to a network, comprising:
acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point;
receiving first response data returned by the first appointed webpage according to the access request;
and judging whether the first response data is matched with the content of the first appointed webpage, and if so, prompting the wireless network access point to successfully connect the network.
An apparatus for detecting that a wireless network access point is connected to a network, comprising:
the request initiating module is used for acquiring the selected wireless network access point, connecting the wireless network access point and initiating an access request to a first appointed webpage through the wireless network access point;
a response receiving module, configured to receive first response data returned by the first specified webpage according to the access request;
the judging module is used for judging whether the first response data is matched with the content of the first appointed webpage or not;
and the prompting module is used for prompting that the wireless network access point is successfully connected with the network if the first response data is judged to be matched with the content of the first appointed webpage.
According to the method and the device for detecting the connection of the wireless network access point to the network, the selected wireless network access point is obtained, the wireless network access point is connected, the access request is sent to the first appointed webpage through the wireless network access point, the first response data is received, the first response data is compared with the content of the first appointed webpage, the first response data is judged to be matched with the content of the first appointed webpage, the wireless network access point is prompted to be successfully connected to the network, the detection that the wireless network access point can be connected to the network is achieved, the ping operation is not needed, the method and the device are suitable for the detection of various wireless network access point connection networks, and the detection universality is improved.
Drawings
FIG. 1 is a diagram illustrating an exemplary application of a method for detecting a wireless access point connecting to a network;
fig. 2 is a schematic diagram of the internal structure of the terminal in one embodiment;
FIG. 3 is a flow diagram of a method for detecting that a wireless network access point is connected to a network in one embodiment;
FIG. 4 is a flow diagram of a method for detecting a wireless network access point connecting to a network in another embodiment;
FIG. 5 is a flow diagram of a method for detecting a wireless network access point connecting to a network in another embodiment;
FIG. 6 is a block diagram of an apparatus for detecting a wireless network access point connecting to a network in one embodiment;
fig. 7 is a block diagram of an apparatus for detecting a network connection of a wireless network access point in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first designated web page may be referred to as a second designated web page, and similarly, a second designated web page may be referred to as a first designated web page, without departing from the scope of the present invention. Both the first designated web page and the second designated web page are designated web pages, but they are not the same designated web page.
Fig. 1 is a schematic application environment of a method for detecting that a wireless network access point is connected to a network in one embodiment. As shown in fig. 1, the application environment includes a terminal 110, a wireless network access point 120, and a server 130. The terminal 110 is installed with a WiFi housekeeping application, etc., acquires the wireless network access point 120 selected by the user from the wireless network access points searched by the WiFi housekeeping application, initiates an access request to a specified web page on the server 130 through the wireless network access point 120, receives response data of the server 130 to the access request, compares the response data with the content of the specified web page, and determines whether the wireless network access point 120 can connect to the network.
Fig. 2 is a schematic diagram of an internal structure of a terminal (or an electronic device, etc.) in one embodiment. As shown in fig. 2, the terminal includes a processor, a nonvolatile storage medium, an internal memory, a network interface, a display screen, and an input device, which are connected through a system bus. The non-volatile storage medium of the terminal stores an operating system and further comprises a device for detecting the connection of the wireless network access point with the network, and the device for detecting the connection of the wireless network access point with the network is used for realizing the method for detecting the connection of the wireless network access point with the network. The processor is used for providing calculation and control capability and supporting the operation of the whole terminal. An internal memory in the terminal provides an environment for operating the apparatus for detecting a wireless network access point connecting to a network in a non-volatile storage medium, the internal memory storing computer readable instructions which, when executed by the processor, cause the processor to perform a method for detecting a wireless network access point connecting to a network. The network interface is used for performing network communication with the server, such as sending an access request to the server, receiving response data returned by the server, and the like. The display screen of the terminal can be a liquid crystal display screen or an electronic ink display screen, and the input device can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a shell of the terminal, or an external keyboard, a touch pad or a mouse. The terminal can be a mobile phone, a tablet computer, a personal digital assistant or a wearable device. Those skilled in the art will appreciate that the configuration shown in fig. 2 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation on the terminal to which the present application is applied, and that a particular terminal may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Fig. 3 is a flow diagram of a method for detecting that a wireless network access point is connected to a network in one embodiment. As shown in fig. 3, a method for detecting that a wireless network access point is connected to a network includes:
step 302, obtaining the selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first designated webpage through the wireless network access point.
In this embodiment, an application program of a WiFi housekeeper class is started on a terminal, SSIDs (Service Set identifiers) of surrounding wireless network access points are displayed on an application program interface, the terminal acquires an SSID of a wireless network access point selected by a user from the SSIDs of the searched wireless network access points, connects the wireless network access point, and initiates an access request to a first designated webpage on a server through the wireless network access point. The network address of the first designated webpage can be preset in the application program, after the preset network address of the first designated webpage is obtained after the user selects the wireless network access point in a touch or click mode, the preset network address of the first designated webpage is automatically obtained, and an access request is initiated to the corresponding first designated webpage through the network address of the first designated webpage.
The periphery is within a preset distance range from the position of the terminal. The first designated webpage refers to a preconfigured access webpage. The first designated webpage can be set up on the server in advance, and the first designated webpage can be a static webpage. The first designated web page may be an HTTP (Hyper Text Transfer Protocol) web page, a Flash web page, or a JavaScript web page, and is a permanent web page. The access request may be an HTTP request.
For the IOS system, the Reahability of Apple open source can be adopted to judge whether the terminal where the application program is located is connected with the wireless network access point.
Step 304, receiving first response data returned by the first specified webpage according to the access request.
In this embodiment, the first designated webpage on the server responds according to the access request, generates first response data, and returns the first response data to the terminal that initiated the access request. The first response data may include content of the first specified web page or key content of the first specified web page, etc. The key content refers to feature information that can indicate the first designated web page, for example, if the first designated web page is "abc housekeeper", the key content may be "abc housekeeper", or the like. In other embodiments, the first response data may also include a status code, a redirect address, and the like.
In one embodiment, the preset time may be configured. The preset time can be configured according to needs, such as 3 seconds, 5 seconds and the like. If the first response data returned by the first appointed webpage is not received within the preset time, the access request is failed, and the judgment result is that the wireless network access point cannot be connected with the network.
In one embodiment, if the prompt message that the access request is in error is received, the wireless network access point is prompted to be unable to connect to the network.
Step 306, determining whether the first response data matches with the content of the first designated webpage, if yes, executing step 308, and if not, executing step 310.
In this embodiment, if the first response data is the same as the content of the first designated web page, the first response data matches the content of the first designated web page; the first response data is different from the content of the first specified web page, and the first response data does not match the content of the first specified web page.
In one embodiment, the first response data includes key content of the first specified web page, the first response data matches the content of the first specified web page; the first response data does not include the key content of the first specified web page, and the first response data does not match the content of the first specified web page.
Step 308, prompting the wireless network access point to successfully connect to the network.
In this embodiment, if the first response data matches the content of the first designated web page, the wireless network access point is prompted to successfully connect to the network. The wireless network access point is connected with the network, and can be connected to the internet to access data on the internet.
Step 310, prompting that the wireless network access point cannot connect to the network.
In this embodiment, if the first response data matches the content of the first designated web page, it is prompted that the wireless network access point cannot connect to the network. The fact that the wireless network access point cannot be connected with the network means that the wireless network access point cannot be connected with the internet and can access data on the internet.
The method for detecting the connection of the wireless network access point with the network obtains the selected wireless network access point, connects the wireless network access point, initiates an access request to the first appointed webpage through the wireless network access point, receives the first response data, compares the first response data with the content of the first appointed webpage, judges that the first response data is matched with the content of the first appointed webpage, prompts the wireless network access point to be successfully connected with the network, realizes the detection that the wireless network access point can be connected with the network, does not need to perform ping operation, is suitable for the detection of various wireless network access points connected with the network, and improves the detection universality.
In one embodiment, the determining whether the first response data matches the content of the first specified web page includes: and judging whether the first response data contains key content in the first appointed webpage or not, if the first response data contains the key content, matching the first response data with the content of the first appointed webpage, and if the first response data does not contain the key content, not matching the first response data with the content of the first appointed webpage.
In this embodiment, the key content refers to feature information that can represent the first specified web page, for example, if the first specified web page is "abc housekeeper", the key content may be "abc housekeeper" or the like.
Whether the first response data contain the key content or not is detected, if yes, the first response data are matched with the content of the first appointed webpage, data comparison content is reduced, calculation amount is saved, the situation that some operators add the content of the operators into each request page through the network, the first response data are different from the content of the first appointed page, the situation that the first response data are mistakenly considered that the wireless network access point cannot access the network is avoided, and detection accuracy is improved.
Fig. 4 is a flow chart of a method for detecting that a wireless network access point is connected to a network in another embodiment. As shown in fig. 4, a method for detecting that a wireless network access point is connected to a network includes:
step 402, obtaining the selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first designated webpage through the wireless network access point.
In this embodiment, an application program of a WiFi housekeeper class is started on a terminal, SSIDs of surrounding wireless network access points are displayed on the application program interface, the terminal obtains the SSID of the wireless network access point selected by a user from the SSIDs of the searched wireless network access points, connects to the wireless network access point, and initiates an access request to a first designated webpage on a server through the wireless network access point. The network address of the first designated webpage can be preset in the application program, after the preset network address of the first designated webpage is obtained after the user selects the wireless network access point in a touch or click mode, the preset network address of the first designated webpage is automatically obtained, and an access request is initiated to the corresponding first designated webpage through the network address of the first designated webpage.
In one embodiment, the preset time may be configured. The preset time can be configured according to needs, such as 3 seconds, 5 seconds and the like. If the first response data returned by the first appointed webpage is not received within the preset time, the access request is failed, and the judgment result is that the wireless network access point cannot be connected with the network.
Step 404, receiving first response data returned by the first specified webpage according to the access request.
In this embodiment, the first response data may include content of the first specified web page or key content of the first specified web page. The key content refers to feature information that can indicate the first designated web page, for example, if the first designated web page is "abc housekeeper", the key content may be "abc housekeeper", or the like. In other embodiments, the first response data may also include a status code, a redirect address, and the like.
Step 406, determining whether the first response data matches with the content of the first designated webpage, if yes, performing step 408, and if not, performing step 410.
In this embodiment, if the first response data is the same as the content of the first designated web page, the first response data matches the content of the first designated web page; the first response data is different from the content of the first specified web page, and the first response data does not match the content of the first specified web page.
In one embodiment, the first response data includes key content of the first specified web page, the first response data matches the content of the first specified web page; the first response data does not include the key content of the first specified web page, and the first response data does not match the content of the first specified web page.
And step 408, prompting the wireless network access point to successfully connect the network.
In this embodiment, if the first response data matches the content of the first designated web page, the wireless network access point is prompted to successfully connect to the network. The wireless network access point is connected with the network, and can be connected to the internet to access data on the internet.
In step 410, it is determined whether the quotient obtained by dividing the status code of the first response data by 100 is 3 and the value of the redirection address Location is not null, if yes, step 412 is executed, and if no, step 414 is executed.
In this embodiment, the first response data may be HTTP response data. And judging whether the status code of the HTTP response data is 30x or not, namely whether the quotient of the status code divided by 100 is 3 or not, and if the quotient of the status code divided by 100 is 3 and the value of the Location (redirection address) in the header of the HTTP response data is not null, indicating that the wireless network access point (WiFi) is the wireless network access point needing to be verified according to the detection result. 30x may be 300, 301, 302, 303, 304, 305, 306, 307, etc. For example, 300multiple threads, the requested resource has a series of feedback information available for selection. 301moved permanent, and any future reference to this Resource should use one of several URLs (Uniform Resource Locator) returned by this response, a new permanent URL should be returned in the Location field of the response. 302move temporaryly, the requested resource temporarily responds to the request from a different URL. 303see other, indicating that a response corresponding to the current request can be found on another URL. 304not modified, indicates that if the client sends a conditional GET request and the request is allowed, but the content of the document has not changed, the server should return this status code. 305Use proxy, which indicates that the requested resource must be accessed through the specified proxy, the Location field will give the URL information of the specified proxy, and the receiver needs to repeatedly send a separate request to access the corresponding resource through the proxy. 307, temporarylirection, indicating that the requested resource temporarily responds to the request from a different URL.
In step 412, if the quotient is 3 and the Location redirection address value is not null, it indicates that the current determination result is that the wireless network access point is a wireless network access point that needs to be verified.
In step 414, it is determined whether the quotient of the status code of the first response data divided by 100 is 2 and the content of the instance body is not empty, if yes, step 416 is executed, and if no, step 418 is executed.
In this embodiment, it is determined whether a status code of the HTTP response data is 20x, that is, whether a quotient obtained by dividing the status code by 100 is 2, and if the quotient obtained by dividing the status code by 100 is 2 and the content of the body (example) of the HTTP response data is not empty, it is prompted that the current detection result is that the wireless access point (WiFi) is a wireless access point that needs to be verified.
And step 416, if the quotient is 2 and the body content is not empty, prompting that the wireless network access point is the wireless network access point needing to be verified according to the judgment result.
Step 418, prompting that the wireless network access point cannot connect to the network.
The method for detecting whether the wireless network access point is the wireless network access point needing to be verified or not is further judged if the first response data is not matched with the content of the first designated webpage, the wireless network access point is prompted to be successfully connected with the network, the detection that the wireless network access point can be connected with the network is realized, if the first response data is judged to be not matched with the content of the first designated webpage, the state code, the redirection address or the body content and the like are further judged to verify whether the wireless network access point is the wireless network access point needing to be verified, the ping operation is not needed, and the method is suitable for detecting the connection of various wireless network access points with the network, the detection universality is improved.
In an embodiment, as shown in fig. 5, the method for detecting that the wireless network access point is connected to the network further includes:
step 502, when the judgment result is that the wireless network access point is wirelessly connected with the network, an access request is initiated to a second designated webpage through the wireless network access point.
Specifically, a second designated webpage may be set up on the server in advance, and the second designated webpage may be a static webpage. The second designated web page may be an HTTP web page, a Flash web page, or a JavaScript web page, and is a permanent web page. The access request may be an HTTP request. The second designated web page is a different web page than the first designated web page.
Step 504, receiving second response data returned by the second designated webpage according to the access request.
Step 506, determining whether the second response data matches the content of the second designated webpage, and if the second response data matches the content of the second designated webpage, executing step 510.
Step 508, prompting the wireless network access point to successfully connect to the network.
Step 510, prompting that the wireless network access point cannot connect to the network.
In this embodiment, the determining whether the second response data matches with the content of the second specified webpage includes: and judging whether the second response data contains key content in the second specified webpage or not, if so, matching the second response data with the content of the second specified webpage, and if not, not matching the second response data with the content of the second specified webpage.
In other embodiments, the first response data is the same as the content of the first specified web page, then the first response data matches the content of the first specified web page; the first response data is different from the content of the first specified web page, and the first response data does not match the content of the first specified web page.
In the embodiment, after the access request initiated to the first specified webpage fails, the access request is initiated to the second specified webpage, the second response data fed back by the second specified webpage is received, if the second response data is matched with the content of the second specified webpage, the success of the connection of the wireless network access point is prompted, and whether the connection of the wireless network access point is successful or not is detected by initiating the access request to the second specified webpage, so that the error that the first specified webpage has problems and the wireless network access point is mistakenly considered to be unable to be connected with the network is avoided, and the detection is performed on a plurality of specified webpages, so that the disaster tolerance effect can be achieved, and the detection accuracy is improved.
In one embodiment, steps 502 to 510 may be performed when it is determined in step 306 that the first response data does not match the content of the first designated webpage, or steps 502 to 510 may be performed when it is determined in step 414 that the quotient of the status code divided by 100 of the first response data is not 2 or the content of the instance body is empty. And whether the wireless network access point is successfully connected with the network or not is judged by comparing the first response data with the content of the first appointed webpage and comparing the second response data with the content of the second appointed webpage, so that the method is more accurate.
In an embodiment, the method for detecting that the wireless network access point is connected to the network further includes: and when judging that the second response data are not matched with the content of the second appointed webpage, detecting whether the maximum retry time is exceeded or not, if so, ending, and if not, initiating an access request to the first appointed webpage again through the wireless network access point to detect whether the wireless network access point is connected with the network or not.
In this embodiment, the maximum retry number may be set according to the requirement, such as 3 times, 5 times, 10 times, and the like, but is not limited thereto. When the maximum retry number is not exceeded, steps 302 to 306 and steps 502 to 510 may be executed again, or steps 402 to 414 and steps 502 to 510 may be executed again.
In one embodiment, after step 506, the method further comprises: judging whether the quotient of the state code of the second response data divided by 100 is 3 or not and whether the value of the redirection address Location is null or not, if the quotient is 3 and the value of the Location redirection address is not null, prompting that the current judgment result is that the wireless network access point is the wireless network access point needing to be verified, if not, further judging whether the quotient of the state code of the second response data divided by 100 is 2 or not and whether the content of the instance body is null or not, if the quotient is 2 and the content of the body is not null, prompting that the current judgment result is that the wireless network access point is the wireless network access point needing to be verified, and if not, prompting that the wireless network access point cannot be connected with the network. The status code, the redirection address or the body content and the like are further judged to verify whether the wireless network access point is the wireless network access point needing to be verified, the ping operation is not needed, the method is suitable for detecting various wireless network access points connected with the network, and the detection universality is improved.
In one embodiment, a method of detecting that a wireless network access point is connected to a network includes: acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point; receiving first response data returned by the first appointed webpage according to the access request; and judging whether the state code in the first response data is a first preset state code, if so, prompting that the wireless network access point is successfully connected with the network, and if not, prompting that the wireless network access point cannot be connected with the network.
Judging whether the state code in the first response data is a first preset state code or not can be a specific step of judging whether the first response data is matched with the content of the first appointed webpage or not, and if the state code in the first response data is the first preset state code, indicating that the first response data is matched with the content of the first appointed webpage; and if the status code in the first response data is not the first preset status code, the first response data is not matched with the content of the first designated webpage.
In this embodiment, the first predetermined status code can be set as required, and usually the first predetermined status code is a status code indicating that the server has successfully processed the request, such as 200, 204, and so on. By judging whether the state code in the first response data is the first preset state code or not, the comparison calculation amount is small, the situation that some operators add the content of the operators in each request page through the network, the first response data is different from the content of the first appointed page, the first response data is mistakenly considered that the wireless network access point cannot access the network is avoided, and the detection accuracy is improved.
In one embodiment, a method of detecting that a wireless network access point is connected to a network includes: acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point; receiving first response data returned by the first appointed webpage according to the access request; judging whether the state code of the first response data is a first preset state code or not, if so, prompting that the wireless network access point is successfully connected with the network, and if not, initiating an access request to a second specified webpage through the wireless network access point; receiving second response data returned by the second designated webpage according to the access request; and judging whether the second response data contains the key content of the second appointed webpage, if so, prompting that the wireless network access point is successfully connected with the network, and if not, prompting that the wireless network access point cannot be connected with the network.
Specifically, if the status code in the first response data is a first preset status code, prompting that the first response data is matched with the content of the first specified webpage; and if the state code in the first response data is not the first preset state code, prompting that the first response data is not matched with the content of the first appointed webpage.
By judging whether the state code in the first response data is the first preset state code or not, or whether the second response data contains the key content of the second appointed webpage or not, the situation that some operators add the content of the operators into each request page through the network, the content of the first response data is different from that of the first appointed page, the first response data is mistakenly considered that the wireless network access point cannot access the network is avoided, and the detection accuracy is improved. Meanwhile, different detection modes are adopted for different webpages, so that the detection accuracy is improved.
And when judging that the second response data are not matched with the content of the second appointed webpage, detecting whether the maximum retry time is exceeded or not, if so, ending, and if not, initiating an access request to the first appointed webpage again through the wireless network access point to detect whether the wireless network access point is connected with the network or not.
In this embodiment, the maximum retry number may be set according to the requirement, such as 3 times, 5 times, 10 times, and the like, but is not limited thereto.
In one embodiment, a method of detecting that a wireless network access point is connected to a network includes: acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point; receiving first response data returned by the first appointed webpage according to the access request; judging whether the state code in the first response data is a first preset state code or not, if so, prompting that the wireless network access point is successfully connected with the network, and if not, initiating an access request to a second designated webpage through the wireless network access point; receiving second response data returned by the second designated webpage according to the access request; and judging whether the state code in the second response data is a second preset state code, if so, prompting that the wireless network access point is successfully connected with the network, and if not, prompting that the wireless network access point cannot be connected with the network.
In this embodiment, the second predetermined status code can be set as required, and usually the second predetermined status code is a status code for prompting the server that the request has been successfully processed, such as 200, 204, and the like.
Specifically, if the status code in the first response data is a first preset status code, prompting that the first response data is matched with the content of the first specified webpage; and if the state code in the first response data is not the first preset state code, prompting that the first response data is not matched with the content of the first appointed webpage. If the status code in the second response data is a second preset status code, prompting that the second response data is matched with the content of the second appointed webpage; and if the status code in the second response data is not the second preset status code, prompting that the second response data is not matched with the content of the second specified webpage.
And when judging that the second response data are not matched with the content of the second appointed webpage, detecting whether the maximum retry time is exceeded or not, if so, ending, and if not, initiating an access request to the first appointed webpage again through the wireless network access point to detect whether the wireless network access point is connected with the network or not.
In this embodiment, the maximum retry number may be set according to the requirement, such as 3 times, 5 times, 10 times, and the like, but is not limited thereto.
In one embodiment, a method of detecting that a wireless network access point is connected to a network includes: acquiring a selected wireless network access point, connecting the wireless network access point, and initiating an access request to a first specified webpage through the wireless network access point; receiving first response data returned by the first appointed webpage according to the access request; judging whether the first response data contains key content of the first designated webpage, if so, prompting that the wireless network access point is successfully connected with the network, and if not, initiating an access request to a second designated webpage through the wireless network access point; receiving second response data returned by the second designated webpage according to the access request; and judging whether the state code in the second response data is a second preset state code, if so, prompting that the wireless network access point is successfully connected with the network, and if not, prompting that the wireless network access point cannot be connected with the network.
Specifically, if the status code in the second response data is a second preset status code, it indicates that the second response data matches with the content of the second specified webpage; and if the status code in the second response data is not the second preset status code, the second response data is not matched with the content of the second specified webpage.
And when judging that the second response data are not matched with the content of the second appointed webpage, detecting whether the maximum retry time is exceeded or not, if so, ending, and if not, initiating an access request to the first appointed webpage again through the wireless network access point to detect whether the wireless network access point is connected with the network or not.
In this embodiment, the maximum retry number may be set according to the requirement, such as 3 times, 5 times, 10 times, and the like, but is not limited thereto.
Fig. 6 is a block diagram of an apparatus for detecting that a wireless network access point is connected to a network in one embodiment. As shown in fig. 6, an apparatus for detecting that a wireless network access point is connected to a network, which is operated on a terminal, includes a request initiating module 602, a response data receiving module 604, a determining module 606, and a prompting module 608. Wherein:
the request initiating module 602 is configured to acquire a selected wireless network access point, connect to the wireless network access point, and initiate an access request to a first specified webpage through the wireless network access point;
the response receiving module 604 is configured to receive first response data returned by the first specified webpage according to the access request.
The determining module 606 is configured to determine whether the first response data matches with the content of the first designated webpage.
The prompting module 608 is configured to prompt the wireless network access point to successfully connect to the network if it is determined that the first response data matches the content of the first designated webpage.
The device for detecting the connection of the wireless network access point with the network acquires the selected wireless network access point, connects the wireless network access point, initiates an access request to the first appointed webpage through the wireless network access point, receives the first response data, compares the first response data with the content of the first appointed webpage, judges that the first response data is matched with the content of the first appointed webpage, prompts the wireless network access point to be successfully connected with the network, realizes the detection that the wireless network access point can be connected with the network, does not need to perform ping operation, is suitable for the detection of various wireless network access points connected with the network, and improves the detection universality.
In an embodiment, the determining module 606 is further configured to determine whether the first response data includes key content in the first specified webpage, where if the first response data includes the key content, the first response data matches with the content of the first specified webpage, and if the first response data does not include the key content, the first response data does not match with the content of the first specified webpage.
In an embodiment, the determining module 606 is further configured to determine whether a status code in the first response data is a first preset status code, if so, the first response data is matched with the content of the first designated web page, and if not, the first response data is not matched with the content of the first designated web page.
In an embodiment, the determining module 606 is further configured to, when it is determined that the first response data does not match the content of the first designated webpage, further determine whether a quotient obtained by dividing the status code of the first response data by 100 is 3, and whether a value of the redirection address Location is null, if the quotient is 3 and the value of the redirection address Location is not null, prompt that the current determination result is that the wireless network access point is a wireless network access point that needs to be verified, if not, further determine whether the quotient obtained by dividing the status code of the first response data by 100 is 2, and the content of the instance body is null, if the quotient is 2 and the content of the body is not null, prompt that the current determination result is that the wireless network access point is a wireless network access point that needs to be verified, and if not, prompt that the wireless network access point cannot connect to the network.
In an embodiment, the request initiating module 602 is further configured to initiate an access request to a second specified web page through the wireless network access point when the determination result is that the wireless network access point is wirelessly connected to the network;
the response receiving module 604 is further configured to receive second response data returned by the second designated webpage according to the access request;
the determining module 606 is further configured to determine whether the second response data matches with the content of the second designated webpage, if so, the prompting module 608 is further configured to prompt the wireless network access point to successfully connect to the network, and if not, the prompting module 608 is further configured to prompt the wireless network access point to be unable to connect to the network.
In an embodiment, the determining module 606 is further configured to determine whether the second response data includes key content in the second specified webpage, where if the second response data includes the key content, the second response data matches with the content of the second specified webpage, and if the second response data does not include the key content, the second response data does not match with the content of the second specified webpage.
In an embodiment, the determining module 606 is further configured to determine whether the status code in the second response data is a second preset status code, if so, the second response data is matched with the content of the second specified webpage, and if not, the second response data is not matched with the content of the second specified webpage.
Fig. 7 is a block diagram of an apparatus for detecting a network connection of a wireless network access point in another embodiment. As shown in fig. 7, an apparatus for detecting that a wireless network access point is connected to a network, which is operated on a terminal, includes a request initiating module 602, a response data receiving module 604, a determining module 606, and a prompting module 608, and further includes a number detecting module 610.
The number detection module 610 is configured to detect whether the number of times of retry exceeds a maximum retry number when it is determined that the second response data is not matched with the content of the second designated webpage, if so, the detection is ended, and if not, the request initiation module initiates an access request to the first designated webpage through the wireless network access point again to detect whether the wireless network access point is connected to the network.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (14)

1. A method of detecting that a wireless network access point is connected to a network, comprising:
the method comprises the steps of obtaining a selected wireless network access point on an application program interface, connecting the wireless network access point, and initiating an access request to a server or a first designated webpage built in an application program through the wireless network access point, wherein the first designated webpage is a static webpage;
when detecting that first response data returned by the first appointed webpage according to the access request is received within preset time, the first response data comprises key content, a state code and a redirection address of the first appointed webpage;
judging whether the first response data is matched with the content of the first appointed webpage, and if so, prompting that the wireless network access point is successfully connected with the network;
when the first response data is judged not to be matched with the content of the first designated webpage, further judging whether a quotient obtained by dividing a state code of the first response data by 100 is 3 and whether the value of the redirection address is null, if the quotient is 3 and the value of the redirection address is not null, prompting that the current judgment result is that the wireless network access point is a wireless network access point needing to be verified, if not, further judging whether the quotient obtained by dividing the state code of the first response data by 100 is 2 and the content of an example body is not null, if the quotient is 2 and the content of the body is not null, prompting that the current judgment result is that the wireless network access point is the wireless network access point needing to be verified, and if not, prompting that the wireless network access point cannot be connected with the network;
when detecting that first response data returned by a first appointed webpage is not received within the preset time and a judgment result is that the wireless network access point cannot be connected with a network, initiating an access request to a second appointed webpage through the wireless network access point;
receiving second response data returned by the second designated webpage according to the access request;
and judging whether the second response data is matched with the content of the second appointed webpage, if so, prompting that the wireless network access point is successfully connected with the network, and if not, prompting that the wireless network access point cannot be connected with the network.
2. The method of claim 1, wherein determining whether the first response data matches the content of the first specified web page comprises:
and judging whether the first response data contains key content in the first appointed webpage or not, if the first response data contains the key content, matching the first response data with the content of the first appointed webpage, and if the first response data does not contain the key content in the first appointed webpage, not matching the first response data with the content of the first appointed webpage.
3. The method of claim 1, wherein determining whether the first response data matches the content of the first specified web page comprises:
and judging whether the state code in the first response data is a first preset state code, if so, matching the first response data with the content of the first appointed webpage, and if not, mismatching the first response data with the content of the first appointed webpage.
4. The method of claim 1, wherein determining whether the second response data matches the content of the second specified web page comprises:
and judging whether the second response data contains key content in the second specified webpage or not, if so, matching the second response data with the content of the second specified webpage, and if not, not matching the second response data with the content of the second specified webpage.
5. The method of claim 1, wherein determining whether the second response data matches the content of the second specified web page comprises:
and judging whether the state code in the second response data is a second preset state code, if so, matching the second response data with the content of the second specified webpage, and if not, mismatching the second response data with the content of the second specified webpage.
6. The method of claim 1, further comprising:
and when judging that the second response data are not matched with the content of the second appointed webpage, detecting whether the maximum retry time is exceeded or not, if so, ending, and if not, initiating an access request to the first appointed webpage again through the wireless network access point to detect whether the wireless network access point is connected with the network or not.
7. An apparatus for detecting a wireless network access point connecting to a network, comprising:
the request initiating module is used for acquiring the selected wireless network access point on an application program interface, connecting the wireless network access point and initiating an access request to a server or a first designated webpage built in the application program through the wireless network access point, wherein the first designated webpage is a static webpage; the request initiating module is further used for initiating an access request to a second designated webpage through the wireless network access point when the judgment result shows that the wireless network access point cannot be connected with the network;
a response receiving module, configured to receive first response data returned by the first specified webpage according to the access request, where the first response data includes key content, a status code, and a redirection address of the first specified webpage; the response receiving module is further configured to receive second response data returned by the second designated webpage according to the access request;
the judging module is used for judging whether the first response data is matched with the content of the first appointed webpage or not; the judging module is further used for judging whether the second response data is matched with the content of the second designated webpage or not; if the matching is successful, the wireless network access point is prompted to be successfully connected with the network, and if the matching is not successful, the prompting module is further used for prompting that the wireless network access point cannot be connected with the network;
the judging module is further configured to further judge whether a quotient obtained by dividing a state code of the first response data by 100 is 3 and whether a value of a redirection address Location is null when judging that the first response data is not matched with the content of the first designated webpage, prompt that the current judging result is that the wireless network access point is a wireless network access point needing to be verified if the quotient is 3 and the value of the Location redirection address is not null, otherwise further judge whether the quotient obtained by dividing the state code of the first response data by 100 is 2 and whether the content of an instance body is null, prompt that the current judging result is that the wireless network access point is the wireless network access point needing to be verified if the quotient is 2 and the content of the body is not null, and prompt that the wireless network access point cannot be connected to the network if the quotient is not 2 and the content of the body is not null;
the prompting module is used for prompting that the wireless network access point is successfully connected with the network if the first response data is judged to be matched with the content of the first appointed webpage; the prompting module is further used for prompting that the wireless network access point is successfully connected with the network if the second response data is judged to be matched with the content of the second appointed webpage, and prompting that the wireless network access point cannot be connected with the network if the second response data is not matched with the content of the second appointed webpage.
8. The apparatus according to claim 7, wherein the determining module is further configured to determine whether the first response data includes key content in the first specified web page, if the first response data includes the key content, the first response data matches with the content of the first specified web page, and if the first response data does not include the key content, the first response data does not match with the content of the first specified web page.
9. The apparatus according to claim 7, wherein the determining module is further configured to determine whether the status code in the first response data is a first preset status code, if so, the first response data matches with the content of the first designated web page, and if not, the first response data does not match with the content of the first designated web page.
10. The apparatus according to claim 7, wherein the determining module is further configured to determine whether the second response data includes key content in the second specified web page, if the second response data includes the key content, the second response data matches with the content of the second specified web page, and if the second response data does not include the key content, the second response data does not match with the content of the second specified web page.
11. The apparatus according to claim 7, wherein the determining module is further configured to determine whether the status code in the second response data is a second preset status code, if so, the second response data matches with the content of the second designated web page, and if not, the second response data does not match with the content of the second designated web page.
12. The apparatus of claim 7, further comprising:
and the frequency detection module is used for detecting whether the maximum retry frequency is exceeded or not when the second response data is judged not to be matched with the content of the second appointed webpage, if so, ending the detection, and if not, initiating an access request to the first appointed webpage again through the wireless network access point by the request initiation module to detect whether the wireless network access point is connected with the network or not.
13. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 5 when executing the computer program.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
CN201610872355.9A 2016-09-29 2016-09-29 Method and device for detecting wireless network access point connecting network Active CN106714206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610872355.9A CN106714206B (en) 2016-09-29 2016-09-29 Method and device for detecting wireless network access point connecting network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610872355.9A CN106714206B (en) 2016-09-29 2016-09-29 Method and device for detecting wireless network access point connecting network

Publications (2)

Publication Number Publication Date
CN106714206A CN106714206A (en) 2017-05-24
CN106714206B true CN106714206B (en) 2020-06-16

Family

ID=58940375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610872355.9A Active CN106714206B (en) 2016-09-29 2016-09-29 Method and device for detecting wireless network access point connecting network

Country Status (1)

Country Link
CN (1) CN106714206B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107360059B (en) * 2017-07-28 2019-03-01 Oppo广东移动通信有限公司 Network detecting method, network detection device and intelligent terminal
CN107493206B (en) * 2017-08-16 2019-04-23 Oppo广东移动通信有限公司 A kind of network detecting method, network detection device and intelligent terminal
CN107395633A (en) * 2017-08-25 2017-11-24 广东欧珀移动通信有限公司 A kind of network detecting method, network detection means and intelligent terminal
CN107332741B (en) * 2017-08-25 2019-03-29 Oppo广东移动通信有限公司 A kind of network detecting method, network detection device and intelligent terminal
CN109005084B (en) * 2018-08-14 2020-10-02 南京尚网网络科技有限公司 Method, electronic device, and computer-readable medium for verifying network connection
CN109862605B (en) * 2019-01-22 2021-12-07 上海尚往网络科技有限公司 Networking method and equipment for terminal equipment
CN110113744B (en) * 2019-04-18 2020-12-04 杭州涂鸦信息技术有限公司 Communication method, device, equipment and storage medium
CN113709086B (en) * 2020-05-22 2023-07-18 深圳市万普拉斯科技有限公司 Network detection method, device, electronic equipment and storage medium
CN111953761B (en) * 2020-08-04 2023-07-25 Oppo广东移动通信有限公司 Data processing method, device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102204349A (en) * 2008-09-29 2011-09-28 株式会社东芝 Pre-evaluation of multiple network access points
CN104243320A (en) * 2014-09-10 2014-12-24 珠海市君天电子科技有限公司 Method and device for optimizing network access paths
CN104735736A (en) * 2013-12-24 2015-06-24 中国移动通信集团公司 Network access method and user terminal

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8510411B2 (en) * 2010-05-06 2013-08-13 Desvio, Inc. Method and system for monitoring and redirecting HTTP requests away from unintended web sites
CN103517377B (en) * 2012-06-30 2017-04-12 华为终端有限公司 Wireless network access method, Wifi access point and terminal
CN103634304B (en) * 2013-11-18 2016-08-24 四川长虹电器股份有限公司 A kind of method realizing quick WEB authentication on intelligent television
CN104268266B (en) * 2014-10-11 2017-12-19 北京国双科技有限公司 The method and apparatus for sending web access requests
CN105263196A (en) * 2015-08-31 2016-01-20 小米科技有限责任公司 Connection state prompting method and device
CN105871853A (en) * 2016-04-11 2016-08-17 上海斐讯数据通信技术有限公司 Portal authenticating method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102204349A (en) * 2008-09-29 2011-09-28 株式会社东芝 Pre-evaluation of multiple network access points
CN104735736A (en) * 2013-12-24 2015-06-24 中国移动通信集团公司 Network access method and user terminal
CN104243320A (en) * 2014-09-10 2014-12-24 珠海市君天电子科技有限公司 Method and device for optimizing network access paths

Also Published As

Publication number Publication date
CN106714206A (en) 2017-05-24

Similar Documents

Publication Publication Date Title
CN106714206B (en) Method and device for detecting wireless network access point connecting network
US10757102B2 (en) Methods, apparatus, and systems for identity authentication
EP3072334B1 (en) Method, system and apparatus for automatically connecting to wlan
US20170163628A1 (en) User login methods, devices, and systems
US8296428B2 (en) Mechanism to detect restricted access via internet hotspot
CN107197462B (en) Wireless network type detection method and device and electronic equipment
CN104092811A (en) Mobile terminal information download method, system, terminal device and server
US10044720B2 (en) Mashup method, computer-readable recording medium, and terminal
US20150242602A1 (en) Network authentication method for secure user identity verification using user positioning information
CN105657781B (en) WiFi network access method and device
CN108574721B (en) Login method, device, server, user terminal and readable storage medium
CN111953761B (en) Data processing method, device, electronic equipment and storage medium
US9729483B2 (en) Anonymous calling and/or texting via content provider web sites and applications
CN106534280B (en) Data sharing method and device
CN107979577B (en) Terminal authentication method and device
CN109951549B (en) Network page access method and device and computer readable storage medium
CN111756840A (en) Message pushing method and device
CN108737350B (en) Information processing method and client
CN114585055A (en) Vehicle-mounted WiFi access method, vehicle controller, cloud server and mobile terminal
KR20130123149A (en) Method for data network access authentication and an electronic device thereof
CN114338130A (en) Information processing method, device, server and storage medium
EP3148233B1 (en) Implementation method and apparatus for virtual communication card
CN108471635B (en) Method and apparatus for connecting wireless access points
CN111010400A (en) Portal authentication method and device
CN105791568B (en) Information processing method and terminal thereof

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