A network recovery method and related device
By detecting cellular network connectivity and identifying prepaid card arrears scenarios, network recovery is triggered only when there is no arrears, thus resolving the issue of unstable network signal caused by prepaid card arrears and improving the user experience.
Patent Information
- Application Number
- CN202510674087.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2026-11-24
AI Technical Summary
In cellular networks, when data services are blocked due to prepaid card arrears, the network recovery mechanism is frequently triggered, causing the cellular network signal to be intermittent, which inconveniences users.
By detecting network connectivity and determining whether it is a prepaid card arrears scenario, the network recovery mechanism is only triggered in non-arrears scenarios, avoiding frequent attempts to restore the network in arrears scenarios.
It reduces the instability of cellular network signal identification in prepaid card arrears scenarios, reduces user inconvenience, and improves the accuracy of network recovery and user experience.
Smart Images

Figure CN123164470A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cellular communication technology, and in particular to a network recovery method and related equipment. Background Technology
[0002] In communication systems, data service congestion refers to data transmission delays or interruptions caused by network congestion, equipment failure, or abnormal traffic. When data service congestion occurs, access nodes will actively discard some data packets, leading to decreased throughput, prolonged response time, or even complete service shutdown. After data service congestion occurs, terminal devices can resolve the congestion problem through network recovery mechanisms to restore normal network operation. Summary of the Invention
[0003] This application provides a network recovery method. When data service is blocked, it determines whether to trigger the network recovery mechanism by judging whether the current scenario is a prepaid card arrears scenario. This can avoid the intermittent phenomenon of the cellular network signal indicator on the interface due to the network recovery mechanism being triggered in the prepaid card arrears scenario, thereby reducing the inconvenience caused to users.
[0004] Firstly, a network recovery method is provided. This method can be executed by a terminal device, or by a component (such as a circuit, chip, or chip system) configured in the terminal device, or by a logic module or software capable of implementing all or part of the functions of the terminal device. This application does not limit this approach. The following description uses a terminal device as an example.
[0005] As an example of this application, the terminal device is not enabled or does not have wireless LAN functionality. The method includes: detecting network connectivity; identifying the current network scenario when the network is not connected; triggering a network recovery mechanism to restore the network when the network is not in a prepaid card arrears scenario; and not triggering the network recovery mechanism when the network is in a prepaid card arrears scenario, wherein the prepaid card arrears scenario refers to a scenario in which the network cannot access the internet due to a network card arrears.
[0006] In this way, when data service congestion occurs, by determining whether the current scenario is a prepaid card arrears, it can be determined whether to trigger the network recovery mechanism. This can minimize the intermittent appearance of the cellular network signal indicator on the interface due to the network recovery mechanism being triggered in the case of prepaid card arrears, thereby reducing the inconvenience caused to users.
[0007] As an example of this application, detecting network connectivity includes: sending a first number of DNS probe packets to a network device to transmit the DNS probe packets to a preset DNS server via the network device, wherein the DNS probe packets include the domain name of a first probe website; during the sending of the DNS probe packets, receiving a DNS response packet from the DNS server, wherein the DNS response packet includes the address information of the first probe website; upon obtaining the address information of the first probe website, establishing a TCP connection with the first probe website based on the address information of the first probe website; sending a second number of TCP probe packets to the first probe website based on the TCP connection, and receiving a TCP response packet from the first probe website; and detecting network connectivity based on the DNS response packet returned by the DNS server and the TCP response packet returned by the first probe website.
[0008] Thus, by separately counting DNS response packets and TCP response packets, network connectivity can be detected based on the reception of each packet. Since a DNS response packet is also a type of data packet and is fed back from a DNS server different from the first probed website, it can further reflect the network connectivity status even when the network is disconnected. For example, if the network is disconnected, the terminal device will not receive a DNS response packet. Therefore, when determining network connectivity based on the first and second values, the accuracy of the judgment can be improved even when the network is disconnected.
[0009] As an example of this application, network connectivity is detected based on the DNS response packet returned by the DNS server and the TCP response packet returned by the first probe website, including: initializing a first value and a second value, wherein the first value indicates the number of consecutive TCP response packets not received and the second value indicates the number of consecutive DNS response packets not received; during the sending of DNS probe packets and TCP probe packets, if a TCP response packet is received, the first value and the second value are re-initialized; if no TCP response packet is received, the first value is increased by a preset value; if neither a DNS response packet nor a TCP response packet is received, the first value and the second value are increased by the preset value; after the sending of DNS probe packets and TCP probe packets is completed, network connectivity is detected based on the first value and the second value.
[0010] Therefore, by separately analyzing DNS response packets and specific TCP response packets, the first and second values can be determined, and network connectivity can be determined based on the first and second values, thus improving the accuracy of the judgment.
[0011] As an example of this application, after sending DNS probe packets and TCP probe packets, the connectivity of the network is detected based on a first value and a second value, including: if the first value is greater than or equal to a threshold, or the sum of the first value and the second value is greater than or equal to the threshold, then the current network is determined to be disconnected; if the sum of the first value and the second value is less than the threshold, or the first value is less than the threshold, then the current network is determined to be connected.
[0012] Therefore, judging network connectivity based on the first value, or the sum of the first and second values, can improve the accuracy of the judgment.
[0013] As an example of this application, detecting network connectivity includes: sending a DNS probe packet to a preset DNS server, the DNS probe packet including the domain name of a first probe website; receiving a DNS response packet from the DNS server, the DNS response packet including the address information of the first probe website; establishing a TCP connection with the first probe website based on the address information of the first probe website; sending a third number of TCP probe packets to the first probe website based on the TCP connection, and receiving TCP response packets from the first probe website; and detecting network connectivity based on the TCP response packets returned by the first probe website.
[0014] Therefore, by separately analyzing TCP response packets and detecting network connectivity based on these packets, network connectivity detection can also be completed, avoiding the need for additional detection via DNS packets.
[0015] As an example of this application, in the case of network disconnection, identifying the current network scenario includes: parsing the HTTP response code in a non-specific TCP response packet from a first probe website when the network is disconnected; if the parsed HTTP response code indicates that the current network is a portal network, then the network is determined to be in a prepaid arrears scenario; if the parsed HTTP response code indicates that the current network is not a portal network, then the network is determined not to be in a prepaid arrears scenario.
[0016] Thus, by determining whether the network is a portal network, the network scenario can be identified. In other words, the network scenario can be determined based on the HTTP response code. The determination method is relatively simple and easy to implement.
[0017] As an example of this application, a parsed HTTP response code between 200 and 399 that is not an HTTP 204 status code indicates that the current network is a portal network.
[0018] As an example of this application, the method further includes: when the current network is a portal network, parsing and storing the target address carried in a non-specific TCP response packet from the first probe website, the target address being used for the next determination of network connectivity.
[0019] This allows for a more comprehensive assessment of the network environment based on the target address.
[0020] Secondly, a method is provided, which can be executed by a network device, or by a component (such as a circuit, chip, or chip system) configured in the network device, or by a logic module or software capable of implementing all or part of the functions of the network device. This application does not limit this. The following description uses a network device as an example.
[0021] The method includes: during the process of receiving a first number of DNS probe packets sent by a terminal device, upon successful reception of a DNS probe packet from the first number of DNS probe packets, authenticating the first successfully received DNS probe packet using an authentication server based on a whitelist, and forwarding the first successfully received DNS probe packet to a DNS server if authentication is successful; for other DNS probe packets in the first number of DNS probe packets besides the first successfully received DNS probe packet, processing the other DNS probe packets according to network connectivity, wherein the other DNS probe packets are used by the terminal device to perform network connectivity detection.
[0022] This allows terminal devices to probe network connectivity via DNS probe packets. In other words, DNS probe packets can be treated as ordinary data packets to check network connectivity, instead of requiring whitelist authentication every time. Since the DNS probe packets are sent to the DNS server, it's equivalent to the terminal device simultaneously probing network connectivity through both the initial probe website and the DNS server, increasing the number of criteria and improving the effectiveness and accuracy of network connectivity assessments.
[0023] Thirdly, a communication device is provided, comprising a processing module and a transceiver module, the communication device being configured to execute a program or instructions as described in the first aspect above, or to execute a program or instructions as described in the second aspect above.
[0024] Fourthly, a communication device is provided, including a processor. The processor is coupled to a memory and can be used to execute instructions or data in the memory to implement the method in any possible implementation of the first aspect above, or to implement the method in any possible implementation of the second aspect above. Optionally, the communication device further includes a memory.
[0025] Optionally, the processor may be one or more, and the memory may be one or more.
[0026] Fifthly, a computer program product is provided, the computer program product comprising: a computer program (also referred to as code or instructions), which, when the computer program is run, causes a computer to perform the method in any possible implementation of the first aspect above, or to perform the method in any possible implementation of the second aspect above.
[0027] In a sixth aspect, a computer-readable storage medium is provided that stores a computer program (also referred to as code or instructions) that, when executed on a computer, causes the computer to perform the method in any possible implementation of the first aspect above, or to perform the method in any possible implementation of the second aspect above.
[0028] In a seventh aspect, embodiments of this application provide a chip system including one or more processors for calling and executing instructions stored in memory, causing the methods in any of the above aspects or any possible implementations of the above aspects to be executed. The chip system may be composed of chips or may include chips and other discrete devices.
[0029] The chip system may include input circuits or interfaces for transmitting information or data, and output circuits or interfaces for receiving information or data.
[0030] Eighthly, a communication system is provided, including the aforementioned terminal device and network device. Optionally, the communication system may further include other devices that communicate with the terminal device and / or network device. Attached Figure Description
[0031] Figure 1 This is a schematic diagram of the architecture of the communication system 1000 used in the embodiments of this application;
[0032] Figure 2 This is a schematic diagram illustrating a communication scenario according to an exemplary embodiment;
[0033] Figure 3 This is a schematic diagram illustrating the layered structure of a TCP / IP protocol stack according to an exemplary embodiment;
[0034] Figure 4 This is a schematic diagram illustrating the processing method of each layer in a data transmission process according to an exemplary embodiment;
[0035] Figure 5 This is a schematic diagram illustrating a portal authentication system according to an exemplary embodiment;
[0036] Figure 6 This is a schematic diagram illustrating an authentication page for prompting a user to pay a fee, according to an exemplary embodiment.
[0037] Figure 7 This is a flowchart illustrating a network recovery method according to an exemplary embodiment;
[0038] Figure 8 This is a schematic diagram illustrating a communication system according to an exemplary embodiment;
[0039] Figure 9 This is a flowchart illustrating a network recovery method according to an exemplary embodiment;
[0040] Figure 10 This is a schematic diagram illustrating a status code returned during a detection process according to an exemplary embodiment;
[0041] Figure 11 This is a flowchart illustrating a network recovery method according to another exemplary embodiment;
[0042] Figure 12 This is a schematic diagram of the structure of a terminal device according to an exemplary embodiment;
[0043] Figure 13 This is a schematic diagram of the software architecture of a terminal device according to an exemplary embodiment;
[0044] Figure 14 This is a frame diagram of a communication device according to an exemplary embodiment. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0046] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0047] In this application embodiment, "sending information to...(terminal)" can be understood as the destination of the information being the terminal, and may include sending information to the terminal directly or indirectly. "Receiving information from...(terminal)" can be understood as the source of the information being the terminal, and may include receiving information from the terminal directly or indirectly. Information may undergo necessary processing between the source and destination, such as format changes, but the destination can understand the valid information from the source. Similar expressions in this application can be understood in a similar way, and will not be elaborated further here.
[0048] It is understood that some optional features in the embodiments of this application can be implemented independently in certain scenarios without relying on other features, such as the current solution on which they are based, to solve the corresponding technical problems and achieve the corresponding effects. Alternatively, they can be combined with other features as needed in certain scenarios. Correspondingly, the apparatus given in the embodiments of this application can also implement these features or functions, which will not be elaborated here.
[0049] In the embodiments of this application, unless otherwise specified, the same or similar parts between the various embodiments can be referred to each other. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The embodiments of this application described below do not constitute a limitation on the scope of protection of this application.
[0050] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0051] Figure 1 This is a schematic diagram of the architecture of the communication system 1000 used in an embodiment of this application. Figure 1 As shown, the communication system includes a radio access network (RAN) 100, wherein the RAN 100 includes at least one RAN node (e.g., Figure 1 110a and 110b, collectively referred to as 110, may also include at least one terminal device (such as...). Figure 1 RAN100, denoted as RAN120a-120j, is collectively referred to as RAN120. RAN100 may also include other RAN nodes, such as wireless relay equipment and / or wireless backhaul equipment. Figure 1 (Not shown in the image). Terminal device 120 is wirelessly connected to RAN node 110. Terminal devices and RAN nodes can be interconnected via wired or wireless means. Communication system 1000 may also include core network 200. RAN node 110 is connected to core network 200 via wireless or wired means. The core network equipment in core network 200 and RAN node 110 in RAN 100 can be independent physical devices, or they can be the same physical device integrating the logical functions of core network equipment and RAN node. Communication system 1000 may also include Internet 300, which can be used to provide various network services and resources.
[0052] RAN100 can be an evolved universal terrestrial radio access (E-UTRA) system, a new radio (NR) system, or a future radio access system as defined in the 3rd generation partnership project (3GPP). RAN100 can also include two or more of the above-mentioned different radio access systems. RAN100 can also be an open RAN (O-RAN).
[0053] RAN nodes, also known as radio access network equipment, RAN entities, or access nodes, are used to help terminal devices access communication systems wirelessly. In one application scenario, an RAN node can be a base station, an evolved NodeB (eNodeB), a transmission reception point (TRP), a next-generation NodeB (gNB) in 5G mobile communication systems, a next-generation base station in 6G mobile communication systems, or a base station in future mobile communication systems. RAN nodes can also be macro base stations (such as...) Figure 1 110a in the text), can also be a micro base station or an indoor station (such as... Figure 1 110b in the middle can also be a relay node or a donor node.
[0054] In another application scenario, multiple RAN nodes can collaborate to help terminal devices achieve wireless access, with different RAN nodes implementing different functions of the base station. For example, a RAN node can be a central unit (CU), a distributed unit (DU), or a radio unit (RU). Here, the CU performs the functions of the base station's Radio Resource Control (RRC) and Packet Data Convergence Protocol (PDCP), and can also perform the functions of the Service Data Adaptation Protocol (SDAP). The DU performs the functions of the base station's Radio Link Control (RANC) and Medium Access Control (MAC) layers, and can also perform some or all of the physical layer functions. For specific descriptions of these protocol layers, refer to the relevant 3GPP technical specifications. The RU can be used to implement radio frequency signal transmission and reception. The CU and DU can be two independent RAN nodes, or they can be integrated into the same RAN node, such as within a baseband unit (BBU). RUs can be included in radio frequency equipment, such as remote radio units (RRUs) or active antenna units (AAUs). CUs can be further divided into two types of RAN nodes: CU-control plane and CU-user plane.
[0055] In different systems, RAN nodes may have different names. For example, in an O-RAN system, a CU can be called an open CU (O-CU), a DU can be called an open DU (O-DU), and an RU can be called an open RU (O-RU). The RAN nodes in the embodiments of this application can be implemented through software modules, hardware modules, or a combination of software and hardware modules. For example, a RAN node can be a server loaded with the corresponding software modules. The embodiments of this application do not limit the specific technology or device form used in the RAN nodes. For ease of description, a base station is used as an example of a RAN node in the following description.
[0056] A terminal device is a device with wireless transceiver capabilities, capable of sending signals to or receiving signals from a base station. Terminal devices can also be referred to as terminals, user equipment (UE), mobile stations, mobile terminals, etc. They can be widely used in various scenarios, such as device-to-device (D2D), vehicle-to-everything (V2X) communication, machine-type communication (MTC), the Internet of Things (IoT), virtual reality, augmented reality, industrial control, autonomous driving, telemedicine, smart grids, smart furniture, smart offices, smart wearables, smart transportation, and smart cities. Terminal devices can be mobile phones, tablets, computers with wireless transceiver capabilities, wearable devices, vehicles, airplanes, ships, robots, robotic arms, smart home devices, etc. The embodiments of this application do not limit the specific technologies or device forms used in the terminal devices. As an example of this application, the terminal device can insert a subscriber identity module (SIM card) to access the internet using a cellular network.
[0057] Base stations and terminal equipment can be fixed or mobile. They can be deployed on land, including indoors or outdoors, handheld or vehicle-mounted; they can also be deployed on water; and they can be deployed on aircraft, balloons, and satellites. The embodiments of this application do not limit the application scenarios of the base stations and terminal equipment.
[0058] The roles of base stations and terminal devices can be relative, for example, Figure 1 The helicopter or drone 120i can be configured as a mobile base station. For terminal devices 120j that access the wireless access network 100 via 120i, terminal device 120i is a base station; however, for base station 110a, 120i is a terminal device, meaning that 110a and 120i communicate via a wireless air interface protocol. Of course, 110a and 120i can also communicate via a base station-to-base station interface protocol; in this case, 120i is also a base station relative to 110a. Therefore, both base stations and terminal devices can be collectively referred to as communication devices. Figure 1 The 110a and 110b in the text can be referred to as communication devices with base station functions. Figure 1 The 120a-120j in the text can be referred to as communication devices with terminal equipment functions.
[0059] Communication between base stations and terminal devices, between base stations, and between terminal devices can be conducted using licensed spectrum, unlicensed spectrum, or both simultaneously. Communication can be conducted using spectrum below 6 GHz, spectrum above 6 GHz, or both simultaneously. The embodiments of this application do not limit the spectrum resources used for wireless communication.
[0060] In this embodiment, the functions of the base station can be executed by modules (such as chips) within the base station, or by a control subsystem that includes base station functions. This control subsystem can be a control center in the aforementioned application scenarios such as smart grids, industrial control, intelligent transportation, and smart cities. Similarly, the functions of the terminal device can be executed by modules (such as chips or modems) within the terminal device, or by a device that includes terminal device functions.
[0061] In this embodiment, the base station sends downlink signals or downlink information to the terminal device, with the downlink information carried on the downlink channel; the terminal device sends uplink signals or uplink information to the base station, with the uplink information carried on the uplink channel. To communicate with the base station, the terminal device needs to establish a wireless connection on a cell controlled by the base station. The cell with which the terminal device has established a wireless connection is called the serving cell of the terminal device. After establishing the wireless connection, the terminal device can interact with other devices through the base station.
[0062] For example, please refer to Figure 2 ,Should Figure 2 This is a schematic diagram illustrating a communication scenario according to an exemplary embodiment. For example... Figure 2As shown, terminal device 120 can interact with server 200 via base station 1, core network 2, and Internet 3. Server 200 can be a single server or a cluster of multiple servers. Base station 1 is the network device corresponding to the cell where terminal device 120 is currently located. Server 200 provides users with various network services via Internet 3, such as web page services, file transfer services, and email services. These network services allow users to access and use various resources through Internet 3. In one example, the service interaction process between terminal device 120 and server 200 includes: terminal device 120 sends data (such as web page requests) to base station 1 via wireless signal. Base station 1 converts the wireless signal into a wired signal and performs preliminary processing, such as signal decoding and error detection. Then, base station 1 sends the processed data to core network 2 via the backhaul network. Core network 2 performs authentication, authorization, and routing processing on the data, and then forwards the data to the exit gateway of Internet 3. The exit gateway of Internet 3 converts the data into standard Internet Protocol (IP) packets and transmits the packets to server 200 via Internet routing protocols. Server 200 processes the data from terminal device 120 and returns a response message along the original path.
[0063] Both terminal devices and servers run the Transmission Control Protocol (TCP) / IP protocol stack. The TCP / IP protocol stack is the foundational protocol of the Internet, defining the standards and rules for data transmission. Terminal devices and servers can achieve reliable data transmission through the TCP / IP protocol stack. The TCP / IP protocol stack adopts a layered structure, with each layer responsible for a specific function and interacting through interfaces between layers. This decomposes the complex network communication process into multiple layers, thereby achieving efficient data transmission from the physical medium to the application layer, and ultimately enabling reliable data transmission and network interconnection.
[0064] In one example, see Figure 3 The TCP / IP protocol stack is typically divided into five layers, from top to bottom: application layer, transport layer, internet layer, data link layer, and physical layer.
[0065] The application layer's function is to provide various network services and interact directly with users, offering user-level services such as data format processing and session management. Protocols used by the application layer typically include Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS). Application layer protocols define the interaction rules for various network services, enabling users to access various resources and services over the network.
[0066] The transport layer is responsible for end-to-end communication, ensuring reliable data transmission, providing error recovery, and flow control. Protocols used by the transport layer include TCP and User Datagram Protocol (UDP). The transport layer provides reliable transmission services through TCP and low-latency transmission services through UDP.
[0067] The network layer is responsible for routing and forwarding data packets. It transmits packets from the source host to the destination host, selects the best path, and performs routing and forwarding. The protocols used by the network layer typically include IP. The network layer provides logical addresses to data packets via the IP protocol and forwards them to the target network according to the routing table.
[0068] The data link layer organizes the bitstream from the physical layer into frames, and is responsible for frame transmission, error detection and correction, flow control, etc. Protocols used by the data link layer include Ethernet and point-to-point protocols. The data link layer ensures reliable data transmission over the physical link and identifies devices using MAC addresses.
[0069] The physical layer is responsible for the transmission of bit streams over the physical medium, defining the electrical, mechanical, functional, and procedural characteristics of that medium. Protocols used by the physical layer include Ethernet physical layer standards such as 1000BASE-T. The physical layer is the foundation of network communication, providing the physical connection of the transmission medium and the capability for signal transmission.
[0070] When a terminal device sends data, the TCP / IP protocol stack encapsulates the data layer by layer from top to bottom. That is, in the TCP / IP protocol stack, each layer encapsulates the data received from the layer above, adding its own protocol header information. See also... Figure 4The data transmission process includes: the application layer generates data and passes it to the transport layer; the transport layer encapsulates the data, adds TCP or UDP header information to form a data segment, and passes it to the network layer. If TCP is used, a three-way handshake is performed to establish a TCP connection if reliable data transmission is required; the network layer adds IP header information to the data segment to form a packet, and passes it to the data link layer. The IP header information includes the source IP address and the destination IP address; the data link layer adds frame header and trailer information to the packet to form a frame, and passes it to the physical layer. The frame header includes the source MAC address and the destination MAC address; the physical layer converts the frame into a bit stream and sends it out through the physical medium.
[0071] The data reception process is the reverse of the data transmission process, including: the physical layer receives the bit stream, converts it into frames, and passes it to the data link layer; the data link layer removes the frame header and trailer information, extracts the data packets, and passes them to the network layer; the network layer removes the IP header information of the data packets, extracts the data segments, and passes them to the transport layer; the transport layer removes the TCP or UDP header information of the data segments, extracts the data, and passes it to the application layer. If the TCP protocol is used, a four-way handshake will be performed to release the TCP connection; the application layer processes the data and completes the business logic.
[0072] It should be noted that the above explanation uses the TCP / IP protocol stack as an example of five layers. In another example, it may be divided into four layers, such as the application layer, transport layer, network layer, and data link layer. In this case, the data transmission process is similar to the process described above.
[0073] To facilitate understanding, the technical terms involved in the embodiments of this application will be introduced below.
[0074] (1) Radio module: It is mainly used for transmitting and receiving wireless signals. It transmits data through the air via radio waves. For example, when transmitting data, it converts the data into radio waves and sends them out; when receiving data, it receives radio waves from other devices and converts them into data.
[0075] (2) Modem: A modem is a device that primarily functions to modulate and demodulate signals, that is, to convert digital signals (such as binary data in a terminal device) into wireless signals suitable for transmission over a physical medium; or to convert received wireless signals into digital signals. In some embodiments, most layers of the TCP / IP protocol stack can be deployed in the modem, such as the physical layer and data link layer, and possibly also the transport layer and network layer. That is, the functions of these layers can be implemented by the modem.
[0076] In applications, the radio module and modem can work together to achieve efficient data transmission. For example, in cellular communication, the terminal device's radio module is responsible for wireless communication with the base station, while the modem is responsible for modulating digital signals into wireless signals suitable for wireless transmission, or demodulating received wireless signals into digital signals.
[0077] (3) DNS packets: These are the basic units used for data transmission in the DNS protocol, a network protocol used to convert domain names into IP addresses. For example, a DNS packet includes a DNS probe packet and a DNS response packet. These packets interact between the client and the DNS server to achieve domain name resolution. For instance, when a user enters a domain name, such as www.example.com, into their browser, the browser sends a DNS probe packet to the DNS server, requesting the resolution of the IP address corresponding to that domain name; the server returns the resolution result via a DNS response packet.
[0078] (4) TCP packet: The basic unit used to transmit data in the TCP protocol, which is a connection-oriented, reliable, byte-stream-based transport layer protocol. TCP packets can establish a reliable TCP connection between the client and the server and ensure the integrity and sequential transmission of data.
[0079] (5) HTTP: HTTP is an application layer protocol used on the Internet for transmitting hypertext, such as web pages, images, and videos. The HTTP protocol uses a request / response model. The client sends an HTTP request to the server, the server receives the request, processes it, and then returns an HTTP status code. HTTP requests generally include GET, POST, PUT, and DELETE. GET is used to request resources such as web pages; POST is used to request and submit data such as files and forms; PUT is used to create, update, or replace resources on the server; and DELETE is used to request the deletion of resources. Common HTTP status codes include 2xx, 3xx, and 5xx. 2xx indicates a successful request; 3xx indicates a redirect requiring further action; and 5xx indicates a server error.
[0080] (6) HTTP 204 status code: This status code indicates that the server has successfully processed the client's request and does not need to return any response content. It belongs to the 2xx success status code series and indicates that the request has been successfully completed, but the client does not need to update the current page or load new data. For example, in one possible application scenario, when a client successfully updates a resource using a PUT request, the server can indicate some update-related information in the HTTP response header so that the client knows the update was successful and does not need to return any response content. In this case, the server can return the HTTP 204 status code.
[0081] (7) Redirection status code: This is a redirection response that indicates the requested resource has been temporarily redirected to a Uniform Resource Locator (URL) specified in the response header of the response message. Upon receiving a redirection status code, the client will be redirected to this URL. Redirection status codes typically include 3xx status codes, such as the HTTP 302 status code. The HTTP 302 status code indicates a temporary redirect, used to indicate that the resource is temporarily redirected to a new URL; search engines will not update the link, meaning the original URL is retained.
[0082] (8) HTTPS: It adds a secure sockets layer / transport layer security (SSL / TLS) encryption mechanism on top of HTTP to protect the security of data during transmission.
[0083] (9) Prepaid cards: This is a service model where you prepay before using the service. You typically need to pay the operator in advance to receive the service. Data services, calls, and other functions are unavailable when the balance is in arrears. In contrast, there are postpaid cards, where the operator allows you to provide the service first and pay later.
[0084] (10) Portal authentication: also known as web authentication, is a process where terminal devices are only allowed to access the network after authentication is completed through an authentication page. Please see [link to relevant documentation]. Figure 5 , Figure 5 This is a schematic diagram illustrating a portal authentication system according to an exemplary embodiment. The portal authentication system mainly includes four basic elements: a client 500, an access device 510, a portal server 520, and an authentication server 530.
[0085] Client 500: Used to initiate authentication requests, typically by a browser running the HTTP protocol on the terminal device;
[0086] Access device 510: Responsible for redirecting users' HTTP requests to the portal server and interacting with the portal server and authentication server to complete authentication;
[0087] Portal server 520: Provides a web-based authentication page and interacts with access devices to exchange user authentication information. For example, user authentication information includes account password, SMS verification code, or acceptance of terms of use, etc.
[0088] Authentication server 530: Such as a RADIUS server, or a server that integrates both a RADIUS server and an authentication server. The authentication server is responsible for authenticating, authorizing, and billing users.
[0089] The portal authentication process includes: client 500 initiates an HTTP request to access the network; access device 510 intercepts the HTTP request from client 500, returns a redirection status code (e.g., HTTP 302), and redirects the user to portal server 520; portal server 520 provides an authentication page, where the user enters their authentication information; portal server 520 transmits the authentication information to access device 510; access device 510 interacts with authentication server 530 to complete authentication. After successful authentication, access device 510 allows client 500 to access network resources.
[0090] In one possible scenario, the terminal device accesses the internet solely via a cellular network, and the SIM card used is a prepaid card. In this case, if the prepaid card is in arrears, the portal authentication process will be triggered. For example, the HTTP request initiated by client 500 will be intercepted by the cellular network access device (such as a base station or core network). The access device will redirect the HTTP request to a pre-defined portal server. The portal server will return an authentication page, which indicates that the user's account is in arrears and typically provides links to recharge or resolve the arrears issue, for example, see [link to relevant documentation]. Figure 6 , Figure 6 This is an authentication page that prompts a user to pay a fee, as illustrated in an exemplary embodiment. Only after the user successfully recharges their account via the authentication page will the access device allow the terminal device to access the internet.
[0091] (11) Dorecovery mechanism: This is a network recovery mechanism for cellular networks. When a data service is blocked while a terminal device is using a cellular network to access the internet, the terminal device can activate the Dorecovery mechanism to restore the network. For example, if the terminal device determines that it is currently using a cellular network by reading the network type indicator information, then the Dorecovery mechanism will be triggered to restore the network after the data service blockage occurs. The network type indicator information is used to indicate the type of the currently connected network.
[0092] The Dorecovery mechanism includes multiple recovery levels, such as the following:
[0093] Level 1: Includes triggering fast retransmission and fine-tuning protocol parameters, such as TCP window size;
[0094] Level 2: Includes resetting TCP connections, etc.
[0095] Level 3: Includes restarting the radio module, briefly shutting down the radio frequency, etc.
[0096] Level 4: Includes restarting network-related subsystems, such as restarting the modem;
[0097] During network recovery, recovery attempts are made gradually from lightweight (level 1) to heavyweight (level 4) to minimize the impact on users' online experience caused by excessive recovery.
[0098] In cellular networks, when data service congestion occurs due to network congestion, equipment failure, or abnormal traffic, terminal devices can restore normal network operation by initiating network recovery mechanisms. For example, to improve or eliminate data service congestion, the Android system introduces the Dorecovery mechanism. During data transmission, if data service congestion is detected, the Dorecovery mechanism can attempt network recovery in stages. For instance, if no response message is received after TCP packets are sent, and the number of TCP packets sent reaches a certain threshold, data service congestion is confirmed. At this point, the terminal device can trigger the Dorecovery mechanism, which gradually attempts to restore the network from a lightweight to a heavyweight approach. If recovery through triggering the Dorecovery mechanism once is ineffective, the terminal device will typically trigger the Dorecovery mechanism multiple times to attempt network recovery multiple times.
[0099] In scenarios where prepaid cards are in arrears—that is, when a terminal device uses a prepaid card for internet access but the card is overdue—the operator will not provide service, meaning data services are unavailable. Therefore, the terminal device will detect data service congestion and trigger the Dorecovery mechanism multiple times to attempt network recovery in stages. However, because the Dorecovery mechanism involves disconnecting and then reconnecting to the network (e.g., at level 2 to level 4), the terminal device's interface does not display the cellular signal indicator when disconnected, but it does when reconnected. This repeated disconnection or signal loss during network recovery attempts can cause the cellular signal indicator to appear intermittently on the user's screen, potentially causing confusion.
[0100] Therefore, this application provides a network recovery method, see [link to relevant documentation]. Figure 7 This method continuously probes the network to determine its connectivity. If the network is unavailable, it further determines whether the issue stems from a prepaid card arrears. If so, the Dorecovery mechanism is not activated; otherwise, it is activated to restore the network. This minimizes the inconvenience caused by frequent network attempts by the device in prepaid card arrears scenarios, reducing user disruption.
[0101] The network recovery method provided in the embodiments of this application will be described in detail below. First, see... Figure 8 This network recovery method can be applied to Figure 8 The communication system shown includes terminal devices, network devices, an authentication server, a DNS server, and a probe server. Exemplarily, the network devices include base stations and core networks, or core networks integrated with access functions. The probe server provides a first probe website, and optionally, a second probe website. Both the first and second probe websites are websites capable of probing the network connectivity of the terminal devices, i.e., testing whether the terminal devices can access the internet. The DNS server can be a pre-defined server capable of performing domain name resolution. As an example, the terminal device uses a prepaid card for internet access, for instance, the terminal device may not have or may not have enabled Wireless Fidelity (WiFi) functionality.
[0102] It should be noted that the embodiments of this application are illustrated by taking the example that the first detection website and the second detection website are provided by the same detection server. In another example, the first detection website and the second detection website may also be provided by different detection servers. The embodiments of this application do not limit this.
[0103] Please see Figure 9 , Figure 9 This is a flowchart illustrating a network recovery method according to an exemplary embodiment. The following describes the network recovery method as follows: Figure 8 The following is an example of a communication system implementation. This network recovery method may include some or all of the following:
[0104] S901: The terminal device obtains the first target detection URL.
[0105] The first target detection URL is used to request access to the first detection website.
[0106] Optionally, the terminal device can also obtain a second target detection URL, which is used to request access to a second detection website.
[0107] Both the first and second target detection URLs can be set by technicians according to their needs.
[0108] As an example, the first website tested supports the HTTP protocol; the second website tested supports the HTTPS protocol.
[0109] As an example of this application, the second target detection URL is a backup detection URL. Specifically, when the terminal device cannot access the first detection website based on the first target detection URL due to network access restrictions or other reasons, the terminal device can access the second detection website based on the second target detection URL to test network connectivity, thus ensuring the reliability of network connectivity detection. In some embodiments, the second target detection URL may not be set, that is, the terminal device is only configured with the first target detection URL.
[0110] In one example, the first target probe URL and the second target probe URL can be pre-configured in a specified configuration item of the terminal device. When it is necessary to probe network connectivity, the terminal device can obtain the first target probe URL and the second target probe URL from the specified configuration item, so as to probe the current network connectivity of the terminal device based on the first target probe URL and / or the second target probe URL, that is, to probe whether the terminal device can access the Internet.
[0111] As an example, the terminal device can periodically perform network connectivity probes. The probe period can be set according to actual needs. For example, it can obtain the first target probe URL and the second target probe URL every 5 minutes to probe the network connectivity based on the first target probe URL and / or the second target probe URL.
[0112] Optionally, the terminal device can also perform network connectivity detection when there is a need to access the internet. For example, when an internet-connected application is launched, the terminal device obtains a first target detection URL and a second target detection URL to detect network connectivity based on the first target detection URL and / or the second target detection URL.
[0113] It should be noted that this embodiment is illustrated using the example of a terminal device being able to obtain both the first and second target detection URLs, meaning the terminal device is configured with both URLs. In one possible scenario, the terminal device may not be able to obtain either the first or second target detection URLs. For example, if the first and second target detection URLs are not configured in the specified settings, the terminal device will not be able to obtain them. In this case, the terminal device can obtain the native detection URL to perform network connectivity detection via a native detection website. The native detection URL is a built-in detection URL of the terminal device's Android system, and the native detection website is also a website that can be used to detect the network connectivity of the terminal device. The implementation of network connectivity detection based on the native detection URL is similar to that based on either the first or second target detection URL; see below for details. Optionally, if the first target probe URL and the second target probe URL cannot be obtained, the terminal device can re-obtain the first target probe URL and the second target probe URL before obtaining the native probe URL. If they are still not obtained, the native probe URL is obtained. In this way, the robustness of the system can be enhanced through the retry mechanism.
[0114] S902: The terminal device sends a first number of DNS probe packets to the network device, the DNS probe packets carrying the first target probe URL.
[0115] The first quantity can be set according to needs; for example, the first quantity is 10.
[0116] When a terminal device accesses a first-target website, it needs to know the website's IP address. The first target URL of this website is usually a domain name, such as www.ziyan.com. Since domain names cannot be directly used for network communication, the terminal device can send a DNS probe packet to a DNS server to request domain name resolution, i.e., to resolve the first target URL into an IP address. To do this, the terminal device sends a DNS probe packet to a network device, which then sends the packet to the DNS server.
[0117] As an example, the terminal device may create a first thread to send a first number of DNS probe packets to the network device.
[0118] As an example of this application, the terminal device sends a first number of DNS probe packets to the network device. This is to prevent the terminal device from failing to resolve DNS due to a single unsuccessful attempt to send a DNS probe packet. On the other hand, if the DNS resolution is successful, the terminal device can detect the network connectivity by sending DNS probe packets. In other words, the DNS probe packets are treated as ordinary data packets to detect whether the terminal device's network is connected. For details on the implementation, please refer to the following text.
[0119] It should also be noted that the interval between two consecutive DNS probe packets can be set as needed, and this application embodiment does not limit this.
[0120] S903: Network devices authenticate DNS probe packets through an authentication server.
[0121] As an example, after receiving a DNS probe packet, the network device sends the DNS probe packet to the authentication server for authentication.
[0122] For example, the authentication server can whitelist the first target probe URL, the second target probe URL, the first IP address corresponding to the first target probe URL, and the second IP address corresponding to the second target probe URL. This allows the terminal device to still perform domain name resolution through the DNS server and access the first and second probe websites even when it is in arrears. When the authentication server receives a DNS probe packet from the network device, it can parse the packet to obtain relevant information, such as the domain name and user identity. Then, it performs authentication based on the whitelist and sends the authentication result back to the network device. If the authentication result indicates successful authentication, the DNS query is allowed to continue; if the authentication result indicates failed authentication, the query is rejected or an error response is returned. Since the first target probe URL is on the whitelist, the authentication result returned by the authentication server indicates successful authentication. The network device then determines to allow the DNS query to continue and executes the following operations S904 to S907.
[0123] It should be noted that the network device does not perform whitelist authentication on every single DNS probe packet in the first number of DNS probe packets sent by the terminal device. Once a received DNS probe packet is successfully authenticated in the manner described above, subsequent DNS probe packets are no longer whitelisted and are treated as ordinary data packets. The purpose of using DNS probe packets is to detect network connectivity. For example, it can determine whether the terminal device is in arrears, thereby determining whether the terminal device can access the Internet, that is, whether the network is connected.
[0124] For example, during a connectivity probe, if the network device receives the first DNS probe packet from the first number of DNS probe packets sent by the terminal device, it performs whitelist authentication on this DNS probe packet in the manner described above. After successful authentication, it proceeds to operations S904 to S907. For subsequent received DNS probe packets, i.e., the second to the last DNS probe packets from the first number of DNS probe packets, the network device no longer performs whitelist authentication in the manner described above. Instead, it processes them according to normal packet processing methods. That is, if the network is connected, it forwards the packet to the DNS server. In this case, the DNS server returns a DNS response packet along the same path. For example, the DNS server sends a DNS response packet to the network device, and the network device sends a DNS response packet to the terminal device. Accordingly, the terminal device can receive the DNS response packet. If the network is not connected, the network device instructs the DNS server that the network is not connected. In this case, the DNS server will not return a DNS response packet, and accordingly, the terminal device will not receive the DNS response packet.
[0125] S904: If authentication is successful, the network device sends a DNS probe packet to the DNS server.
[0126] S905: The DNS server resolves the first target URL in the DNS probe packet to obtain the first IP address.
[0127] Each time a DNS server receives a DNS probe packet, it resolves the first target probe URL carried in the packet to obtain the resolution result, which is the first IP address, i.e., the first IP address of the first probed website.
[0128] S906: The DNS server sends a DNS response packet to the network device, and the DNS response packet carries the resolved first IP address.
[0129] S907: Network devices send DNS response packets to terminal devices.
[0130] In other words, the DNS server returns the DNS response packet along the same path. Correspondingly, the terminal device receives the DNS response packet returned by the DNS server, for example, by receiving the DNS response packet through a first thread, and obtains the first IP address from the DNS response packet.
[0131] It should be noted that this embodiment of the application is based on the example of the terminal device successfully obtaining the first IP address returned by the DNS server. In one example, if the terminal device fails to successfully send a DNS probe packet or fails to successfully receive the first IP address returned by the DNS server within a first preset time period, it may be due to processing errors or process crashes on the terminal device side. In this case, the terminal device can determine that the probe failed because the DNS query failed. Optionally, the terminal device can display a prompt message indicating that the DNS query failed. The first preset time period can be set according to requirements, for example, the first preset time period is 3 seconds.
[0132] S908: After obtaining the first IP address, the terminal device establishes a TCP connection with the first probe website based on the first IP address.
[0133] TCP connections are used to transmit TCP data.
[0134] As an example of this application, the terminal device can send a TCP probe packet to the first probe website so as to determine the network connectivity based on the TCP response packet returned by the first probe website in response to the TCP probe packet, combined with the reception of the DNS response packet. To this end, a TCP connection is established between the terminal device and the first probe website.
[0135] As an example of this application, the specific implementation of establishing a TCP connection between a terminal device and a first probe website based on a first IP address may include: the terminal device sending an HTTP request 1 to a network device, the HTTP request 1 carrying the first IP address; the network device requesting an authentication server to authenticate the HTTP request 1; since the first IP address is in a whitelist, the authentication server authenticates the HTTP request 1 successfully; the authentication server sends an authentication result back to the network device, indicating successful authentication; then, the network device sends an HTTP request 1 to the first probe website; the first probe website returns an HTTP response 1 via the same path; after receiving the HTTP response 1, the terminal device sends an acknowledgment message to the first probe website via the same transmission path used to send the HTTP request 1, thus successfully establishing a TCP connection.
[0136] For example, HTTP request 1 is SYN, HTTP response 1 is SYN-ACK, and the acknowledgment message is ACK.
[0137] As an example, the terminal device creates a second thread to establish a TCP connection with the first probe website and perform subsequent interactive operations. This application embodiment does not limit this.
[0138] In one possible scenario, the terminal device may time out sending HTTP request 1, for example, failing to successfully send HTTP request 1 within a second preset time period (e.g., 10 seconds). This could be due to a process crash or processing error on the terminal device side. In this case, the terminal device can return to operation S901 to re-establish the TCP connection. This embodiment of the application is illustrated using the successful sending of HTTP request 1 as an example.
[0139] S909: The terminal device sends a second number of TCP probe packets to the first probe website via a TCP connection.
[0140] The second quantity can be set according to actual needs; for example, the second quantity is 10.
[0141] After a TCP connection is established between the terminal device and the first detection website, TCP probe packets can be continuously sent to the first detection website through the TCP connection until the number of TCP probe packets sent reaches the second number.
[0142] Specifically, the terminal device sends a second number of TCP probe packets to the network device based on a TCP connection. After receiving the TCP probe packets, the network device determines whether the terminal device can access the Internet. If the terminal device can access the Internet, it sends the TCP probe packets to the first probe website. If the terminal device cannot access the Internet, it notifies the first probe website that the network is disconnected. For example, a specified flag can be added to the TCP probe packets to indicate that the terminal device cannot access the Internet.
[0143] Optionally, the TCP probe packet and the DNS probe packet are corresponding. For example, after successfully establishing a TCP connection with the first probe website, the terminal device can send a corresponding TCP probe packet for every DNS probe packet it sends.
[0144] S910: The terminal device receives the TCP response packet from the first probe website.
[0145] The TCP response packets returned by the first probe website include specific TCP response packets and non-specific TCP response packets.
[0146] Specific TCP response packets are response packets sent in response to TCP probe packets, while non-specific TCP response packets are other TCP response packets besides the specific ones. When the network is connected, the terminal device can receive the specific TCP response packet sent by the first probe website; when the network is disconnected, the terminal device will receive the non-specific TCP response packet sent by the first probe website.
[0147] In one example, a specific TCP response packet carries an HTTP 204 status code, while non-specific TCP response packets include HTTP status codes other than HTTP 204. These other status codes can be used to indicate the reason for network connectivity issues.
[0148] In other words, if the network is connected, the first probing website can receive TCP probe packets forwarded by the network device. In this case, the first probing website returns a specific TCP response packet along the same path, for example, by sending a specific TCP response packet to the network device, which then forwards the specific TCP response packet to the terminal device. If the network is not connected, the first probing website will not receive TCP probe packets forwarded by the network device. For example, it might receive TCP probe packets with a specified identifier added by the network device. In this case, the first probing website will not return a specific TCP response packet along the same path, but instead returns a non-specific TCP response packet. For example, the HTTP status code carried in the returned non-specific TCP response packet might be between 200 and 399, and not 204.
[0149] S911: Terminal devices determine network connectivity based on the reception of specific TCP and DNS response packets.
[0150] When the network is connected, for each TCP probe packet sent by the terminal device, it will receive a specific TCP response packet returned by the first probed website. If the network is disconnected, the terminal device may send multiple TCP probe packets consecutively without receiving the specific TCP response packet returned by the first probed website. Similarly, when the network is connected, for each DNS probe packet sent by the terminal device, it will receive a DNS response packet returned by the DNS server. If the network is disconnected, the terminal device may send multiple DNS probe packets consecutively without receiving the DNS response packet returned by the DNS server. Therefore, the terminal device can determine network connectivity based on the reception of specific TCP and DNS response packets.
[0151] Therefore, the terminal device determines a first value and a second value based on the reception of specific TCP response packets and DNS response packets. The first value indicates the number of consecutive TCP response packets not received, or the total number of TCP probe packets sent since the last received specific TCP response packet. The second value indicates the number of consecutive DNS response packets not received, or the total number of DNS probe packets sent since the last received DNS response packet. Then, the network connectivity is determined based on the first and second values.
[0152] As an example, before determining the first and second values based on the received TCP and DNS response packets, the terminal device can initialize both values, for example, by setting them to 0. Then, during the sending of DNS and TCP probe packets, the first and second values are updated according to the received DNS and TCP response packets. For example, the first value is denoted as tcpSent, and the second value as dnsSent. The method for updating the first and second values based on the received TCP and DNS response packets can be seen in Table 1 below:
[0153] Table 1
[0154]
[0155] As shown in Table 1, after the terminal device sends DNS probe packets and TCP probe packets, it may receive DNS response packets and specific TCP response packets, or it may only receive specific TCP response packets, or it may only receive DNS response packets, or it may not receive either DNS response packets or specific TCP response packets.
[0156] If, during the sending of DNS and TCP probe packets, a DNS response packet and a specific TCP response packet are received in response to the DNS probe packet, it indicates that the terminal device can currently access the internet, and the network is connected. Therefore, both the first and second values can be reset to zero. If, during the sending of DNS and TCP probe packets, a DNS response packet is received in response to the DNS probe packet, but a specific TCP response packet is not received, it indicates that the network may be unstable. In this case, the first value should be increased, for example, by incrementing it by 1. If, during the sending of DNS and TCP probe packets, no response packet is received in response to the DNS probe packet, it indicates that the network may be unstable. If a DNS response packet is received, but a specific TCP response packet is received from the first probing website in response to the TCP probe packet, it indicates that the failure to receive the DNS response packet may be due to a DNS server resolution error. Since a specific TCP response packet is received, it can be determined that the network is connected, so both the first and second values can be cleared to zero. If no DNS response packet is received in response to the DNS probe packet, and no specific TCP response packet is received from the first probing website in response to the TCP probe packet, it indicates that the terminal device cannot access the Internet at present, that is, the network is disconnected. In this case, the first and second values should be increased respectively, for example, both the first and second values can be increased by 1.
[0157] In this way, a first value and a second value can be determined during the packet sending process, so that after the packet is sent, the terminal device can determine whether the terminal device is connected based on the first value and the second value.
[0158] Optionally, when counting specific TCP response packets, TCP response packets received during the establishment of a TCP connection (such as HTTP response 1 and acknowledgment messages) can also be included, and when counting DNS response packets, DNS response packets when querying the first IP address can also be included.
[0159] It is worth mentioning that by separately analyzing DNS response packets and specific TCP response packets, the first and second values are determined. Since DNS response packets are also a type of transmitted data packet and are fed back by a DNS server different from the first probed website, they can further reflect the network connectivity status when the network is not connected. For example, if the network is not connected, the terminal device will not receive DNS response packets. Therefore, when determining network connectivity based on the first and second values, the accuracy of the judgment can be improved when the network is not connected.
[0160] As an example, the specific implementation of a terminal device determining whether the network is connected based on a first value and a second value may include: if the sum of the first value and the second value is greater than or equal to a threshold, or if the first value is greater than or equal to the threshold, then it is determined that the current network is not connected, that is, the terminal device cannot access the Internet, thereby determining that data service congestion has occurred; if the sum of the first value and the second value is less than the threshold, or if the first value is less than the threshold, then it is determined that the current network is connected, that is, the terminal device can access the Internet, thereby determining that no data service congestion has occurred.
[0161] The threshold value can be set according to actual needs, and this application embodiment does not limit it.
[0162] Of course, the above implementation of determining whether the network is connected based on the first and second values is only an example. In another example, other methods can be used to determine whether the network is connected. For example, if both the first and second values are greater than or equal to the threshold, the network is not connected. If both the first and second values are less than the threshold, the network is connected.
[0163] S912: In the event of a network outage, the terminal device determines whether the current situation is a prepaid card arrears scenario based on the HTTP status code returned by the first detection website.
[0164] If the network is unavailable, it indicates that the terminal device is currently unable to access the internet, thus confirming a data service blockage. In this case, the terminal device does not immediately trigger the DoRecovery mechanism but further determines whether it is due to an unpaid prepaid card. To do this, the terminal device can parse the HTTP status code returned by the first detection website and determine whether the current situation is due to an unpaid prepaid card.
[0165] As mentioned earlier, when a terminal device uses only cellular network access, if it uses a prepaid SIM card and the card is in arrears, the terminal device will be redirected to an authentication page prompting the user to pay the outstanding balance upon receiving a network probe request. This triggers the portal authentication process, for example, see [link to relevant documentation]. Figure 10The terminal device will continuously receive an HTTP status code 302, which carries a URL address used to redirect to the operator's payment address. In this case, the current network can be called a portal network. Therefore, when a terminal device uses a prepaid card to access the internet, determining whether the current situation is a prepaid card arrears scenario is essentially determining whether the current network is a portal network. In one example, according to the HTTP protocol, if the HTTP status code is between 200 and 399 and not an HTTP 204 status code, it can be determined that the current network is a portal network, thus confirming a prepaid card arrears scenario; otherwise, it can be determined that it is not a portal network, i.e., not a prepaid card arrears scenario. For example, if the status code is 599, it can be determined that the inability to access the internet is likely due to a server-side error, rather than due to an arrears in the prepaid card.
[0166] Optionally, if the HTTP status code indicates that the current network is a portal, the non-specific TCP response packet may also include the destination address, as seen in [reference needed]. Figure 10 The target address is http: / / ecarrier.claro.co / orquestadordatos?user-PREPAG0\r\n, which points to an authentication page prompting the user to pay. As an example, the terminal device can store this target address so that when determining whether it is a portal network, it can compare the URL address carried in the TCP response packet with this target address. If they match, it is confirmed to be a portal network; otherwise, it is not. Optionally, the terminal device can store the target address for a specified duration, which can be set as needed, such as 24 hours. If the storage time exceeds the specified duration, the target address is deleted to prevent errors caused by target address updates.
[0167] If the current situation involves a prepaid card arrears, proceed to step S913; if the current situation does not involve a prepaid card arrears, proceed to step S914.
[0168] It should be noted that the embodiments in this application are illustrated using the example of network connectivity failure. In another example, if the network is connected, the terminal device does not initiate the Dorecovery mechanism, and when the detection conditions are met, such as when the next detection cycle is reached, the terminal device returns to the operation of S901 to continue detecting network connectivity.
[0169] S913: Terminal devices do not start the Dorecovery mechanism.
[0170] If the current situation involves a prepaid card in arrears, even if the Dorecovery mechanism is activated, the network cannot be restored. Moreover, the cellular network signal indicator displayed on the terminal device's interface may appear intermittently, causing inconvenience to the user. Therefore, the terminal device should not activate the Dorecovery mechanism and should wait for the data to be restored before lifting the restriction. This can avoid the intermittent appearance of the cellular network signal indicator on the terminal device's interface and thus prevent inconvenience to the user.
[0171] S914: The terminal device initiates the Dorecovery mechanism to restore the network.
[0172] If the current situation is not due to prepaid card arrears, it may be caused by a short-term network outage, server-side error, or other reasons. In this case, the terminal device can activate the Dorecovery mechanism to attempt to restore the network in stages through the Dorecovery mechanism.
[0173] It should be noted that the above embodiments are illustrated using the example of a terminal device being able to access the first probe website. In one possible scenario, the TCP connection between the terminal device and the first probe website fails to be established, meaning the terminal device cannot access the first probe website, for example, due to network restrictions or server errors, preventing the terminal device from accessing the first probe website. In this case, the terminal device can follow the above process to request the DNS server to resolve the second target probe URL, and based on the resolution result, send an HTTPS request to the second probe website to request the establishment of a transmission channel for transmitting TCP probe packets. In this case, network connectivity will be probed through the second probe website, and the process is similar to the process by which the terminal device probes network connectivity through the first probe website.
[0174] It is worth mentioning that the terminal device obtains the first target detection URL and the second target detection URL respectively. When it is unable to access the first detection website indicated by the first target detection URL, it can continue to perform network connectivity detection based on the second target detection URL by accessing the second detection website. This can minimize the possibility that the terminal device cannot complete the network connectivity detection due to network restrictions preventing it from accessing the first detection website, or even mistakenly judging that the terminal device cannot access the Internet, thereby improving the reliability and accuracy of network connectivity judgment.
[0175] It should be noted that sending an HTTP request to the first probe website to request the establishment of a transmission channel, and then sending an HTTPS request to the second probe website to request the establishment of a transmission channel if the first probe website is inaccessible, is merely an example. In another example, the terminal device can also access the first and second probe websites simultaneously. For example, it can resolve the first and second target probe URLs through a DNS server, and then send an HTTP request to the first probe website and an HTTPS request to the second probe website based on the resolution results, thus accessing both websites simultaneously. This means performing network connectivity probing through both websites simultaneously. For instance, network connectivity probing can be performed based on the TCP response packets returned by the first probe website and the received DNS response packets, or it can be based on the TCP response packets returned by the second probe website and the received DNS response packets, or it can be based on all TCP response packets returned by both websites and the received DNS response packets. For a detailed explanation of the implementation process, please refer to the section below on probing network connectivity through the first probe website. Therefore, by simultaneously accessing both the first and second detection websites to perform network connectivity testing, the inability of one of the websites to complete the test can be avoided, thus improving the reliability of the network connectivity testing. Furthermore, using custom detection websites increases the flexibility of the testing process.
[0176] Optionally, if the terminal device cannot obtain the first target probe URL and the second target probe URL, it can follow the above process to request the DNS server to resolve the native probe URL, and send an HTTP request to the native probe website based on the resolution result to request the establishment of a transmission channel with the native probe website for transmitting TCP probe packets. In this case, network connectivity will be probed through the native probe website.
[0177] In this embodiment, the terminal device detects network connectivity. If the network is not connected, it further determines whether it is a prepaid card arrears scenario. If it is a prepaid card arrears scenario, the Dorecovery mechanism is not triggered; otherwise, if it is not a prepaid card arrears scenario, the Dorecovery mechanism is triggered to restore the network. This can minimize the phenomenon of intermittent cellular network signal identification caused by multiple network restoration attempts in prepaid card arrears scenarios, thereby reducing the inconvenience to users.
[0178] The above embodiment illustrates how network connectivity is probed by separately counting DNS response packets and specific TCP response packets. In another example, specific TCP response packets can also be counted, and network connectivity can be determined based on the reception of these specific TCP response packets. The following will explain... Figure 11 The illustrated embodiments describe the specific implementation process. Please refer to [link / reference]. Figure 11 , Figure 11 This is a flowchart illustrating a network recovery method according to another exemplary embodiment, which can be applied to... Figure 8 In the communication system shown, the method may include some or all of the following:
[0179] S1101: The terminal device obtains the first target detection URL.
[0180] For its specific implementation, please refer to Figure 9 Step S901 in the embodiment.
[0181] S1102: The terminal device creates a first thread and sends a DNS probe packet to a preset DNS server through the first thread. The DNS probe packet carries the first target probe URL.
[0182] The DNS probe packet is used to request the resolution of the first target probe URL.
[0183] For details on how the terminal device sends DNS probe packets to the DNS server, please refer to [link / reference]. Figure 9 S902 to S904 in the embodiment.
[0184] It should be noted that, with Figure 9 The difference in the illustrated embodiment is that if the terminal device can successfully send DNS probe packets, it does not need to send multiple DNS probe packets consecutively; it only needs to successfully query the first IP address of the first probed website.
[0185] S1103: The terminal device determines whether the DNS probe packet has timed out.
[0186] In one possible scenario, if the terminal device fails to send a DNS probe packet within the first preset time period, it may be due to a processing error or process crash on the terminal device side. In this case, the terminal device can determine that the probe failed because the DNS query failed. Optionally, the terminal device can display a prompt message indicating that the DNS query failed.
[0187] The first preset duration can be set according to needs, for example, the first preset duration is 3 seconds.
[0188] If the DNS probe packet is sent without timeout, proceed to the following S1104 operation.
[0189] S1104: The terminal device receives the DNS response packet through the first thread and obtains the first IP address from the DNS response packet.
[0190] As an example, after receiving a DNS probe packet, the DNS server resolves the first target probe URL carried within it to obtain the first IP address corresponding to the first target probe URL. Then, the DNS server sends a DNS response packet to the terminal device, carrying the resolved first IP address. Accordingly, after receiving the DNS response packet returned by the DNS server, the terminal device can obtain the first IP address corresponding to the first target probe address from it.
[0191] It should be noted that this embodiment of the application uses a domain name as an example to illustrate the detection URL (including the first target detection URL, the second target detection URL, and the native detection URL). In another example, the detection URL may not be a domain name but a direct IP address. In this case, after the terminal device obtains the detection URL, it can directly perform the following operation S1105, that is, there is no need to perform a domain name resolution operation.
[0192] S1105: The terminal device creates a second thread and sends an HTTP request 1 to the first probe website based on the first IP address through the second thread.
[0193] For example, HTTP request 1 is SYN.
[0194] For details on how the terminal device sends an HTTP request 1 to the first probe website based on the first IP address, please refer to [link / reference]. Figure 9 S908 in the embodiment.
[0195] S1106: The terminal device determines whether sending HTTP request 1 has timed out.
[0196] If sending HTTP request 1 times out, return to operation S1101; otherwise, if sending HTTP request 1 does not time out, i.e., HTTP request 1 was successfully sent, proceed to operation S1107.
[0197] S1107: The terminal device receives the HTTP response 1 sent by the first probe website through the second thread.
[0198] S1108: The terminal device sends a confirmation message to the first detection website through the second thread.
[0199] Thus, the terminal device successfully establishes a TCP connection between the first IP address and the first probed website, specifically implemented as follows: Figure 9 Example.
[0200] If a TCP connection is successfully established with the first probe website, proceed to step S1109. If a TCP connection cannot be successfully established with the first probe website, the terminal device can obtain a second target probe URL to establish a TCP connection with the second probe website based on the second target probe URL, thereby testing network connectivity through the second probe website.
[0201] S1109: The terminal device sends a third number of TCP probe packets to the first probe website through the second thread, based on the TCP connection.
[0202] The third quantity can be set according to needs; for example, the third quantity is 20.
[0203] For details on how the terminal device continuously sends TCP probe packets to the first probe website via a second thread and a TCP connection, please refer to [link to relevant documentation]. Figure 9 S909 in the embodiment.
[0204] S1110: The terminal device receives the TCP response packet from the first probe website through the second thread.
[0205] For its specific implementation, please refer to Figure 9 S910 in the embodiment.
[0206] S1111: The terminal device determines the third value based on the reception of the TCP response packet.
[0207] The third value is used to indicate the number of consecutive TCP response packets that have not been received for a particular TCP response, or to indicate how many TCP probe packets have been sent since the last time a particular TCP response packet was received.
[0208] As an example, before determining the third value based on the received TCP response packets, the terminal device can initialize the third value, for example, to 0. Then, during the sending of TCP probe packets, the third value is updated based on the received TCP response packets. If a specific TCP response packet is received in response to the TCP probe packet during the sending process, it indicates that the terminal device can access the internet, and the network is connected, so the third value can be cleared to zero. If no specific TCP response packet is received in response to the TCP probe packet during the sending process, it indicates that the network may be unstable, and the third value is increased, for example, by 1. In this way, the third value can be determined during packet sending so that after the packet is sent, the terminal device can determine its connectivity based on the third value.
[0209] S1112: The terminal device determines the network connectivity based on the third value.
[0210] As an example, the specific implementation of a terminal device determining whether the network is connected based on a third value may include: if the third value is greater than or equal to a threshold, it is determined that the current network is not connected, that is, the terminal device cannot access the Internet, thus determining that data service congestion has occurred; if the third value is less than the threshold, it is determined that the current network is connected, that is, the terminal device can access the Internet, thus determining that no data service congestion has occurred.
[0211] S1113: In the event of network connectivity issues, the terminal device determines whether the current situation is a prepaid card arrears scenario based on the HTTP status code in the non-specific TCP response packet.
[0212] If the network is unavailable, it indicates that the terminal device cannot access the internet, thus confirming a data service blockage. In this case, the terminal device does not immediately trigger the Dorecovery mechanism but further determines whether it is due to prepaid card arrears. To do this, the terminal device can parse the non-specific TCP response packet returned by the first probe website to obtain the HTTP status code and determine whether the current situation is a prepaid card arrears scenario based on the HTTP status code. For example, if the HTTP status code is between 200 and 399 and not an HTTP 204 status code, it can be determined that the current network is a portal network, thus confirming a prepaid card arrears scenario; otherwise, it can be determined that it is not a portal network. For specific implementation details, please refer to [link to relevant documentation]. Figure 9 S912 in the embodiment.
[0213] If the current situation involves a prepaid card arrears, proceed to step S1114; if the current situation does not involve a prepaid card arrears, proceed to step S1115.
[0214] It should be noted that the embodiments in this application are illustrated using the example of network connectivity failure. In another example, if the network is connected, the terminal device does not initiate the Dorecovery mechanism, and when the detection conditions are met, such as when the next detection cycle is reached, the terminal device returns to the operation of S1101 to continue detecting network connectivity.
[0215] S1114: The terminal device does not start the Dorecovery mechanism.
[0216] If the current situation involves a prepaid card in arrears, even if the Dorecovery mechanism is activated, the network cannot be restored. Moreover, the cellular network signal indicator displayed on the terminal device's interface may appear intermittently, causing inconvenience to the user. Therefore, not activating the Dorecovery mechanism on the terminal device can prevent the intermittent appearance of the cellular network signal indicator on the terminal device's interface, thus avoiding inconvenience to the user.
[0217] S1115: The terminal device initiates the Dorecovery mechanism to restore the network.
[0218] If the current situation is not due to prepaid card arrears, it may be caused by a short-term network outage, server-side error, or other reasons. In this case, the terminal device can activate the Dorecovery mechanism to attempt to restore the network in stages through the Dorecovery mechanism.
[0219] In this embodiment, the terminal device can detect network connectivity by analyzing TCP response packets. If the network is not connected, it further determines whether it is a prepaid card arrears scenario. If it is a prepaid card arrears scenario, the Dorecovery mechanism is not triggered; otherwise, if it is not a prepaid card arrears scenario, the Dorecovery mechanism is triggered to restore the network. This can minimize the phenomenon of intermittent cellular network signal identification caused by multiple network restoration attempts in prepaid card arrears scenarios, thereby reducing the inconvenience to users.
[0220] See Figure 12 , Figure 12 This embodiment illustrates the hardware structure of a terminal device, which may include: a processor, an external memory interface, internal memory, a Universal Serial Bus (USB) interface, a charging management module, a power management module, a battery, antenna 1, antenna 2, a mobile communication module, a wireless communication module, a sensor module, buttons, a motor, an indicator, a camera, a display screen, and a SIM card slot, etc. The audio module may include a speaker, a receiver, a microphone, an earphone jack, etc., and the sensor module may include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an accelerometer, a proximity sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0221] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal device. In other embodiments, the terminal device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0222] The processor may include one or more processing units, such as an application processor (AP), a modem (also known as a baseband processor), a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The processor is the central nervous system and command center of the terminal device. The controller generates operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0223] The wireless communication function of the terminal device can be implemented through antenna 1, antenna 2, mobile communication module, wireless communication module, and modem, etc. In some embodiments, antenna 1 of the terminal device is coupled to the mobile communication module, and antenna 2 is coupled to the wireless communication module, enabling the terminal device to communicate with network-side devices and other terminal devices through wireless communication technology.
[0224] In addition, an operating system runs on top of the aforementioned components. Examples include Apple's iOS operating system, Google's Android open-source operating system, and Microsoft's Windows operating system.
[0225] The operating system of a terminal device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application uses the layered architecture Android system as an example to exemplify the hardware and software structure of a terminal device. It should be noted that although this application uses the Android system as an example, its basic principles are equally applicable to terminal devices based on operating systems such as iOS or Windows.
[0226] Figure 13This is a software architecture diagram of a terminal device. The software architecture adopts a layered architecture, dividing the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. Taking the Android system, which runs on an application processing unit (AP), as an example, in some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer (Framework), the Android runtime and system libraries, the Hardware Abstraction Layer (HAL), and the system kernel layer (Kernel).
[0227] The application layer can include a series of application packages. These packages may include apps for camera, gallery, calendar, call, map, WLAN, Bluetooth, music, video, and SMS. The application layer may also include a system UI, which displays the terminal device's interface, such as the signal icon for the SIM card or the call interface. The application framework layer provides application programming interfaces (APIs) and a programming framework for the applications in the application layer. The application framework layer includes predefined functions. For example, it may include a window manager, content provider, view system, phone manager, resource manager, and notification manager. The phone manager provides the terminal device's call functionality, such as managing call status (including connection and disconnection). Figure 13 In Chinese, it is represented by telephony.
[0228] The application framework layer may also include the RIL (Radio Interface Layer). The modem processor can interact with the application framework through the RIL. The processing logic such as judgment, data statistics and analysis involved in the network recovery method provided in this application embodiment can all be implemented by the application framework layer. The TCP / IP protocol stack is only used for data transmission.
[0229] By way of example and not limitation, a modem may include a transport layer, an internet layer, a data link layer, and a physical layer. Each of these layers can be a software module. The modem can interact with the base station via an antenna.
[0230] Figure 14This diagram illustrates a schematic block diagram of a communication device 1400 provided in an embodiment of this application. The communication device 1400 can be a terminal device / network device. This device can be used to implement the methods described in the above method embodiments; for details, please refer to the descriptions in the above method embodiments.
[0231] The communication device 1400 may include one or more processors 1410, which may also be referred to as processing units, and can implement certain control functions. The processor 1410 may be a general-purpose processor or a dedicated processor, such as a baseband processor or a central processing unit. The baseband processor can be used to process communication protocols and communication data, while the central processing unit can be used to control the communication device, execute software programs, and process data from the software programs.
[0232] In an alternative design, the processor 1410 may also store instructions and / or data that can be executed by the processor 1410 to cause the communication device 1400 to perform the methods described in the above method embodiments.
[0233] In another alternative design, the communication device 1400 may include a communication interface 1420 for implementing receiving and transmitting functions. For example, the communication interface 1420 may be a transceiver circuit, interface, interface circuit, or transceiver. The transceiver circuit, interface, interface circuit, or transceiver for implementing receiving and transmitting functions may be separate or integrated. The aforementioned transceiver circuit, interface, interface circuit, or transceiver may be used for reading and writing code / data, or it may be used for transmitting or relaying signals.
[0234] Optionally, the communication device 1400 may include one or more memories 1430, which may store instructions that can be executed on the processor 1410, causing the communication device 1400 to perform the methods described in the above method embodiments. Optionally, the memories 1430 may also store data. Optionally, the processor 1410 may also store instructions and / or data. The processor 1410 and the memories 1430 may be provided separately or integrated together.
[0235] It should be understood that, in one possible design, the steps in the method embodiments provided in this application can be implemented by integrated logic circuits in the processor's hardware or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are not provided here.
[0236] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0237] Some embodiments of this application provide a chip system applied to a terminal device. The chip system includes at least one processor and an interface for receiving instructions and transmitting them to the at least one processor. The at least one processor executes instructions to cause the terminal device to perform the paging message processing method described above. The chip system may be a modem or a system-on-a-chip (SoC) including a modem, and the above method may be implemented by a modem.
[0238] This application also provides a computer program product, which includes computer program code. When the computer program code is run on a computer, it causes the computer to execute the various steps or processes executed by the terminal device / network device in any of the above method embodiments.
[0239] This application also provides a computer-readable storage medium storing program code that, when run on a computer, causes the computer to execute the various steps or processes performed by the terminal device / network device in any of the above method embodiments.
[0240] This application also provides a communication device, including a processor and an interface, the interface being used to send and / or receive signals, causing the processor to execute the various steps or processes executed by the terminal device / network device in any of the above method embodiments.
[0241] The above-described device and method embodiments are completely corresponding, with corresponding modules or units performing corresponding steps. For example, a communication unit or communication interface performs the receiving or sending steps in the method embodiment, while other steps besides sending and receiving can be performed by a processing unit or processor.
[0242] In the embodiments of this application, the terms and English abbreviations are exemplary examples given for ease of description and should not be construed as limiting the application in any way. The embodiments of this application do not preclude the possibility of defining other terms that can achieve the same or similar functions in existing or future agreements.
[0243] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0244] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be based on the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0245] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0246] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0247] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0248] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A network recovery method, characterized in that, Applied to a terminal device that has not enabled or does not have wireless LAN functionality, the method includes: Detect network connectivity; Identify the current network scenario when the network is disconnected; If the network is not in a prepaid card arrears scenario, the network recovery mechanism is triggered to restore the network; if the network is in a prepaid card arrears scenario, the network recovery mechanism is not triggered, wherein the prepaid card arrears scenario refers to the scenario where the network cannot access the Internet due to the network card being in arrears.
2. The method as described in claim 1, characterized in that, The connectivity of the detection network includes: Send a first number of DNS probe packets to the network device to transmit the DNS probe packets to a preset DNS server through the network device. The DNS probe packets include the domain name of the first probe website. During the sending of the DNS probe packet, a DNS response packet is received from the DNS server, the DNS response packet including the address information of the first probed website; Upon obtaining the address information of the first detection website, a TCP connection is established with the first detection website based on the address information of the first detection website; Based on the TCP connection, a second number of TCP probe packets are sent to the first probe website, and TCP response packets are received from the first probe website; Network connectivity is detected based on the DNS response packets returned by the DNS server and the TCP response packets returned by the first probe website.
3. The method as described in claim 2, characterized in that, The step of detecting network connectivity based on the DNS response packet returned by the DNS server and the TCP response packet returned by the first probe website includes: The first value and the second value are initialized. The first value is used to indicate the number of consecutive TCP response packets that have not been received, and the second value is used to indicate the number of consecutive DNS response packets that have not been received. If a TCP response packet is received during the sending of DNS probe packets and TCP probe packets, the first and second values are re-initialized. If no TCP response packet is received, the first value is increased by a preset value; If no DNS response packet or TCP response packet is received, then the first value and the second value are increased by a preset value; After sending DNS probe packets and TCP probe packets, network connectivity is detected based on the first value and the second value.
4. The method as described in claim 3, characterized in that, After sending DNS probe packets and TCP probe packets, the process of detecting network connectivity based on the first and second values includes: If the first value is greater than or equal to the threshold, or the sum of the first value and the second value is greater than or equal to the threshold, then it is determined that the current network is not connected. If the sum of the first value and the second value is less than the threshold, or if the first value is less than the threshold, then the current network connectivity is determined.
5. The method as described in claim 1, characterized in that, The connectivity of the detection network includes: Send a DNS probe packet to the preset DNS server. The DNS probe packet includes the domain name of the first website to be probed. Receive a DNS response packet from the DNS server, the DNS response packet including the address information of the first probed website; Based on the address information of the first detection website, establish a TCP connection with the first detection website; Based on the TCP connection, a third number of TCP probe packets are sent to the first probe website, and a TCP response packet is received from the first probe website; The network connectivity is detected based on the TCP response packets returned by the first probe website.
6. The method according to any one of claims 1-5, characterized in that, The process of identifying the current network scenario when the network is disconnected includes: In the absence of network connectivity, parse the HTTP response code in the non-specific TCP response packet from the first probed website; If the parsed HTTP response code indicates that the current network is a portal network, then the network is determined to be in the prepaid arrears scenario; if the parsed HTTP response code indicates that the current network is not a portal network, then the network is determined not to be in the prepaid arrears scenario.
7. The method as described in claim 6, characterized in that, If the parsed HTTP response code is between 200 and 399 and is not an HTTP 204 status code, it indicates that the current network is a portal network.
8. The method as described in claim 6 or 7, characterized in that, The method further includes: If the current network is a portal network, the target address carried in the non-specific TCP response packet from the first probe website is parsed and stored. The target address is used for the next network connectivity determination.
9. A network recovery method, characterized in that, Applied to network devices, the method includes: During the process of receiving the first number of DNS probe packets sent by the terminal device, when the DNS probe packet in the first number of DNS probe packets is successfully received for the first time, the authentication server authenticates the first successfully received DNS probe packet based on the whitelist, and forwards the first successfully received DNS probe packet to the DNS server if the authentication is successful. For the DNS probe packets other than the first successfully received DNS probe packet in the first number of DNS probe packets, the other DNS probe packets are processed according to the network connectivity status. The other DNS probe packets are used by the terminal device to perform network connectivity detection.
10. A communication device, characterized in that, The communication device includes a processing unit and a transceiver unit, and is used to execute a program or instructions for the method as described in any one of claims 1 to 8, or claim 9.
11. A communication device, characterized in that, The device includes a processor coupled to a memory storing a program or instructions for performing the method as described in any one of claims 1 to 8, or claim 9.
12. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed, the computer performs the method as described in any one of claims 1 to 8, or claim 9.
13. A communication system, characterized in that, Includes the communication device as described in claim 10.
14. A computer program product, characterized in that, Includes a computer program that, when run, causes the method described in any one of claims 1 to 8, or claim 9, to be performed.
