CN113747490A - WIFI connectivity detection method and device, terminal equipment and storage medium - Google Patents

WIFI connectivity detection method and device, terminal equipment and storage medium Download PDF

Info

Publication number
CN113747490A
CN113747490A CN202110922549.6A CN202110922549A CN113747490A CN 113747490 A CN113747490 A CN 113747490A CN 202110922549 A CN202110922549 A CN 202110922549A CN 113747490 A CN113747490 A CN 113747490A
Authority
CN
China
Prior art keywords
network
wifi
tcp
connection
detection data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110922549.6A
Other languages
Chinese (zh)
Inventor
张利群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TCL Communication Ningbo Ltd
Original Assignee
TCL Communication Ningbo Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TCL Communication Ningbo Ltd filed Critical TCL Communication Ningbo Ltd
Priority to CN202110922549.6A priority Critical patent/CN113747490A/en
Publication of CN113747490A publication Critical patent/CN113747490A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/08Testing, supervising or monitoring using real traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/24Reselection being triggered by specific parameters
    • H04W36/30Reselection being triggered by specific parameters by measured or perceived connection quality data
    • H04W36/305Handover due to radio link failure

Abstract

The invention discloses a WIFI connectivity detection method, a WIFI connectivity detection device, terminal equipment and a storage medium, wherein the method comprises the following steps: controlling monitoring and repeatedly acquiring network detection data; comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not; and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network. The method aims to solve the problems that the terminal equipment without the gms can not automatically detect the WIFI network condition and automatically switches the WIFI network when the WIFI network is abnormal, and the WIFI network which is abnormal in WIFI network connection and automatically switches the connection can be timely found on the terminal equipment without the gms in advance.

Description

WIFI connectivity detection method and device, terminal equipment and storage medium
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for detecting WIFI connectivity, a terminal device, and a storage medium.
Background
In the Android platform, once network connectivity detection is carried out after the WIFI connection is successful, and grading is carried out according to a detection result, so that whether the WIFI is used as a default network of the current equipment is judged. In the use process of the WIFI, when equipment without pre-installed gms (mainly google gms in google mobile service, which can be used for judging whether network connectivity detection is needed according to an algorithm) is connected with the WIFI, if the connection state of the WIFI is not changed, the Android system cannot detect the connectivity of the current WIFI network. If WIFI is used as a default network and the WIFI cannot surf the internet at the moment, the equipment cannot actively detect and switch and connect to the network which can surf the internet normally, so that the equipment cannot access the internet and the user experience is seriously influenced. And the gms is a detection module for automatically judging whether the equipment needs to carry out connectivity detection or not through an algorithm. Therefore, a scheme capable of timely detecting the state of the WIFI network when there is no premounting gms and performing connectivity detection on the WIFI network when the state of the WIFI network is abnormal is lacked.
Thus, there is still a need for improvement and development of the prior art.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and an apparatus for detecting WIFI connectivity, a terminal device and a storage medium, which are used to solve the above-mentioned defects in the prior art.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a WIFI connectivity detection method, wherein the method comprises the following steps:
controlling monitoring and repeatedly acquiring network detection data;
comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not;
and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network.
The WIFI connectivity detection method, wherein the step of controlling to repeatedly obtain network detection data includes:
presetting a preset condition for judging whether connectivity detection is needed, and judging whether the connectivity detection is carried out on the WIFI network when the network detection data meet the preset condition;
the preset conditions include: and judging a first preset condition of the abnormal state of the network connection through the number of messages received by the tcp and the number of messages sent by the tcp, and/or judging a second preset condition of the abnormal state of the network connection when the ratio of the number of abnormal connections through the tcp exceeds a preset ratio.
The WIFI connectivity detection method comprises the following steps of judging a first preset condition of an abnormal network connection state through the number of messages received by a tcp and the number of messages sent by the tcp, wherein the steps comprise:
and when the number of the messages received by the tcp and the number of the messages sent by the tcp, which are continuously obtained, indicate that the number of times that the terminal equipment has no message interaction with the network reaches a preset number, judging that the WIFI network connection is abnormal.
The WIFI connectivity detection method comprises the following steps of judging a second preset condition of the abnormal state of network connection if the proportion of the number of abnormal connections through tcp exceeds a preset proportion:
judging tcp information of tcp connection, wherein the tcp information comprises any parameter of a tcp state, retransmission number and reply time, and the tcp connection is judged to be abnormal when the any parameter exceeds a preset value;
and judging that the WIFI network connection is abnormal when the ratio of the number of the abnormal tcp connection to the total number of the tcp connection is over a preset ratio.
The WIFI connectivity detection method comprises the following steps of controlling to repeatedly read network detection data, comparing the obtained network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not:
repeatedly reading network detection data in the terminal equipment according to a preset time frequency, wherein the network detection data comprises the tcp message number and the tcp connection abnormity proportion;
comparing the number of the obtained tcp messages with a first preset condition and/or comparing the obtained proportion of tcp connection abnormity with a second preset condition;
and judging whether the proportion of the tcp message number to tcp connection abnormity meets a first preset condition and/or a second preset condition.
The WIFI connectivity detection method comprises the following steps of when the obtained network detection data meet the preset conditions, controlling the WIFI network to be subjected to connectivity detection:
and when the proportion of the tcp message number acquired by the judgment device to the tcp connection abnormity meets a first preset condition and/or a second preset condition, controlling to carry out connectivity detection on the WIFI network and judging whether the WIFI connection is normal.
The WIFI connectivity detection method comprises the following steps of when the obtained network detection data are judged to meet the preset conditions, controlling the WIFI network to be subjected to connectivity detection:
when the WIFI connection is confirmed to be normal, the connection state of the current WIFI network is kept;
and when the WIFI connection is confirmed to be abnormal, rescanning the connectable WIFI network around and switching the WIFI network connection.
A WIFI connectivity detection apparatus, wherein the apparatus comprises:
the network monitoring module is used for controlling the equipment to repeatedly read network detection data according to a preset time frequency;
the judging module is used for comparing the acquired network detection data with a preset condition and judging whether the network detection data reach the preset condition or not;
and the network connectivity detection module is used for controlling the connectivity detection of the WIFI network when the network detection data are judged to meet the preset conditions.
A terminal device comprises a memory, a processor and a WIFI-based connectivity detection program which is stored on the memory and can run on the processor, wherein when the processor executes the WIFI-based connectivity detection program, the steps of any WIFI connectivity detection method are realized.
A computer readable storage medium having stored thereon a WIFI connectivity detection program which, when executed by a processor, performs any of the steps of the WIFI connectivity detection method.
Has the advantages that: compared with the prior art, the invention provides a WIFI connectivity detection method, which adopts the following steps: setting a preset condition for judging whether the connectivity detection is carried out on the WIFI network when the network detection data meet the preset condition; controlling to repeatedly read the network detection data, comparing the obtained network detection data with a preset condition, and judging whether the network detection data meets the preset condition; and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network. The WIFI network switching method and the WIFI network switching system enable a user to find and switch another WIFI connection in time when the user uses the terminal device and the WIFI network is abnormal, and improve the use experience of the user when the user uses the terminal device.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a specific implementation of a WIFI connectivity detection method provided in an embodiment of the present invention.
Fig. 2 is a comparison graph of experimental results of using the WIFI connectivity detection method provided by the present invention and using gms to perform automatic detection and processing of the WIFI network.
Fig. 3 is a schematic flowchart of a software implementation method of the WIFI connectivity detection method provided by the present invention.
Fig. 4 is a schematic block diagram of a WIFI connectivity detection apparatus provided in an embodiment of the present invention.
Fig. 5 is a schematic diagram of an internal structure of a terminal device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, if directional indications (such as up, down, left, right, front, and back … …) are involved in the embodiment of the present invention, the directional indications are only used to explain the relative positional relationship between the components, the movement situation, and the like in a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indications are changed accordingly.
In addition, if there is a description of "first", "second", etc. in an embodiment of the present invention, the description of "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
In the prior art, although the development of electronic devices and network technologies is rapid, a phenomenon that a WIFI network is abnormal still often occurs when a user uses a mobile phone, which includes various situations that the WIFI connection is disconnected and the WIFI connection is not disconnected but the internet cannot be connected, in order to solve the problem, a general method adopted in the prior art is to pre-install gms for devices such as terminal devices and the like which can be connected with the WIFI network, automatically detect the connection state of the WIFI network through the gms algorithm, and automatically switch the WIFI network when the WIFI network connection is abnormal. However, not all terminal devices such as mobile phone devices are pre-equipped with gms, and for a mobile phone without the pre-equipped gms, when the WIFI network is connected but the mobile phone cannot surf the internet, the mobile phone cannot automatically detect whether the WIFI network is abnormal, and then automatically adjust the WIFI connection state. And for the device with the pre-installed gms, the problem of untimely or non-detection often occurs due to the defect of the algorithm, and the device cannot access the internet.
In order to solve the above problems, embodiments of the present invention provide a WIFI connectivity detection method, according to the WIFI connectivity detection method of this embodiment, a terminal device obtains network detection data of a terminal device node according to a predetermined time frequency, determines whether the network detection data meets a preset condition, determines that a WIFI connection state of a current terminal device is abnormal when the network detection data meets the preset condition, performs connectivity detection on a WIFI network, and searches for another available WIFI network again for connection when the WIFI network is abnormal. The problem that for a terminal device without pre-installed gms, when the WIFI is connected but the Internet cannot be accessed, the terminal device cannot automatically detect whether the WIFI network is abnormal or not is solved, and for the device with the pre-installed gms, the problem that the device cannot access the Internet due to the fact that detection is not timely or not performed frequently occurs due to the defect of an algorithm is solved.
Exemplary method
As shown in fig. 1, an embodiment of the present invention provides a WIFI connectivity detection method, which may be used for terminal devices such as terminal devices that can connect to a WIFI network. The method in the embodiment of the invention comprises the following steps:
s100, controlling monitoring and repeatedly acquiring network detection data;
wherein before the step of controlling to repeatedly obtain network test data comprises:
presetting a preset condition for judging whether connectivity detection is needed, and judging whether the connectivity detection is carried out on the WIFI network when the network detection data meet the preset condition;
in this embodiment, a preset condition for judging whether the WIFI network is abnormal is set, and the preset condition is compared with network detection data acquired by the terminal device, where the preset condition represents that the WIFI network may be abnormal when the network detection data acquired by the terminal device meets the preset condition. Therefore, the preset condition is not a fixed value, is an empirical value with a certain rule and range, can be a condition which is most suitable for the terminal device and is obtained by a developer through a large amount of data verification, and can also be a value which is obtained by repeatedly acquiring network detection data and judging possible abnormity of the WIFI network and combining actual connectivity detection and correction of the WIFI network by the terminal device.
For example, it is verified according to experience data of a developer that, when an acquisition interval is two seconds, if it is determined that the WIFI network of the terminal device is abnormal when three consecutive times of acquiring tcp receive messages, that is, tcp rx is 0, or ten consecutive times of acquiring tcp send messages, that is, tcp tx is 0, the network detection data acquired by the terminal device is tcp receive messages and tcp send messages, and when the above conditions are met, the terminal device controls to perform connectivity detection on the WIFI network. The tcp receiving message and the tcp sending message are communication information between the terminal device and the internet after the terminal device is connected with the WIFI network, wherein the tcp receiving message is information sent to the terminal device by the internet, and the tcp sending message is information sent to the internet by the terminal device.
For example, according to a correction process in which the terminal device obtains the preset condition by repeatedly acquiring the network detection data and combining the actual WIFI connectivity detection result, when it is continuously determined that the WIFI network is possibly abnormal for many times but the WIFI network is found to be normal through the connectivity detection of the actual WIFI network, the trigger threshold of the network detection data is correspondingly increased, for example, the acquisition frequency of the terminal device is once every two seconds, and when the tcp received packet number tcp rx of three consecutive times is 0, the WIFI connectivity detection is performed, and when the tcp received packet number tcp rx of four consecutive times is 0, the trigger threshold of the network detection data is correspondingly increased, the WIFI connectivity detection is performed. The automatic adjustment detection method can further reduce the number of times of WIFI connectivity detection, reduce the power consumption of the terminal equipment and provide more accurate judgment of the WIFI network connection state for the user.
Wherein the preset conditions include: and judging a first preset condition of the abnormal state of the network connection through the message receiving number tcp and judging a second preset condition of the abnormal state of the network connection through the tcp information.
Specifically, the first preset condition is that when the number of tcp message receiving messages and the number of tcp message sending messages which are continuously obtained both indicate that the number of times that the terminal device does not generate message interaction with the network reaches a preset number of times, it is determined that the WIFI network connection is abnormal.
For example, when the tcp message receiving number tcp rx is 0 and the tcp message sending number tcp tx is 0, it represents that the terminal device does not interact with the network, at this time, the terminal device may not use a process that needs to interact with the network, or at this time, it does not need to interact with the network, but represents that the connection between the terminal device and the network is abnormal at this time, a preset number of times is set, and when the tcp message receiving number and the tcp message sending number that are continuously read by the terminal device are always zero and reach the preset number of times, it is determined that the WIFI network is possibly abnormal.
And the second preset condition is that the WIFI network connection abnormity is judged when the number of tcp connection abnormity exceeds the preset proportion of total tcp connection. And judging that the tcp connection is abnormal through tcp information including any one parameter of a tcp state, a retransmission number and a reply time exceeding a preset value. The tcp state comprises a plurality of states such as closed, listen, syn _ rcvd, syn _ sent and the like, and is used for representing the current working mode of tcp connection, the retransmission number is that the tcp connection is in the data transmission process, the other party can resend a transmission data packet if the other party does not receive complete information transmitted by the tcp, the tcp connection is judged to be possibly abnormal when continuous multiple transmission fails, the reply time is that the tcp connection starts a timer after transmitting one data, and whether the reply time of the tcp connection exceeds the preset time length or not can be used as one of the indexes for judging the tcp connection abnormity when the time of the timer recorded after receiving an ack confirmation message transmitted by the other party is received.
For example, when the reply time that the terminal can acquire a certain tcp connection is longer than ten seconds, it is determined that the tcp connection is abnormal, and when another tcp connection state is acquired as closed, it may also be determined that the tcp connection is abnormal, and when it is detected that the number of tcp connections with tcp connection abnormality exceeds 80% of the total number of tcp connections, it is determined that the current WIFI network connection is abnormal.
The method for judging the WIFI network connection abnormity through multiple judging modes can enable the judging result to be more stable, and when one judging mode fails or when the first judging result is unstable, the second judging mode can be used for replacing the judging mode. For example, when tcp rx and tcp tx are used for judgment, if the difference between the judgment result and the WIFI network connectivity detection result is large in a short time, the first judgment mode is controlled to be closed, so that the terminal device can freely select a more accurate judgment mode for judgment, and the power consumption of the terminal device is reduced.
Step S200, comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions;
in this embodiment, after the terminal device obtains network detection data of the terminal device according to a predetermined time frequency or time interval, the network detection data includes a tcp packet number and a ratio of the number of tcp connection anomalies, and the ratio of the number of tcp connection anomalies is determined by a tcp state, a retransmission number, and a reply time in tcp information. And comparing the acquired network detection data with preset conditions, including a first preset condition and a second preset condition, and judging whether the network detection data meets the preset conditions.
For example, the acquired network detection data includes the number of tcp received messages and the number of tcp sent messages, and the first preset condition set in the mobile phone is that when it is determined that the number of tcp received messages of the mobile phone lasts five times and is less than one, the number of tcp sent messages is greater than or equal to zero or the number of tcp received messages of the mobile phone lasts three times and is equal to zero, and it is determined that the WIFI connection is abnormal. If the first time tcp rx is 0, tcp tx is 1, the second time tcp rx is 0, tcp tx is 5, the third time tcp rx is 1, tcp tx is 0, the number of tcp packets at the first three times does not satisfy the first preset condition because the third time tcp rx is 1; and if the fourth time tcp rx is 0, the tcp tx is 2, the fifth time tcp rx is 0, the tcp tx is 1, the sixth time tcp rx is 0, and the tcp tx is 0, the tcp packet number at the last three times is determined to satisfy the first preset condition.
When a user uses a mobile phone, the obtained network detection data comprises network detection data such as tcp states, retransmission numbers and response time for representing whether each tcp connection is abnormal, and the tcp connection is judged to be abnormal when the tcp states are closed or the tcp retransmission numbers are more than six times or the response time exceeds ten seconds in a first preset condition, and the WIFI network connection is judged to be abnormal when the tcp connection exceeding 70% is judged to be abnormal. Then, when the tcp connection number of the first time tcp state is 50% of closed tcp connections, the tcp connection number of the tcp retransmission number is 30% of tcp connections with more than six times, and the tcp connection number of the reply time exceeding 10 seconds is 50%, assuming that the result of the ratio of tcp connection abnormality obtained by simultaneous judgment of the three parameters is 87%, then the WIFI network connection abnormality is judged at the current time.
Further, screen on-off judgment can be added, when a user uses the mobile phone, the screen is basically in a screen on state, the requirement on the network real-time performance of the mobile phone in the state is high, so that the preset time frequency is accelerated correspondingly, on the contrary, when the screen is off, the user has a high probability of not using the mobile phone, or when the screen is off, whether screen off applications such as internet clouds and the like which can be used are running is further judged, when the user is judged not to use the mobile phone, the requirement on the network real-time performance of the mobile phone in the state is low, the time frequency for acquiring network detection data can be correspondingly reduced, the power consumption is further reduced, and the user experience is improved.
Further, in step S300, when it is determined that the acquired network detection data meets the preset condition, connectivity detection is performed on the WIFI network.
In this embodiment, when it is determined that the acquired network detection data meets the preset conditions, including the first preset condition and/or the second preset condition, connectivity detection is performed on the WIFI network.
The connectivity detection is that a specified access request capable of accessing across domains is sent to a public network server through terminal equipment, and if the equipment receives a response message of the specified access request within a preset time length, the network connectivity with the public network server is determined, and if the equipment does not receive the response message of the specified access request within the preset time length, the network connectivity with the public network server is determined.
When the WIFI network is confirmed to be normal, the original WIFI connection is kept, and when the WIFI network is confirmed to be abnormal, the connectable WIFI network is rescanned and the WIFI network connection is switched.
As shown in fig. 2, according to experimental results, it is shown that by using the method, not only can a terminal device without the premounted gms automatically determine whether the WIFI network is abnormal, but also the speed and accuracy of WIFI network switching can be further improved by comparing the terminal device with the premounted gms.
Further, as shown in fig. 3, a second embodiment shows a software implementation scheme of the WIFI connectivity detection method, which includes the steps of:
step S10, starting, opening a switch of the WIFI connectivity detection function through the apk, and entering step S11;
step S11, the Framework layer Framework issues a WIFI connection or disconnection message to a network daemon (net), and the step S12 is entered;
step S12, the network daemon (net) transmits the frame layer information to a real-time operating system kernel through a socket, and the step S13 is entered;
step S13, the real-time operating system kernel counts the number of tcp messages which are matched with the wlan0 and flow through the protocol stack through a hook function, writes the tcp messages into the equipment node, and enters step S14;
step S14, the WIFI service reads the statistical result in the equipment node, judges whether WIFI connectivity detection is needed or not through a detection algorithm, and enters step S15 when the WIFI connectivity detection is needed;
step S15, performing connectivity detection through a WIFI connectivity detection algorithm (evaluation algorithm) WIFI network, and ending.
As can be seen from the above, in the embodiment of the present invention, a user can also determine whether the WIFI network is abnormal in real time through the number of tcp messages flowing through the protocol stack by software and an algorithm without using gms, and when it is determined that the WIFI network is possibly abnormal, further confirm whether the WIFI network is abnormal through WIFI connectivity detection.
When a user uses a WIFI Connectivity detection method through software, a WIFI Connectivity detection function is started through application setting, a Connectivity Service (Connectivity Service) in a Framework layer (Framework) sends a WIFI connection or WIFI disconnection message to a real-time operating system kernel through a network daemon process netd, the kernel acquires the number of tcp messages flowing through a protocol stack in real time through creating a hook function and writes information of the number of the tcp messages into equipment nodes, the WIFI Service in the Framework layer reads the number information of the tcp messages in the equipment nodes and judges whether the current WIFI network is possibly abnormal or not through an algorithm, when the current WIFI network is judged to be abnormal, the connectivity of the WIFI network is detected through a WIFI connectivity detection algorithm (evaluation algorithm), when the detection result is that the WIFI network is normal, the current network connection is kept, and when the detection result is that the WIFI network is abnormal, and controlling the terminal equipment to scan other available WIFI for evaluation and switching the WIFI network.
As shown in fig. 4, an embodiment of the present invention provides a connectivity detection apparatus based on WIFI, including: the device comprises a presetting module 410, a reading module 420, a judging module 430 and a network detection module 440. Specifically, the preset module 410 is configured to set a preset condition, and perform connectivity detection on the WIFI network when the network detection data meets the preset condition; the reading module 420 is configured to control the device to repeatedly read the network detection data according to a preset time frequency; the determining module 430 is configured to compare the acquired network detection data with a preset condition, and determine whether the network detection data reaches the preset condition; and the network detection module 440 is configured to control connectivity detection on the WIFI network when it is determined that the network detection data meets the preset condition.
Based on the above embodiments, the present invention further provides a terminal device, and a schematic block diagram thereof may be as shown in fig. 5. The terminal equipment comprises a processor, a memory, a network interface and a display screen which are connected through a system bus. Wherein the processor of the terminal device is configured to provide computing and control capabilities. The memory of the terminal equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the terminal device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a WIFI-based connectivity detection. The display screen of the terminal equipment can be a liquid crystal display screen or an electronic ink display screen.
It will be understood by those skilled in the art that the block diagram shown in fig. 5 is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation to the terminal device to which the solution of the present invention is applied, and a specific terminal device may include more or less components than those shown in the figure, or combine some components, or have a different arrangement of components.
In one embodiment, a terminal device is provided, the terminal device including a memory, a processor, and a WIFI-based connectivity detection program stored on and executable on the processor, the processor performing the steps of:
controlling monitoring and repeatedly acquiring network detection data;
comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not;
and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network.
Wherein, the step of controlling to repeatedly acquire the network detection data comprises the following steps:
presetting a preset condition for judging whether connectivity detection is needed, and judging whether the connectivity detection is carried out on the WIFI network when the network detection data meet the preset condition;
the preset conditions include: and judging a first preset condition of the abnormal state of the network connection through the number of messages received by the tcp and the number of messages sent by the tcp, and/or judging a second preset condition of the abnormal state of the network connection when the ratio of the number of abnormal connections through the tcp exceeds a preset ratio.
The step of judging the first preset condition of the abnormal state of the network connection through the number of messages received by the tcp and the number of messages sent by the tcp comprises the following steps:
and when the number of the messages received by the tcp and the number of the messages sent by the tcp, which are continuously obtained, indicate that the number of times that the terminal equipment has no message interaction with the network reaches a preset number, judging that the WIFI network connection is abnormal.
The step of judging a second preset condition of the abnormal state of the network connection if the proportion of the number of the abnormal connections through the tcp exceeds a preset proportion comprises the following steps:
judging tcp information of tcp connection, wherein the tcp information comprises any parameter of a tcp state, retransmission number and reply time, and the tcp connection is judged to be abnormal when the any parameter exceeds a preset value;
and judging that the WIFI network connection is abnormal when the ratio of the number of the abnormal tcp connection to the total number of the tcp connection is over a preset ratio.
The step of controlling to repeatedly read the network detection data, comparing the obtained network detection data with a preset condition, and judging whether the network detection data meets the preset condition comprises the following steps:
repeatedly reading network detection data in the terminal equipment according to a preset time frequency, wherein the network detection data comprises the tcp message number and the tcp connection abnormity proportion;
comparing the number of the obtained tcp messages with a first preset condition and/or comparing the obtained proportion of tcp connection abnormity with a second preset condition;
and judging whether the proportion of the tcp message number to tcp connection abnormity meets a first preset condition and/or a second preset condition.
Wherein, when the network detection data obtained by judgment meet the preset conditions, the step of controlling the WIFI network to carry out connectivity detection comprises the following steps:
and when the proportion of the tcp message number acquired by the judgment device to the tcp connection abnormity meets a first preset condition and/or a second preset condition, controlling to carry out connectivity detection on the WIFI network and judging whether the WIFI connection is normal.
Wherein, when the network detection data obtained by the judgment meet the preset conditions, the step of controlling the WIFI network to carry out connectivity detection comprises the following steps:
when the WIFI connection is confirmed to be normal, the connection state of the current WIFI network is kept;
and when the WIFI connection is confirmed to be abnormal, rescanning the connectable WIFI network around and switching the WIFI network connection.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
In summary, the present invention discloses a WIFI connectivity detection method, apparatus, terminal device and storage medium, where the method includes: controlling monitoring and repeatedly acquiring network detection data; comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not; and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network. The method aims to solve the problems that the terminal equipment without the gms can not automatically detect the WIFI network condition and automatically switches the WIFI network when the WIFI network is abnormal, and the WIFI network which is abnormal in WIFI network connection and automatically switches the connection can be timely found on the terminal equipment without the gms in advance.
It is to be understood that the invention disclosed is not limited to the examples described above, but may be modified or varied by those skilled in the art, all falling within the scope of the invention as defined by the appended claims.

Claims (10)

1. A WIFI connectivity detection method, characterized by comprising:
controlling monitoring and repeatedly acquiring network detection data;
comparing the acquired network detection data with preset conditions, and judging whether the network detection data meet the preset conditions or not;
and when the obtained network detection data are judged to meet the preset conditions, controlling to carry out connectivity detection on the WIFI network.
2. A WIFI connectivity detection method according to claim 1, wherein said step of controlling repeated acquisition of network detection data includes:
presetting a preset condition for judging whether connectivity detection is needed, and judging whether the connectivity detection is carried out on the WIFI network when the network detection data meet the preset condition;
the preset conditions include: and judging a first preset condition of the abnormal state of the network connection through the number of messages received by the tcp and the number of messages sent by the tcp, and/or judging a second preset condition of the abnormal state of the network connection when the ratio of the number of abnormal connections through the tcp exceeds a preset ratio.
3. A WIFI connectivity detection method according to claim 2, wherein the step of determining the first preset condition of the abnormal state of the network connection through tcp receiving the number of messages and tcp sending the number of messages includes:
and when the number of the messages received by the tcp and the number of the messages sent by the tcp, which are continuously obtained, indicate that the number of times that the terminal equipment has no message interaction with the network reaches a preset number, judging that the WIFI network connection is abnormal.
4. A WIFI connectivity detection method according to claim 2, characterized in that the step of determining the second preset condition of the abnormal state of network connection if the ratio of the number of tcp connection abnormalities exceeds the preset ratio includes:
judging tcp information of tcp connection, wherein the tcp information comprises any parameter of a tcp state, retransmission number and reply time, and the tcp connection is judged to be abnormal when the any parameter exceeds a preset value;
and judging that the WIFI network connection is abnormal when the ratio of the number of the abnormal tcp connection to the total number of the tcp connection is over a preset ratio.
5. The WIFI connectivity detection method according to claim 2, wherein the step of controlling to repeatedly read the network detection data, comparing the obtained network detection data with a preset condition, and judging whether the network detection data meets the preset condition comprises:
repeatedly reading network detection data in the terminal equipment according to a preset time frequency, wherein the network detection data comprises the tcp message number and the tcp connection abnormity proportion;
comparing the number of the obtained tcp messages with a first preset condition and/or comparing the obtained proportion of tcp connection abnormity with a second preset condition;
and judging whether the proportion of the tcp message number to tcp connection abnormity meets a first preset condition and/or a second preset condition.
6. The WIFI connectivity detection method according to claim 5, wherein when it is determined that the obtained network detection data meets the preset condition, the step of controlling the connectivity detection of the WIFI network comprises:
and when the proportion of the tcp message number acquired by the judgment device to the tcp connection abnormity meets a first preset condition and/or a second preset condition, controlling to carry out connectivity detection on the WIFI network and judging whether the WIFI connection is normal.
7. The method according to claim 1, wherein when it is determined that the obtained network detection data satisfy the preset condition, the step of controlling the connectivity detection of the WIFI network comprises:
when the WIFI connection is confirmed to be normal, the connection state of the current WIFI network is kept;
and when the WIFI connection is confirmed to be abnormal, rescanning the connectable WIFI network around and switching the WIFI network connection.
8. A WIFI connectivity detection apparatus, the apparatus comprising:
the network monitoring module is used for controlling the equipment to repeatedly read network detection data according to a preset time frequency;
the judging module is used for comparing the acquired network detection data with a preset condition and judging whether the network detection data reach the preset condition or not;
and the network connectivity detection module is used for controlling the connectivity detection of the WIFI network when the network detection data are judged to meet the preset conditions.
9. A terminal device, comprising a memory, a processor, and a WIFI connectivity detection program stored on the memory and executable on the processor, wherein the processor, when executing the WIFI connectivity detection program, implements the steps of the WIFI connectivity detection method of any one of claims 1-7.
10. A computer-readable storage medium, having a WIFI connectivity detection program stored thereon, which when executed by a processor, performs the steps of the WIFI connectivity detection method of any one of claims 1-7.
CN202110922549.6A 2021-08-12 2021-08-12 WIFI connectivity detection method and device, terminal equipment and storage medium Pending CN113747490A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110922549.6A CN113747490A (en) 2021-08-12 2021-08-12 WIFI connectivity detection method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110922549.6A CN113747490A (en) 2021-08-12 2021-08-12 WIFI connectivity detection method and device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113747490A true CN113747490A (en) 2021-12-03

Family

ID=78730904

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110922549.6A Pending CN113747490A (en) 2021-08-12 2021-08-12 WIFI connectivity detection method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113747490A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114221862A (en) * 2021-12-08 2022-03-22 深圳绿米联创科技有限公司 Network configuration method and device of equipment, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150222507A1 (en) * 2014-01-31 2015-08-06 Aruba Networks, Inc. Initiating data collection based on wifi network connectivity metrics
CN107801223A (en) * 2017-05-22 2018-03-13 湖南大学 Vertical handoff method based on android system
CN111106983A (en) * 2019-12-27 2020-05-05 杭州迪普科技股份有限公司 Method and device for detecting network connectivity
CN112187651A (en) * 2020-09-09 2021-01-05 苏州浪潮智能科技有限公司 Traffic scheduling method, device, equipment and readable medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150222507A1 (en) * 2014-01-31 2015-08-06 Aruba Networks, Inc. Initiating data collection based on wifi network connectivity metrics
CN107801223A (en) * 2017-05-22 2018-03-13 湖南大学 Vertical handoff method based on android system
CN111106983A (en) * 2019-12-27 2020-05-05 杭州迪普科技股份有限公司 Method and device for detecting network connectivity
CN112187651A (en) * 2020-09-09 2021-01-05 苏州浪潮智能科技有限公司 Traffic scheduling method, device, equipment and readable medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114221862A (en) * 2021-12-08 2022-03-22 深圳绿米联创科技有限公司 Network configuration method and device of equipment, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11611931B2 (en) WI-FI hotspot recommendation method, terminal, and graphical user interface
US20190273749A1 (en) Unauthorized Communication Detection Apparatus and Recording Medium
US20040064517A1 (en) Synchronization message processing method
CN110474975B (en) Heartbeat processing method and device of application program, electronic equipment and storage medium
US11792650B2 (en) Unauthorized communication detection apparatus and recording medium
CN112040520B (en) Network switching method, device, terminal equipment and computer storage medium
CN112469005B (en) Method, device, equipment and computer readable storage medium for reducing power consumption of 5G equipment
CN114629822A (en) Link detection method and device, electronic equipment and storage medium
CN113747490A (en) WIFI connectivity detection method and device, terminal equipment and storage medium
US11316930B2 (en) Connection control method and device
US20090164659A1 (en) Communication system allowing reduction in congestion by restricting communication
US7990886B2 (en) Network device and connection detection method thereof
CN108990025B (en) Internet of things communication method and device
JP2003157190A (en) Synchronizing message processing method
CN115314480A (en) Method and device for remotely upgrading terminal on line
CN112929099B (en) Signal detection method, terminal and storage medium
CN110650259B (en) Call request response method, device, server, terminal and storage medium
CN114584425A (en) Method for applying cross-domain roaming
CN112822669B (en) Mobile terminal Bluetooth communication processing method and device, intelligent terminal and medium
CN112153036A (en) Security defense method and system based on proxy server
CN111131528B (en) Equipment network domain determining method, server and terminal
CN113206795B (en) Transmission strategy adjusting method, device, equipment and readable storage medium
US11165870B2 (en) Connection control method and device
CN116192755B (en) Congestion processing method and system based on virtual switch establishment
CN111314465B (en) Weak network environment communication method and device and electronic equipment

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