CN107332741B - A kind of network detecting method, network detection device and intelligent terminal - Google Patents
A kind of network detecting method, network detection device and intelligent terminal Download PDFInfo
- Publication number
- CN107332741B CN107332741B CN201710740270.XA CN201710740270A CN107332741B CN 107332741 B CN107332741 B CN 107332741B CN 201710740270 A CN201710740270 A CN 201710740270A CN 107332741 B CN107332741 B CN 107332741B
- Authority
- CN
- China
- Prior art keywords
- network
- tcp
- wlan
- connection
- http
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/24—Negotiation of communication capabilities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W84/00—Network topologies
- H04W84/02—Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
- H04W84/10—Small scale networks; Flat hierarchical networks
- H04W84/12—WLAN [Wireless Local Area Networks]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses a kind of network detecting method, network detection device, intelligent terminal and computer readable storage mediums, wherein, the network detecting method include: intelligent terminal access WLAN after, while start hypertext transfer protocol HTTP detection and transmission control protocol TCP detection;The HTTP detection are as follows: HTTP connection request is sent to preset first server by the WLAN, HTTP testing result is obtained according to the connection state of the intelligent terminal and the first server;The TCP detection are as follows: be periodically detected the TCP state of the intelligent terminal current network connection, TCP testing result is obtained according to the TCP state;In preset detection time, obtained HTTP testing result is detected based on this HTTP and/or this TCP detects the WLAN that obtained TCP testing result determines that the intelligent terminal is currently accessed as can surf the Internet network or the network that can not surf the Internet.The present invention program improves the efficiency of the network state of detection WLAN.
Description
Technical field
The invention belongs to net application technology field more particularly to a kind of network detecting methods, network detection device, intelligence
Terminal and computer readable storage medium.
Background technique
With the fast development of mechanics of communication, wireless network, especially WLAN (Wireless Local Area
Net, WLAN) various aspects are all widely applied in life.Since WLAN does not need to be routed, and transmission speed
Comparatively fast, it is thus possible to make up the deficiency of limited local area network well.And current almost all of intelligent terminal is all supported to pass through nothing
Line fidelity (Wireless Fidelity, Wi-Fi) accesses the hot spot (Hotspot) of WLAN to realize function of surfing the Net.
However, the hot spot that many public places provide is web authentication hot spot, user needs after accessing web authentication hot spot
Input authentication information could access internet;Also some public places provide hot spot due to the number of visiting people it is excessive so that user
The speed for accessing internet is excessively slow, or even can not access internet.Which results in many cases, since user can not be known
The state of hot spot, and be unaware of intelligent terminal and still cannot get online after accessing hot spot, waste the time of user.
Summary of the invention
It can in view of this, the present invention provides a kind of network detecting method, network detection device, intelligent terminal and computers
Read storage medium, it is intended to which the network state for the WLAN that timely learning is currently accessed is improved to the wireless office being currently accessed
The speed and efficiency of the network detection of domain net.
First aspect present invention provides a kind of network detecting method, and above-mentioned network detecting method includes:
After intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP detection and passing transport control protocol
Discuss TCP detection;
Above-mentioned HTTP detection are as follows: HTTP connection request is sent to preset first server by above-mentioned WLAN,
HTTP testing result is obtained according to the connection state of above-mentioned intelligent terminal and above-mentioned first server;
Above-mentioned TCP detection are as follows: the TCP state of above-mentioned intelligent terminal current network connection is periodically detected, according to above-mentioned TCP
State obtains TCP testing result;
In preset detection time, obtained HTTP testing result and/or this TCP inspection are detected based on this HTTP
Survey WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can surf the Internet network or can not on
Net network.
Second aspect of the present invention provides a kind of network detection device, and above-mentioned network detection device includes:
Detection unit is used for after intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP inspection
It surveys and transmission control protocol TCP detects;
Determination unit, for detecting obtained HTTP testing result based on this HTTP in preset detection time
And/or this TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can on
Net network or the network that can not surf the Internet;
Wherein, above-mentioned detection unit includes:
HTTP detection unit is asked for sending HTTP connection to preset first server by above-mentioned WLAN
It asks, HTTP testing result is obtained according to the connection state of above-mentioned intelligent terminal and above-mentioned first server;
TCP detection unit, for being periodically detected the TCP state of above-mentioned intelligent terminal current network connection, according to above-mentioned
TCP state obtains TCP testing result.
Third aspect present invention provides a kind of intelligent terminal, including memory, and processor and storage are on a memory simultaneously
The computer program that can be run on a processor, above-mentioned processor are realized in above-mentioned first aspect when executing above-mentioned computer program
The network detecting method referred to.
Fourth aspect present invention provides a kind of computer readable storage medium, is stored on the computer readable storage medium
Computer program, above-mentioned computer program realize the network detecting method referred in above-mentioned first aspect when being executed by processor.
Therefore in the present invention program, after intelligent terminal accesses WLAN, while starting Hyper text transfer
Agreement HTTP detection and transmission control protocol TCP detection, wherein above-mentioned HTTP detection are as follows: by above-mentioned WLAN to pre-
If first server send HTTP connection request, obtained according to above-mentioned intelligent terminal and the connection state of above-mentioned first server
HTTP testing result, above-mentioned TCP detection are as follows: the TCP state of above-mentioned intelligent terminal current network connection is periodically detected, according to upper
It states TCP state and obtains TCP testing result, then in preset detection time, obtained HTTP is detected based on this HTTP
Testing result and/or this TCP detect obtained TCP testing result and determine the wireless local area that above-mentioned intelligent terminal is currently accessed
Net is can surf the Internet network or the network that can not surf the Internet.After intelligent terminal accesses WLAN, due to being in WLAN
When under heterogeneous networks state, the time used in the result of acquisition HTTP detection and TCP detection is different, thus the present invention program passes through together
The network state of the WLAN for knowing intelligent terminal access of prestissimo is capable of in Shi Jinhang HTTP detection and TCP detection,
The waiting time for reducing user, the WLAN for avoiding the occurrence of intelligent terminal access can not surf the Internet, and user is unwitting
Situation.
Detailed description of the invention
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art
Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only of the invention some
Embodiment for those of ordinary skill in the art without any creative labor, can also be according to these
Attached drawing obtains other attached drawings.
Fig. 1 is network detecting method one embodiment implementation process schematic diagram provided by the invention;
Fig. 2 is the specific implementation flow schematic diagram that HTTP is detected in network detecting method step 101 provided by the invention;
Fig. 3 is the specific implementation flow schematic diagram that TCP is detected in network detecting method step 101 provided by the invention;
Fig. 4 is another embodiment implementation process schematic diagram of network detecting method provided by the invention;
Fig. 5 is network detection device one embodiment structural schematic diagram provided by the invention;
Fig. 6 is intelligent terminal one embodiment structural schematic diagram provided by the invention.
Specific embodiment
In being described below, for illustration and not for limitation, the tool of such as particular system structure, technology etc is proposed
Body details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific
The present invention also may be implemented in the other embodiments of details.In other situations, it omits to well-known system, device, electricity
The detailed description of road and method, in case unnecessary details interferes description of the invention.
In order to illustrate the technical solution of the present invention, the following is a description of specific embodiments.
Embodiment one
A kind of network detecting method provided in an embodiment of the present invention is described below, referring to Fig. 1, the present invention is implemented
Example in network detecting method include:
In a step 101, after intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP detection
And transmission control protocol TCP detection;
In embodiments of the present invention, above-mentioned intelligent terminal accesses WLAN, can be intelligent terminal and has received user
The link order of input, and WLAN determined by above-mentioned link order is accessed based on above-mentioned link order, alternatively, can also
Be under the Wi-Fi mode of intelligent terminal, by the WLAN that can be accessed under intelligent terminal active scan current environment,
And any WLAN that intelligent terminal can access under current environment is actively accessed by intelligent terminal, wherein above-mentioned by intelligence
Any WLAN that energy terminal actively accesses intelligent terminal under current environment and can access can be under access current environment
The strongest WLAN of signal is also possible to access a WLAN being randomly assigned under current environment, may be used also
To be to access above-mentioned intelligent terminal under current environment once to access a most WLAN of number, it is not construed as limiting herein.?
Intelligent terminal access WLAN after, can immediately or wait certain time triggering intelligent terminal simultaneously start HTTP detection
And TCP detection;Wherein, above-mentioned HTTP detection are as follows: HTTP is sent to preset first server by above-mentioned WLAN and is connected
Request is connect, HTTP testing result is obtained according to the connection state of above-mentioned intelligent terminal and above-mentioned first server;Above-mentioned TCP detection
Are as follows: it is periodically detected the TCP state of above-mentioned intelligent terminal current network connection, TCP detection knot is obtained according to above-mentioned TCP state
Fruit.
Further, Fig. 2 shows the specific implementation flow that HTTP in step 101 is detected, details are as follows:
In step 201, hypertext transfer protocol is sent to preset first server by above-mentioned WLAN
HTTP connection request;
In step 202, if with above-mentioned first server successful connection, it is determined that this HTTP testing result is to connect into
Function;
In step 203, it if with above-mentioned first server connection failure, is determined according to the HTTP state value received
State whether WLAN is certification network;
Optionally, the HTTP state value that above-mentioned basis receives determines whether above-mentioned WLAN is certification network, tool
Body includes: to consult after having sent HTTP connection request to above-mentioned first server the HTTP state value received;If
Above-mentioned HTTP state value indicates during connecting above-mentioned first server, being requested access to above-mentioned first server
Associated uniform resource locator (Uniform Resource Locator, URL) is redirected, then further detection redirects
Whether the page associated by URL afterwards includes preset keyword, such as the keywords such as " user name ", " login name ", " password ";
If the page associated by the URL after redirecting includes preset keyword, it is determined that above-mentioned WLAN is certification network.When
So, can also detect whether above-mentioned WLAN is certification network otherwise, be not construed as limiting herein.It should be noted that
, above-mentioned preset keyword is only exemplary.
In step 204, however, it is determined that above-mentioned WLAN is certification network, it is determined that this HTTP testing result is to connect
Receive limit;
In step 205, however, it is determined that above-mentioned WLAN is not certification network, it is determined that this HTTP testing result is
Connection failure.
Optionally, it is contemplated that the reason of with above-mentioned first server connection failure may not be above-mentioned WLAN, and
The reason of being above-mentioned first server itself, in step 201, other than sending HTTP connection request to first server,
HTTP connection request can also be sent to preset second server by way of multi-thread concurrent;If with above-mentioned first service
Device and/or above-mentioned second server successful connection, it is determined that this HTTP testing result is successful connection;If with above-mentioned first clothes
Business device and second server are all connected with failure, then execute again and determine that above-mentioned WLAN is according to the HTTP state value received
The step for no network for certification and subsequent step.
Further, Fig. 3 shows the specific implementation flow that TCP is detected in step 101, and details are as follows:
In step 301, the ginseng of socket Socket all in the kernel of current above-mentioned intelligent terminal is periodically acquired
Number information;
In embodiments of the present invention, when being periodically detected the TCP state of current network connection, first from intelligent terminal
In kernel, periodically acquire there is currently all Socket parameter information.Specifically, for any Socket,
The parameter information of the Socket obtained in step 201 includes but is not limited to state (state) information, retransmission time out
(Retransmission Time-Out, rto) information, round-trip delay (Round-Trip Time, rtt) information, response timeout
(ACKnowledge Time-Out, ato) information.
Optionally, above-mentioned steps 301 specifically:
Detecting in the kernel of current above-mentioned intelligent terminal whether there is Socket;
If Socket is not present in the kernel of current above-mentioned intelligent terminal, it is determined that the TCP state of current network connection is
Connection failure;
If periodically acquiring the interior of current above-mentioned intelligent terminal there are Socket in the kernel of current above-mentioned intelligent terminal
The parameter information of all Socket in core.
Wherein, once intelligent terminal has accessed WLAN, then can detecte in the kernel of current intelligent terminal whether
There are Socket.Since when intelligent terminal is in the state that can be surfed the Internet, the system background of most intelligent terminals can be created actively
It builds Socket and carries out TCP connection, therefore, it is possible to be primarily determined currently by the quantity of the Socket in kernel with the presence or absence of TCP
Connection.If Socket is not present in the kernel of above-mentioned intelligent terminal, mean that currently also there is no chains corresponding with Socket
Road, that is, there is currently no TCP connections, therefore, it is possible to determine that the TCP state of current network connection is connection failure;And current
There are the parameter informations that when Socket, then can periodically acquire current each Socket in kernel.
In step 302, the parameter information based on each Socket judges the class of link corresponding with each Socket respectively
Type;
In embodiments of the present invention, the parameter information based on each Socket in kernel judges and each Socket pairs respectively
The Linktype answered.Specifically, above-mentioned Linktype includes network difference link, and network limited link does not use link, do not close
Closed chain road.Wherein, if the state parameter of Socket is not TCP_SYN_SENT, and rtt parameter is greater than preset rtt threshold value (ratio
Such as 10000000), when and link corresponding with the Socket there is the data packet retransmitted or the data packet not responded, it is determined that
Link corresponding with the Socket is network difference link;If the state parameter of Socket be TCP_SYN_SENT, and with this
When the corresponding link last time transmission packet time of Socket is equal with the last time received data packet time, it is determined that with
The corresponding link of the Socket is network limited link;If Socket corresponding link last time sends packet time, most
A received data packet time and last time reception response (Acknowledge, ACK) time are all larger than preset period threshold afterwards
When value, it is determined that link corresponding with the Socket is not use link;If the state parameter of Socket is not TCP_
CLOSE_WAIT, it is determined that link corresponding with the Socket is to be not turned off link.It should be noted that allowing a Socket institute
Corresponding link belongs to the type of the above two above link simultaneously, is not construed as limiting herein, for example, network limited link is inevitable
To be not turned off link, then a link for network limited link and can be not turned off link simultaneously.
In step 303, according to the quantitative relation between different types of link, the TCP shape of current network connection is determined
State;
In embodiments of the present invention, it according to the quantitative relation between the link of each type obtained in step 202, determines
The TCP state of current network connection.It is alternatively possible to which whether the TCP state for determining current network connection first is successful connection;
If the TCP state of current network connection is not successful connection, whether the TCP state for continuing to test current network connection is connection
Failure;If the TCP state of current network connection is not connection failure, the TCP state for being further continued for detection current network connection is
It is no to be limited for connection.Specifically, determine current network connection TCP state whether be successful connection before, can first count
The quantity of the bad link of network, wherein the quantity of the above-mentioned bad link of network is the quantity and network difference chain of network limited link
The sum of the quantity on road.
Wherein, whether the TCP state of above-mentioned determining current network connection is successful connection, specifically:
If the first ratio is not more than preset fractional threshold C1, and the second ratio is not more than preset fractional threshold D1, then
Determine current network connection TCP state be successful connection, wherein above-mentioned first ratio be the bad link of network quantity with not
The ratio of the quantity of link is closed, above-mentioned second ratio is not use the quantity of link and the ratio for being not turned off the quantity of link
Value, the value of above-mentioned C1, D1 can be not construed as limiting herein by developer or user's self-setting.
It wherein, is the TCP state of above-mentioned determining current network connection after successful connection above-mentioned TCP state has been determined not
It whether is connection failure, specifically:
If above-mentioned first ratio is not less than preset fractional threshold C2, and above-mentioned second ratio is not less than preset ratio threshold
Value D2, and third ratio is not less than preset fractional threshold E2, it is determined that the TCP state of current network connection is connection failure,
Wherein, above-mentioned third ratio is the ratio of the quantity and the quantity for being not turned off link of network limited link, above-mentioned C2, D2, E2's
Value can be not construed as limiting herein by developer or user's self-setting.
It wherein, is the TCP state of above-mentioned determining current network connection after connection failure above-mentioned TCP state has been determined not
It whether is even to be limited, specifically:
If above-mentioned first ratio is not less than preset fractional threshold C3, and above-mentioned second ratio is not less than preset ratio threshold
Value D3, and third ratio is not less than preset fractional threshold E3, it is determined that the TCP state of current network connection is connection failure,
Wherein, above-mentioned fractional threshold C3 is different from above-mentioned fractional threshold C2, and above-mentioned fractional threshold D3 is different from above-mentioned fractional threshold D2, on
Fractional threshold E3 is stated different from above-mentioned fractional threshold E2, the value of above-mentioned C3, D3, E3 can voluntarily be set by developer or user
It sets, is not construed as limiting herein.
In step 304, if the continuous N1 above-mentioned TCP state of determination is successful connection, it is determined that this TCP testing result
For successful connection;
In embodiments of the present invention, once the continuous N1 above-mentioned TCP state of determination is successful connection in step 303, then really
This fixed TCP testing result is successful connection, and stops executing and above-mentioned periodically acquire current all socket Socket's
The step of parameter information, avoids the operation resource of waste intelligent terminal.
In step 305, if the continuous N2 above-mentioned TCP state of determination is connection failure, it is determined that this TCP testing result
For connection failure;
Within step 306, if the continuous N3 above-mentioned TCP state of determination is that connection is limited, it is determined that this TCP testing result
It is limited to connect;
In embodiments of the present invention, when above-mentioned TCP state is network limited, it is meant that net locating for intelligent terminal at this time
Network is restricted network, that is, the WLAN that intelligent terminal is connected at this time is likely to certification network.Therefore, once
It detects that above-mentioned TCP state is the limited state of connection, then exports reminder message at once, to prompt user to carry out authentication.
Above-mentioned reminder message can be exported in a manner of audio, can also be exported in a manner of text, be not construed as limiting herein.
Optionally, above-mentioned N1 is less than above-mentioned N2, and above-mentioned N2 is less than above-mentioned N3.Due to obtaining the time phase of TCP state every time
Together, it enables to when the network connection state of above-mentioned WLAN is good, it in a short time can be by detecting current net
The TCP state of network connection quickly determines that above-mentioned WLAN is the network that can surf the Internet;In the network connection of above-mentioned WLAN
When being not in good state, by the slightly detection to the TCP state of current network connection for a long time, the net to above-mentioned WLAN is avoided
Network connection status makes false judgment;And when above-mentioned WLAN is restricted network, it is needed due to carrying out authentication operation
The regular hour is expended, in order to set apart to user, the larger value can be taken to above-mentioned N3, therefore N3 can be enabled to be greater than herein
N2。
In a step 102, in preset detection time, obtained HTTP testing result is detected based on this HTTP
And/or this TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can on
Net network or the network that can not surf the Internet.
In embodiments of the present invention, if above-mentioned steps 102 show themselves in that this HTTP detects obtained HTTP testing result
For successful connection, it is determined that the WLAN that above-mentioned intelligent terminal is currently accessed is the network that can surf the Internet;If this TCP detects institute
Obtained TCP testing result is connection failure, alternatively, if this HTTP detects obtained HTTP testing result and this TCP
Detecting obtained TCP testing result is that connection is limited, it is determined that the WLAN that above-mentioned intelligent terminal is currently accessed is
Can not surf the Internet network.In fact, the speed of HTTP detection is usual if intelligent terminal can be surfed the Internet by above-mentioned WLAN
The speed for being faster than TCP detection is just had been able to really that is, before obtaining TCP testing result by obtained HTTP testing result
The WLAN that fixed above-mentioned intelligent terminal is currently accessed is the network that can surf the Internet, also, when WLAN is the net that can surf the Internet
When network, HTTP testing result can usually obtain within preset first time;It is corresponding, above-mentioned WLAN not
In the case where for certification network, if intelligent terminal can not be surfed the Internet by above-mentioned WLAN, the speed of TCP detection is usual
The speed for being faster than HTTP detection is just had been able to really that is, before obtaining HTTP testing result by obtained TCP testing result
The WLAN that fixed above-mentioned intelligent terminal is currently accessed is the network that can not surf the Internet, also, when WLAN be can not on
When net network, TCP testing result can usually obtain within preset second time;Therefore in this step, since HTTP is examined
The fast speed of successful connection is surveyed, TCP detects the fast speed of connection failure, can by combining HTTP detection and TCP to detect
Quickly determine that the WLAN that intelligent terminal is currently accessed is can not surf the Internet network or the network that can not surf the Internet.Further, by
It is complex relative to the state of connection failure and the state of successful connection in the limited state of connection, in order to improve network detection
Accuracy rate, be only connection by limited time in HTTP testing result and TCP testing result, just the above-mentioned intelligent terminal of determination currently connects
The WLAN entered is the network that can not surf the Internet.
Optionally, above-mentioned to be detected obtained by obtained HTTP testing result and/or this TCP detection based on this HTTP
TCP testing result determine WLAN that above-mentioned intelligent terminal is currently accessed be can surf the Internet network or can not surf the Internet network it
Afterwards, alternatively, after the arrival of above-mentioned detection time, above-mentioned network detecting method further include:
If this TCP detection and/or this HTTP detection still in operation, stop this TCP detection and/or this
HTTP detection.
Wherein, slightly larger than the one time HTTP detection of above-mentioned preset detection time or a TCP detection normally expend most
For a long time.Once having determined that whether above-mentioned WLAN can surf the Internet, in order to save the operation resource of intelligent terminal, avoid
Intelligent terminal executes unnecessary network detection operation, when this TCP is detected and/or this HTTP is detected still in operation,
Stop this TCP detection and/or this HTTP detection.Further, if not determined yet above-mentioned after the arrival of above-mentioned detection time
Whether the WLAN that intelligent terminal is currently accessed can surf the Internet, then may be during HTTP detection and/or TCP detect
This network detection time-out caused by there is a problem, at this point, if this TCP detection and/or this HTTP detection are still being transported
In row, similarly stop this TCP detection and/or this HTTP detection, and waits under certain time triggering intelligent terminal starting
Secondary HTTP detection and TCP detection.
Therefore through the embodiment of the present invention, after intelligent terminal accesses WLAN, due in WLAN
When under heterogeneous networks state, it is different to obtain the time used in the result of HTTP detection and TCP detection, thus passes through while carrying out
HTTP detection and TCP detection, are capable of the network state for knowing WLAN of prestissimo, reduce the waiting time of user,
The WLAN for avoiding the occurrence of intelligent terminal access can not surf the Internet, and the unwitting situation of user.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
Embodiment two
On the basis of example 1, another network detecting method provided in an embodiment of the present invention is retouched below
It states, referring to Fig. 4, the network detecting method in the embodiment of the present invention includes:
In step 401, after intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP detection
And transmission control protocol TCP detection;
In embodiments of the present invention, above-mentioned steps 401 are identical as above-mentioned steps 101, and for details, reference can be made to the correlations of step 101
Description, details are not described herein.
In step 402, in preset detection time, obtained HTTP testing result is detected based on this HTTP
And/or this TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can on
Net network or the network that can not surf the Internet;
In embodiments of the present invention, above-mentioned steps 402 are identical as above-mentioned steps 102, and for details, reference can be made to the correlations of step 102
Description, details are not described herein.
In step 403, if above-mentioned WLAN is confirmed as the network that can not surf the Internet, disconnect above-mentioned intelligent terminal with
The connection of above-mentioned WLAN;
In embodiments of the present invention, since above-mentioned WLAN has been confirmed as the network that can not surf the Internet, if intelligent terminal
It still keeps accessing above-mentioned WLAN, then can default using the WLAN of access and carry out network access, and currently connect
The WLAN entered can not be actually attached with outer net again, this can be brought to user using upper inconvenience, be influenced
The operability of intelligent terminal.In order to avoid the generation of above situation, it is confirmed as the net that can not surf the Internet in above-mentioned WLAN
After network, the connection of above-mentioned intelligent terminal Yu above-mentioned WLAN is disconnected, avoids bringing to user and has accessed wireless local area
Net still can not but access the doubt of outer net.Disconnect with after the connection of above-mentioned WLAN, can in a manner of text or
The mode active warning user of person's audio since the network state of current wireless Local Area Network is bad, intelligent terminal it is already off with it is upper
State the connection of WLAN.
Optionally, if above-mentioned WLAN is confirmed as the network that can not surf the Internet, above-mentioned network detecting method further include:
Within the preset disabling time, above-mentioned WLAN is disabled.
Wherein, since above-mentioned WLAN has been determined the network that can not surf the Internet, in order to avoid intelligent terminal is manual
It disconnects or automatically accesses above-mentioned WLAN again after disconnecting the connection with above-mentioned WLAN automatically, it can be preset
It disables in the time, disables above-mentioned WLAN, and record the forbidden number of above-mentioned WLAN.Optionally, above-mentioned pre-
If the disabling time can be a definite value of intelligent terminal setting, such as five minutes, be not construed as limiting herein.
Optionally, above-mentioned within the preset disabling time, disabling above-mentioned WLAN includes:
Obtain the forbidden number of above-mentioned WLAN of current record;
The disabling time of above-mentioned WLAN is set according to the forbidden number of above-mentioned WLAN of current record;
Within the disabling time of above-mentioned WLAN, above-mentioned WLAN is disabled;
Update the forbidden number of above-mentioned WLAN of current record.
Wherein, the above-mentioned disabling time can be with the forbidden number direct proportionality of above-mentioned WLAN.For example, right
In a certain WLAN A, when disabling WLAN A for the first time, the disabling time is 5 minutes;It is somebody's turn to do in second of disabling
When WLAN A, the disabling time is 10 minutes;When disabling WLAN A for the third time, the disabling time is 15 minutes,
That is, the disabling time to the WLAN is incremented by with being incremented by for disabling number of the WLAN.It should be noted that
That the above-mentioned disabling time is only exemplary, in practical applications, the above-mentioned disabling time can according to the demand of user and into
Row change, is not construed as limiting herein.Also, when WLAN is disabled, corresponding forbidden number can also be obtained
It updates.
Optionally, in order to improve the efficiency that user manually selects WLAN, above-mentioned network detecting method further include:
In WLAN alternate list, show that each attachable WLAN was once accessed by above-mentioned intelligent terminal
Number and the number that is once disabled by above-mentioned intelligent terminal.
Wherein, each due to usually only being shown in WLAN alternate list when user connects WLAN manually
The signal strength of WLAN, so that the signal that user has also only taken into account WLAN when selecting WLAN is strong
Degree, and whether the WLAN for having ignored selection is able to carry out network access.In fact, nothing open in many public places
The hot spot of line local area network, although the signal strength of hot spot is stronger, due to the number of access is excessive or due to the hot spot nothing
Line local area network is certification network, and cannot achieve function of surfing the Net at all after causing intelligent terminal to access the WLAN.In order to
The live network connection status of each WLAN is enabled to be Ke Yi known to user before user manually selects network
In WLAN alternate list, number that each attachable WLAN was once accessed by above-mentioned intelligent terminal and once is shown
The number disabled by above-mentioned intelligent terminal, wherein the above-mentioned attachable current intelligent terminal of WLAN does not access also
WLAN.For example, if there are tri- attachable WLANs of A, B, C, total connections of A in WLAN list
Number is 10 times, and disabled number is 8 times, and signal strength is strong;Total connection number of B is 5 times, and disabled number is 0 time, letter
Number intensity is relatively strong;Total connection number of C be 8 times, disabled number be 3 times, signal strength be it is strong, above-mentioned total connection number is
The number that WLAN was once accessed by above-mentioned intelligent terminal, above-mentioned disabled number are that WLAN was once whole by above-mentioned intelligence
Hold the number of disabling.Since user directly can know that the history of each WLAN connects by WLAN alternate list
Situation selects suitable WLAN to be attached in conjunction with the signal strength of each WLAN, thus in above-mentioned example
In, it is contemplated that each hot spot once forbidden situation, user very greatly may selection signal intensity be only stronger wireless local area
Net B, rather than the WLAN A or C that signal is strong.
Therefore through the embodiment of the present invention, intelligence is determined eventually in the testing result by HTTP detection and TCP detection
Holding the WLAN being currently accessed is that active is disconnected the connection with the WLAN being currently accessed after can not surfing the Internet network
It avoids bringing to user and has accessed WLAN but and still can not access the doubt of outer net;Above-mentioned nothing will be also disabled simultaneously
Line local area network for a period of time, the WLAN that can not be surfed the Internet mistakenly actively is accessed to avoid intelligent terminal.
Embodiment three
The embodiment of the present invention also provides a kind of network detection device, as shown in figure 5, the network in the embodiment of the present invention detects
Device 500 includes:
Detection unit 501 is used for after intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP
Detection and transmission control protocol TCP detection;
Determination unit 502, for detecting obtained HTTP detection knot based on this HTTP in preset detection time
Fruit and/or this TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can
Online network or the network that can not surf the Internet;
Wherein, above-mentioned detection unit 501 includes:
HTTP detection unit 5011, for sending HTTP connection to preset first server by above-mentioned WLAN
Request obtains HTTP testing result according to the connection state of above-mentioned intelligent terminal and above-mentioned first server;
TCP detection unit 5012, for being periodically detected the TCP state of above-mentioned intelligent terminal current network connection, according to
Above-mentioned TCP state obtains TCP testing result.
Optionally, above-mentioned network detection device 500 further include:
Stop unit, for detecting obtained HTTP testing result and/or this TCP detection institute based on this HTTP
Obtained TCP testing result determines that the WLAN that above-mentioned intelligent terminal is currently accessed is can surf the Internet network or the net that can not surf the Internet
After network, alternatively, after the arrival of above-mentioned detection time, if this TCP detection and/or this HTTP detection are still in operation,
Then stop this TCP detection and/or this HTTP detection.
Optionally, above-mentioned network detection device 500 further include:
Switching units are connected, the WLAN for being currently accessed when determining above-mentioned intelligent terminal is the network that can not surf the Internet
When, disconnect the connection of above-mentioned intelligent terminal Yu above-mentioned WLAN.
Optionally, above-mentioned network detection device 500 further include:
WLAN forbidden cell, the WLAN for being currently accessed when determining above-mentioned intelligent terminal is can not
When net network, within the preset disabling time, above-mentioned WLAN is disabled.
Optionally, above-mentioned WLAN forbidden cell includes:
It disables number and obtains subelement, for obtaining the forbidden number of above-mentioned WLAN of current record;
Time setting subelement is disabled, for the forbidden number setting of above-mentioned WLAN according to current record
State the disabling time of WLAN;
Network disables subelement, for disabling above-mentioned WLAN within the disabling time of above-mentioned WLAN;
It disables number and updates subelement, for updating the forbidden number of above-mentioned WLAN of current record.
Optionally, above-mentioned network detection device 500 further include:
Alternate list display unit, for showing each attachable wireless local area in WLAN alternate list
The number that net was once disabled by number that above-mentioned intelligent terminal accesses and once by above-mentioned intelligent terminal, above-mentioned attachable wireless local area
Net is the WLAN that current intelligent terminal does not access.
Optionally, above-mentioned determination unit 502, is specifically used for, if this obtained HTTP inspection of above-mentioned HTTP detection unit
Survey result is successful connection, it is determined that the WLAN that above-mentioned intelligent terminal is currently accessed is the network that can surf the Internet;
Optionally, above-mentioned determination unit 502, is specifically used for, if this obtained TCP detection of above-mentioned HTTP detection unit
It as a result is connection failure, alternatively, if this obtained HTTP testing result of above-mentioned HTTP detection unit and above-mentioned TCP detection are single
This first obtained TCP testing result is that connection is limited, it is determined that the WLAN that above-mentioned intelligent terminal is currently accessed
For the network that can not surf the Internet.
Optionally, above-mentioned HTTP detection unit 5011 includes:
HTTP request subelement is asked for sending HTTP connection to preset first server by above-mentioned WLAN
It asks;
HTTP determines subelement, if being used for and above-mentioned first server successful connection, it is determined that this HTTP testing result
For successful connection;
HTTP detection sub-unit, if the HTTP state for being received with above-mentioned first server connection failure, basis
Value determines whether above-mentioned WLAN is certification network;
Above-mentioned HTTP determines subelement, determines above-mentioned WLAN for certification if being also used to above-mentioned HTTP detection sub-unit
Network, it is determined that this HTTP testing result is that connection is limited, if above-mentioned HTTP detection sub-unit determines above-mentioned WLAN
It is not certification network, it is determined that this HTTP testing result is connection failure.
Optionally, above-mentioned TCP detection unit 5012 includes:
Acquisition of information subelement, for periodically acquiring socket all in the currently kernel of above-mentioned intelligent terminal
The parameter information of Socket;
Link judgment sub-unit judges chain corresponding with each Socket for the parameter information based on each Socket respectively
The type on road;
TCP state determines subelement, for determining that current network connects according to the quantitative relation between different types of link
The TCP state connect;
TCP determines subelement, if determining the subelement above-mentioned TCP state of continuous N1 determination for above-mentioned TCP state to connect
It is connected into function, it is determined that this TCP testing result is successful connection, if above-mentioned TCP state determines in the continuous N2 determination of subelement
Stating TCP state is connection failure, it is determined that this TCP testing result is connection failure, if above-mentioned TCP state determines that subelement connects
The continuous N3 above-mentioned TCP state of determination is that connection is limited, it is determined that this TCP testing result is that connection is limited.
Optionally, above- mentioned information acquisition subelement includes:
Quantity detection sub-unit whether there is Socket in the kernel for detecting current intelligent terminal;
Subelement is obtained, if there are Socket in the kernel for current intelligent terminal, periodically acquires current intelligence
The parameter information of all Socket in the kernel of energy terminal.
Optionally, above-mentioned TCP state determines subelement, specifically for detecting current intelligence when above-mentioned quantity detection sub-unit
When Socket is not present in the kernel of energy terminal, determine that the TCP state of current network connection is connection failure.
Therefore through the embodiment of the present invention, after intelligent terminal accesses WLAN, due in WLAN
When under heterogeneous networks state, time difference used in the result of HTTP detection and TCP detection, thus network detection device are obtained
By carrying out HTTP detection and TCP detection simultaneously, it is capable of the network state for knowing WLAN of prestissimo, reduces user
Waiting time, the WLAN for avoiding the occurrence of intelligent terminal access can not surf the Internet, and the unwitting situation of user.
Example IV
The embodiment of the present invention provides a kind of intelligent terminal, referring to Fig. 6, the intelligent terminal in the embodiment of the present invention includes:
Memory 601, one or more processors 602 (one is only shown in Fig. 6) and is stored on memory 601 and can be in processor
The computer program of upper operation.Wherein: memory 601 is deposited for storing software program and module, processor 602 by operation
The software program and unit in memory 601 are stored up, it is above-mentioned pre- to obtain thereby executing various function application and data processing
If the corresponding resource of event.Specifically, processor 602 is stored real in the above-mentioned computer program of memory 601 by operation
Existing following steps:
After intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP detection and passing transport control protocol
Discuss TCP detection;
Above-mentioned HTTP detection are as follows: HTTP connection request is sent to preset first server by above-mentioned WLAN,
HTTP testing result is obtained according to the connection state of above-mentioned intelligent terminal and above-mentioned first server;
Above-mentioned TCP detection are as follows: the TCP state of above-mentioned intelligent terminal current network connection is periodically detected, according to above-mentioned TCP
State obtains TCP testing result;
In preset detection time, obtained HTTP testing result and/or this TCP inspection are detected based on this HTTP
Survey WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can surf the Internet network or can not on
Net network.
Assuming that it is above-mentioned be the first possible embodiment, then based on the first above-mentioned possible embodiment and
In second of the possible embodiment provided, it is above-mentioned based on this HTTP detect obtained HTTP testing result and/or
It is the net that can surf the Internet that this TCP, which detects the WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed,
After network or the network that can not surf the Internet, alternatively, processor 602 is stored in storage by operation after the arrival of above-mentioned detection time
It is also performed the steps of when the above-mentioned computer program of device 601
If this TCP detection and/or this HTTP detection still in operation, stop this TCP detection and/or this
HTTP detection.
In the third the possible embodiment provided based on the first above-mentioned possible embodiment, if really
The WLAN that fixed above-mentioned intelligent terminal is currently accessed is the network that can not surf the Internet, then processor 602 is stored in by operation
It is also performed the steps of when the above-mentioned computer program of reservoir 601
Disconnect the connection of above-mentioned intelligent terminal Yu above-mentioned WLAN.
In the 4th kind of possible embodiment provided based on the first above-mentioned possible embodiment, if really
The WLAN that fixed above-mentioned intelligent terminal is currently accessed is the network that can not surf the Internet, then processor 602 is stored in by operation
It is also performed the steps of when the above-mentioned computer program of reservoir 601
Within the preset disabling time, above-mentioned WLAN is disabled.
It is above-mentioned in the 5th kind of possible embodiment provided based on above-mentioned 4th kind of possible embodiment
Within the preset disabling time, above-mentioned WLAN is disabled, comprising:
Obtain the forbidden number of above-mentioned WLAN of current record;
The disabling time of above-mentioned WLAN is set according to the forbidden number of above-mentioned WLAN of current record;
Within the disabling time of above-mentioned WLAN, above-mentioned WLAN is disabled;
Update the forbidden number of above-mentioned WLAN of current record.
In the 6th kind of possible embodiment provided based on above-mentioned 5th kind of possible embodiment, processing
Device 602 is stored by operation and is also performed the steps of in the above-mentioned computer program of memory 601
In WLAN alternate list, show that each attachable WLAN was once accessed by above-mentioned intelligent terminal
Number and the number that is once disabled by above-mentioned intelligent terminal, above-mentioned attachable WLAN be that current intelligent terminal does not access
WLAN.
Based on the first above-mentioned possible embodiment or above-mentioned second of possible embodiment is as base
Plinth is perhaps based on the third above-mentioned possible embodiment or based on above-mentioned 4th kind of possible embodiment,
Perhaps it is mentioned based on above-mentioned 5th kind of possible embodiment or based on above-mentioned 6th kind of possible embodiment
In the 7th kind of possible embodiment supplied, it is above-mentioned based on this HTTP detect obtained HTTP testing result and/or this
TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can surf the Internet network or
Can not surf the Internet network, comprising:
If it is successful connection that this HTTP, which detects obtained HTTP testing result, it is determined that above-mentioned intelligent terminal currently connects
The WLAN entered is the network that can surf the Internet;
Based on the first above-mentioned possible embodiment or above-mentioned second of possible embodiment is as base
Plinth is perhaps based on the third above-mentioned possible embodiment or based on above-mentioned 4th kind of possible embodiment,
Perhaps it is mentioned based on above-mentioned 5th kind of possible embodiment or based on above-mentioned 6th kind of possible embodiment
In the 8th kind of possible embodiment supplied, it is above-mentioned based on this HTTP detect obtained HTTP testing result and/or this
TCP detect WLAN that obtained TCP testing result determines that above-mentioned intelligent terminal is currently accessed be can surf the Internet network or
Can not surf the Internet network, comprising:
If it is connection failure that this TCP, which detects obtained TCP testing result, alternatively, if obtained by this HTTP detection
HTTP testing result and this TCP to detect obtained TCP testing result be that connection is limited, it is determined that above-mentioned intelligent terminal
The WLAN being currently accessed is the network that can not surf the Internet.
Based on the first above-mentioned possible embodiment or above-mentioned second of possible embodiment is as base
Plinth is perhaps based on the third above-mentioned possible embodiment or based on above-mentioned 4th kind of possible embodiment,
Perhaps it is mentioned based on above-mentioned 5th kind of possible embodiment or based on above-mentioned 6th kind of possible embodiment
In the 9th kind of possible embodiment supplied, HTTP is sent to preset first server above by above-mentioned WLAN and is connected
Request is connect, HTTP testing result is obtained according to the connection state of above-mentioned intelligent terminal and above-mentioned first server, comprising:
HTTP connection request is sent to preset first server by above-mentioned WLAN;
If with above-mentioned first server successful connection, it is determined that this HTTP testing result is successful connection;
If determining above-mentioned WLAN according to the HTTP state value received with above-mentioned first server connection failure
It whether is certification network;
If it is determined that above-mentioned WLAN is certification network, it is determined that this HTTP testing result is that connection is limited;
If it is determined that above-mentioned WLAN is not certification network, it is determined that this HTTP testing result is connection failure.
Based on the first above-mentioned possible embodiment or above-mentioned second of possible embodiment is as base
Plinth is perhaps based on the third above-mentioned possible embodiment or based on above-mentioned 4th kind of possible embodiment,
Perhaps it is mentioned based on above-mentioned 5th kind of possible embodiment or based on above-mentioned 6th kind of possible embodiment
In the tenth kind of possible embodiment supplied, the above-mentioned TCP state for being periodically detected above-mentioned intelligent terminal current network connection, root
TCP testing result is obtained according to above-mentioned TCP state, comprising:
Periodically acquire the parameter information of socket Socket all in the kernel of current above-mentioned intelligent terminal;
Based on the parameter information of each Socket, the type of link corresponding with each Socket is judged respectively;
According to the quantitative relation between different types of link, the TCP state of current network connection is determined;
If the continuous N1 above-mentioned TCP state of determination is successful connection, it is determined that this TCP testing result is successful connection;
If the continuous N2 above-mentioned TCP state of determination is connection failure, it is determined that this TCP testing result is connection failure;
If the continuous N3 above-mentioned TCP state of determination is that connection is limited, it is determined that this TCP testing result is that connection is limited.
In a kind of possible embodiment of the tenth provided based on the above-mentioned ten kind of possible embodiment, on
State the parameter information of socket Socket all in the kernel for periodically acquiring current above-mentioned intelligent terminal, comprising:
Detecting in the kernel of current above-mentioned intelligent terminal whether there is Socket;
If periodically acquiring the interior of current above-mentioned intelligent terminal there are Socket in the kernel of current above-mentioned intelligent terminal
The parameter information of all Socket in core.
In the 12nd kind of possible embodiment provided based on the above-mentioned ten kind of possible embodiment, on
State network detecting method further include:
If Socket is not present in the kernel of current above-mentioned intelligent terminal, it is determined that the TCP state of current network connection is
Connection failure.
Further, as shown in fig. 6, above-mentioned intelligent terminal may also include that one or more input equipments 603 (only show in Fig. 6
One out) and one or more output equipments 604 (one is only shown in Fig. 6).Memory 601, processor 602, input equipment
603 and output equipment 604 connected by bus 605.
It should be appreciated that in embodiments of the present invention, alleged processor 602 can be central processing unit (Central
Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital
Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit,
ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic
Device, discrete gate or transistor logic, discrete hardware components etc..General processor can be microprocessor or this at
Reason device is also possible to any conventional processor etc..
Input equipment 603 may include keyboard, Trackpad, fingerprint adopt sensor (for acquire user finger print information and
The directional information of fingerprint), microphone etc., output equipment 604 may include display, loudspeaker etc..
Memory 601 may include read-only memory and random access memory, and provide instruction sum number to processor 602
According to.Part or all of memory 601 can also include nonvolatile RAM.For example, memory 601 may be used also
With the information of storage device type.
Therefore through the embodiment of the present invention, after accessing WLAN, due to being in difference in WLAN
When under network state, it is different that intelligent terminal obtains the time used in the result of HTTP detection and TCP detection, thus intelligent terminal passes through
Simultaneously carry out HTTP detection and TCP detection, be capable of the network state for knowing WLAN of prestissimo, reduce user etc.
To the time, the WLAN for avoiding the occurrence of intelligent terminal access can not surf the Internet, and the unwitting situation of user.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of above-mentioned apparatus is divided into different functional unit or module, more than completing
The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also
To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated
Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list
Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system
The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device and method can pass through others
Mode is realized.For example, system embodiment described above is only schematical, for example, the division of above-mentioned module or unit,
Only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be with
In conjunction with or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed
Mutual coupling or direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING of device or unit or
Communication connection can be electrical property, mechanical or other forms.
Above-mentioned unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
If above-mentioned integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-described embodiment side
All or part of the process in method can also instruct relevant hardware to complete, above-mentioned computer by computer program
Program can be stored in a computer readable storage medium, and the computer program is when being executed by processor, it can be achieved that above-mentioned each
The step of a embodiment of the method.Wherein, above-mentioned computer program includes computer program code, and above-mentioned computer program code can
Think source code form, object identification code form, executable file or certain intermediate forms etc..Above-mentioned computer-readable medium can be with
It include: any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic disk, light that can carry above-mentioned computer program code
Disk, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random
Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that above-mentioned computer
The content that readable medium includes can carry out increase and decrease appropriate according to the requirement made laws in jurisdiction with patent practice, such as
In certain jurisdictions, according to legislation and patent practice, computer-readable medium do not include be electric carrier signal and telecommunications letter
Number.
Above above-described embodiment is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality
Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.
Claims (24)
1. a kind of network detecting method, which is characterized in that the network detecting method includes:
After intelligent terminal accesses WLAN, while starting hypertext transfer protocol HTTP detection and transmission control protocol
TCP detection;
The HTTP detection are as follows: HTTP connection request is sent to preset first server by the WLAN, according to
The intelligent terminal and the connection state of the first server obtain HTTP testing result;
The TCP detection are as follows: the TCP state of the intelligent terminal current network connection is periodically detected, according to the TCP state
Obtain TCP testing result;
In preset detection time, obtained HTTP testing result is detected based on this HTTP and/or this TCP detects institute
Obtained TCP testing result determines that the WLAN that the intelligent terminal is currently accessed is can surf the Internet network or the net that can not surf the Internet
Network;
Wherein, the TCP state for being periodically detected the intelligent terminal current network connection, obtains according to the TCP state
TCP testing result, comprising:
Periodically acquire the parameter information of socket Socket all in the kernel of presently described intelligent terminal;
Based on the parameter information of each Socket, the type of link corresponding with each Socket is judged respectively;
According to the quantitative relation between different types of link, the TCP state of current network connection is determined;
If the continuous N1 determination TCP state is successful connection, it is determined that this TCP testing result is successful connection;
If the continuous N2 determination TCP state is connection failure, it is determined that this TCP testing result is connection failure;
If the continuous N3 determination TCP state is that connection is limited, it is determined that this TCP testing result is that connection is limited;
Wherein, the type of above-mentioned link includes network difference link, and network limited link does not use link, is not turned off link;Institute
State the TCP state that current network connection is determined according to the quantitative relation between different types of link, comprising:
The quantity of the bad link of statistics network, wherein the quantity of the above-mentioned bad link of network be network limited link quantity and
The sum of the quantity of network difference link;
Whether the TCP state for determining current network connection is successful connection;
If current network connection TCP state be not successful connection, continue to test current network connection TCP state whether be
Connection failure;
If current network connection TCP state be not connection failure, continue to test current network connection TCP state whether be
Connection is limited;
Wherein, whether the TCP state of the determining current network connection is successful connection, comprising:
If the first ratio is not more than preset fractional threshold C1, and the second ratio is not more than preset fractional threshold D1, it is determined that
Current network connection TCP state be successful connection, wherein above-mentioned first ratio be the bad link of network quantity be not turned off
The ratio of the quantity of link, above-mentioned second ratio are not use the quantity of link and the ratio for being not turned off the quantity of link;
Whether the TCP state of the detection current network connection is connection failure, comprising:
If above-mentioned first ratio is not less than preset fractional threshold C2, and above-mentioned second ratio is not less than preset fractional threshold
D2, and third ratio is not less than preset fractional threshold E2, it is determined that the TCP state of current network connection is connection failure,
In, above-mentioned third ratio is the ratio of the quantity and the quantity for being not turned off link of network limited link;
Whether the TCP state of the detection current network connection is that connection is limited, comprising:
If above-mentioned first ratio is not less than preset fractional threshold C3, and above-mentioned second ratio is not less than preset fractional threshold
D3, and third ratio is not less than preset fractional threshold E3, it is determined that the TCP state of current network connection is connection failure,
In, above-mentioned fractional threshold C3 is different from above-mentioned fractional threshold C2, and above-mentioned fractional threshold D3 is different from above-mentioned fractional threshold D2, above-mentioned
Fractional threshold E3 is different from above-mentioned fractional threshold E2.
2. network detecting method as described in claim 1, which is characterized in that described obtained based on this HTTP detection
HTTP testing result and/or this TCP detect obtained TCP testing result and determine that the intelligent terminal is currently accessed wireless
Local area network is after can surfing the Internet network or the network that can not surf the Internet, alternatively, the network detects after reaching between in the detection
Method further include:
If this TCP detection and/or this HTTP detection are still in operation, stop this TCP detection and/or this HTTP inspection
It surveys.
3. network detecting method as described in claim 1, which is characterized in that if it is determined that the nothing that the intelligent terminal is currently accessed
Line local area network is the network that can not surf the Internet, then the network detecting method further include:
Disconnect the connection of the intelligent terminal Yu the WLAN.
4. network detecting method as described in claim 1, which is characterized in that if it is determined that the nothing that the intelligent terminal is currently accessed
Line local area network is the network that can not surf the Internet, then the network detecting method further include:
Within the preset disabling time, the WLAN is disabled.
5. network detecting method as claimed in claim 4, which is characterized in that it is described within the preset disabling time, disable institute
State WLAN, comprising:
Obtain the forbidden number of the WLAN of current record;
The disabling time of the WLAN is set according to the forbidden number of the WLAN of current record;
Within the disabling time of the WLAN, the WLAN is disabled;
Update the forbidden number of the WLAN of current record.
6. network detecting method as claimed in claim 5, which is characterized in that the network detecting method further include:
In WLAN alternate list, time that each attachable WLAN was once accessed by the intelligent terminal is shown
Number and the number once disabled by the intelligent terminal, the attachable WLAN are the nothing that current intelligent terminal does not access
Line local area network.
7. such as network detecting method as claimed in any one of claims 1 to 6, which is characterized in that described to be detected based on this HTTP
Obtained HTTP testing result and/or this TCP detect obtained TCP testing result and determine that the intelligent terminal currently connects
The WLAN entered is can surf the Internet network or the network that can not surf the Internet, comprising:
If it is successful connection that this HTTP, which detects obtained HTTP testing result, it is determined that the intelligent terminal was currently accessed
WLAN is the network that can surf the Internet.
8. such as network detecting method as claimed in any one of claims 1 to 6, which is characterized in that described to be detected based on this HTTP
Obtained HTTP testing result and/or this TCP detect obtained TCP testing result and determine that the intelligent terminal currently connects
The WLAN entered is can surf the Internet network or the network that can not surf the Internet, comprising:
If it is connection failure that this TCP, which detects obtained TCP testing result, alternatively, if this HTTP detection is obtained
It is that connection is limited that HTTP testing result and this TCP, which detect obtained TCP testing result, it is determined that the intelligent terminal is worked as
The WLAN of preceding access is the network that can not surf the Internet.
9. such as network detecting method as claimed in any one of claims 1 to 6, which is characterized in that described to pass through the wireless local area
Net sends HTTP connection request to preset first server, according to the connection shape of the intelligent terminal and the first server
Condition obtains HTTP testing result, comprising:
HTTP connection request is sent to preset first server by the WLAN;
If with the first server successful connection, it is determined that this HTTP testing result is successful connection;
If whether determining the WLAN according to the HTTP state value received with the first server connection failure
To authenticate network;
If it is determined that the WLAN is certification network, it is determined that this HTTP testing result is that connection is limited;
If it is determined that the WLAN is not certification network, it is determined that this HTTP testing result is connection failure.
10. network detecting method as described in claim 1, which is characterized in that described to periodically acquire presently described intelligence eventually
The parameter information of all socket Socket in the kernel at end, comprising:
It detects in the kernel of presently described intelligent terminal with the presence or absence of Socket;
If there are Socket in the kernel of presently described intelligent terminal, in the kernel for periodically acquiring presently described intelligent terminal
The parameter information of all Socket.
11. network detecting method as claimed in claim 10, which is characterized in that the network detecting method further include:
If Socket is not present in the kernel of presently described intelligent terminal, it is determined that the TCP state of current network connection is connection
Failure.
12. a kind of network detection device, which is characterized in that the network detection device includes:
Detection unit, for intelligent terminal access WLAN after, while start hypertext transfer protocol HTTP detection and
Transmission control protocol TCP detection;
Determination unit, in preset detection time, based on this HTTP detect obtained HTTP testing result and/or
It is the net that can surf the Internet that this TCP, which detects the WLAN that obtained TCP testing result determines that the intelligent terminal is currently accessed,
Network or the network that can not surf the Internet;
Wherein, the detection unit includes:
HTTP detection unit, for sending HTTP connection request, root to preset first server by the WLAN
HTTP testing result is obtained according to the connection state of the intelligent terminal and the first server;
TCP detection unit, for being periodically detected the TCP state of the intelligent terminal current network connection, according to the TCP shape
State obtains TCP testing result;
Wherein, the TCP detection unit includes:
Acquisition of information subelement, all socket Socket in the kernel for periodically acquiring presently described intelligent terminal
Parameter information;
Link judgment sub-unit judges link corresponding with each Socket for the parameter information based on each Socket respectively
Type;
TCP state determines subelement, for determining current network connection according to the quantitative relation between different types of link
TCP state;
TCP determines subelement, if determining that the subelement continuous N1 determination TCP state is to connect into for the TCP state
Function, it is determined that this TCP testing result is successful connection, if the TCP state determines the subelement continuous N2 determination TCP
State is connection failure, it is determined that this TCP testing result is connection failure, if the TCP state determines the continuous N3 of subelement
The secondary determination TCP state is that connection is limited, it is determined that this TCP testing result is that connection is limited;
Wherein, the type of above-mentioned link includes network difference link, and network limited link does not use link, is not turned off link;Institute
It states TCP state and determines subelement, specifically for the quantity of the bad link of statistics network, wherein the number of the above-mentioned bad link of network
Amount is the quantity of network limited link and the sum of the quantity of network difference link;Determine current network connection TCP state whether be
Successful connection;If the TCP state of current network connection is not successful connection, the TCP state of current network connection is continued to test
It whether is connection failure;If the TCP state of current network connection is not connection failure, current network connection is continued to test
Whether TCP state is that connection is limited;
Wherein, whether the TCP state of the determining current network connection is successful connection, comprising:
If the first ratio is not more than preset fractional threshold C1, and the second ratio is not more than preset fractional threshold D1, it is determined that
Current network connection TCP state be successful connection, wherein above-mentioned first ratio be the bad link of network quantity be not turned off
The ratio of the quantity of link, above-mentioned second ratio are not use the quantity of link and the ratio for being not turned off the quantity of link;
Whether the TCP state of the detection current network connection is connection failure, comprising:
If above-mentioned first ratio is not less than preset fractional threshold C2, and above-mentioned second ratio is not less than preset fractional threshold
D2, and third ratio is not less than preset fractional threshold E2, it is determined that the TCP state of current network connection is connection failure,
In, above-mentioned third ratio is the ratio of the quantity and the quantity for being not turned off link of network limited link;
Whether the TCP state of the detection current network connection is that connection is limited, comprising:
If above-mentioned first ratio is not less than preset fractional threshold C3, and above-mentioned second ratio is not less than preset fractional threshold
D3, and third ratio is not less than preset fractional threshold E3, it is determined that the TCP state of current network connection is connection failure,
In, above-mentioned fractional threshold C3 is different from above-mentioned fractional threshold C2, and above-mentioned fractional threshold D3 is different from above-mentioned fractional threshold D2, above-mentioned
Fractional threshold E3 is different from above-mentioned fractional threshold E2.
13. network detection device as claimed in claim 12, which is characterized in that the network detection device further include:
Stop unit, for being detected based on this HTTP obtained by obtained HTTP testing result and/or this TCP detection
TCP testing result determine WLAN that the intelligent terminal is currently accessed be can surf the Internet network or can not surf the Internet network it
Afterwards, alternatively, after being reached between in the detection, if this TCP detection and/or this HTTP detection are still in operation, stop
Only this TCP detection and/or this HTTP detection.
14. network detection device as claimed in claim 12, which is characterized in that the network detection device further include:
Switching units are connected, for when determining WLAN that the intelligent terminal is currently accessed is that can not surf the Internet network,
Disconnect the connection of the intelligent terminal Yu the WLAN.
15. network detection device as claimed in claim 12, which is characterized in that the network detection device further include:
WLAN forbidden cell, the WLAN for being currently accessed when the determining intelligent terminal are the net that can not surf the Internet
When network, within the preset disabling time, the WLAN is disabled.
16. network detection device as claimed in claim 15, which is characterized in that the WLAN forbidden cell includes:
It disables number and obtains subelement, for obtaining the forbidden number of the WLAN of current record;
Time setting subelement is disabled, sets the nothing for the forbidden number of the WLAN according to current record
The disabling time of line local area network;
Network disables subelement, for disabling the WLAN within the disabling time of the WLAN;
It disables number and updates subelement, for updating the forbidden number of the WLAN of current record.
17. network detection device as claimed in claim 16, which is characterized in that the network detection device further include:
Alternate list display unit, for showing each attachable WLAN once in WLAN alternate list
By number that the intelligent terminal accesses and once the number disabled by the intelligent terminal, the attachable WLAN are
The WLAN that current intelligent terminal does not access.
18. such as the described in any item network detection devices of claim 12 to 17, which is characterized in that the determination unit, specifically
If being successful connection for this obtained HTTP testing result of the HTTP detection unit, it is determined that the intelligent terminal is worked as
The WLAN of preceding access is the network that can surf the Internet.
19. such as the described in any item network detection devices of claim 12 to 17, which is characterized in that described to state determination unit, tool
If body is connection failure for this obtained TCP testing result of the HTTP detection unit, alternatively, if the HTTP is detected
This obtained HTTP testing result of unit and the TCP detection unit this obtained TCP testing result are connection
It is limited, it is determined that the WLAN that the intelligent terminal is currently accessed is the network that can not surf the Internet.
20. such as the described in any item network detection devices of claim 12 to 17, which is characterized in that the HTTP detection unit packet
It includes:
HTTP request subelement, for sending HTTP connection request to preset first server by the WLAN;
HTTP determines subelement, if being used for and the first server successful connection, it is determined that this HTTP testing result is to connect
It is connected into function;
HTTP detection sub-unit, if for the first server connection failure, the HTTP state value that basis receives is true
Whether the fixed WLAN is certification network;
The HTTP determines subelement, if being also used to the HTTP detection sub-unit determines that the WLAN is certificate web
Network, it is determined that this HTTP testing result is that connection is limited, if the HTTP detection sub-unit determines the WLAN not
To authenticate network, it is determined that this HTTP testing result is connection failure.
21. network detection device as claimed in claim 12, which is characterized in that the acquisition of information subelement, comprising:
Quantity detection sub-unit whether there is Socket in the kernel for detecting current intelligent terminal;
Subelement is obtained, if for, there are Socket, periodically acquiring current intelligence eventually in the kernel of current intelligent terminal
The parameter information of all Socket in the kernel at end.
22. network detection device as claimed in claim 21, which is characterized in that the TCP state determines subelement, specific to use
In when the quantity detection sub-unit detects and Socket is not present in the kernel of current intelligent terminal, determine that current network connects
The TCP state connect is connection failure.
23. a kind of intelligent terminal, including memory, processor and storage are in the memory and can be on the processor
The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 11 when executing the computer program
The step of any one the method.
24. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists
In when the computer program is executed by processor the step of any one of such as claim 1 to 11 of realization the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710740270.XA CN107332741B (en) | 2017-08-25 | 2017-08-25 | A kind of network detecting method, network detection device and intelligent terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710740270.XA CN107332741B (en) | 2017-08-25 | 2017-08-25 | A kind of network detecting method, network detection device and intelligent terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107332741A CN107332741A (en) | 2017-11-07 |
CN107332741B true CN107332741B (en) | 2019-03-29 |
Family
ID=60228451
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710740270.XA Active CN107332741B (en) | 2017-08-25 | 2017-08-25 | A kind of network detecting method, network detection device and intelligent terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107332741B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107682909B (en) * | 2017-11-22 | 2020-06-26 | Oppo广东移动通信有限公司 | Control method and device for connecting access point |
CN110324391B (en) * | 2018-03-30 | 2022-03-25 | 武汉斗鱼网络科技有限公司 | Bullet screen server connection method, client and readable storage medium |
CN110113744B (en) * | 2019-04-18 | 2020-12-04 | 杭州涂鸦信息技术有限公司 | Communication method, device, equipment and storage medium |
CN114826750B (en) * | 2022-04-29 | 2024-02-06 | 阿里巴巴(中国)有限公司 | Network anomaly detection method, server cluster and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105940640A (en) * | 2014-01-30 | 2016-09-14 | 高通股份有限公司 | Determination of end-to-end transport quality |
CN106714206A (en) * | 2016-09-29 | 2017-05-24 | 腾讯科技(深圳)有限公司 | Method and device for detecting network connection by wireless network access point |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020176377A1 (en) * | 2001-05-22 | 2002-11-28 | Hamilton Thomas E. | Service platform on wireless network |
-
2017
- 2017-08-25 CN CN201710740270.XA patent/CN107332741B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105940640A (en) * | 2014-01-30 | 2016-09-14 | 高通股份有限公司 | Determination of end-to-end transport quality |
CN106714206A (en) * | 2016-09-29 | 2017-05-24 | 腾讯科技(深圳)有限公司 | Method and device for detecting network connection by wireless network access point |
Also Published As
Publication number | Publication date |
---|---|
CN107332741A (en) | 2017-11-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107332741B (en) | A kind of network detecting method, network detection device and intelligent terminal | |
CN109729131A (en) | A kind of processing method of application request, device and router | |
CN107332740B (en) | A kind of network detecting method, network detection device and intelligent terminal | |
CN110266737B (en) | Method, device, equipment and medium for detecting vulnerability of cross-domain resource sharing | |
CN107395633A (en) | A kind of network detecting method, network detection means and intelligent terminal | |
CN107333287B (en) | Network detecting method, network detection device and intelligent terminal | |
CN108616389B (en) | Network evaluation method, equipment, storage medium and device based on cloud server | |
CN112804697B (en) | Network distribution method and device for equipment to be networked, electronic equipment and computer readable medium | |
CN108199914A (en) | Server-side condition detection method and device | |
CN107566233A (en) | The resource share method and device of home appliance | |
WO2017181801A1 (en) | Hypertext transfer protocol request identification system and method | |
CN102594912A (en) | Data processing method under server architecture, server and server architecture | |
CN109257405A (en) | Processing method, device and the server that file uploads | |
CN111669285A (en) | Network detection data processing method, system and storage medium | |
CN112346751B (en) | Application program installation method and device, electronic equipment and storage medium | |
US9244882B2 (en) | Provisioning network resources based on environment | |
CN107528854B (en) | Connection method, system, client and server based on workload certification | |
CN107231647B (en) | Network detecting method, network detection device and intelligent terminal | |
CN107277881A (en) | Method for switching network, network switching device and intelligent terminal | |
CN107332739B (en) | Network detecting method, network detection device and intelligent terminal | |
CN109951549B (en) | Network page access method and device and computer readable storage medium | |
CN116781434B (en) | Access control method, system and related equipment based on mimicry defense | |
US10203882B2 (en) | Method for managing multiple bandwidth boost solutions co-existing in an electronic device | |
CN112583617B (en) | Fault determination method, server, control terminal and storage medium | |
CN107360059B (en) | Network detecting method, network detection device and intelligent terminal |
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 | ||
CB02 | Change of applicant information |
Address after: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant after: OPPO Guangdong Mobile Communications Co., Ltd. Address before: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant before: Guangdong OPPO Mobile Communications Co., Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |