Network connection method and related device
By using virtual public network IP addresses in the connection between the terminal device and the router, maintaining link activity and extending the detection time, the problem of terminal devices automatically disconnecting WIFI is solved, and the stability and reliability of network connections are improved.
Patent Information
- Application Number
- CN202411605651.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2025-02-28
AI Technical Summary
During the connection between the terminal device and the router, the terminal device may automatically disconnect WIFI, resulting in failure to connect to the Internet.
The network link activity of the terminal device is maintained through the virtual public network IP address, extending the detection time, and increasing the keep-alive time of the link. At the same time, the terminal device can obtain the router-related status and configure and troubleshoot the router.
It extends the connection time between the terminal device and the router, reduces the occurrence of automatic disconnection, and improves the stability and reliability of network connections.
Smart Images

Figure CN119545473A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202310647845.9, and the original application date is May 31, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a network connection method and related devices. Background Art
[0003] With the development of Internet technology, Internet access is becoming more and more popular in people's lives. Sometimes multiple terminal devices need to use one account to access the Internet at the same time. For example, in a home network, there are multiple terminal devices, such as mobile phones, computers, and network TVs. These terminal devices are all connected to a router, which is connected to the Internet through one account.
[0004] Mobile phones and other terminal devices can connect to the router by scanning the mini-program code on the router through WeChat, and then connect to the Internet.
[0005] However, during the connection process between the terminal device and the router, the terminal device may automatically disconnect from the WIFI and thus be unable to connect to the Internet. Summary of the invention
[0006] The embodiment of the present application provides a network connection method and related devices, which are applied to the field of terminal technology. When the network connected to the terminal device is disconnected from the Internet, the link activity of the network connected to the terminal device is maintained through a virtual public network IP. The terminal device can continue to detect the connectivity of the router. In this way, the detection time is extended, the link keep-alive time is increased, and the terminal device can obtain the relevant status of the router, configure and troubleshoot the router.
[0007] In a first aspect, an embodiment of the present application provides a network connection method, which is applied to a router. The method includes: the router establishes a first WIFI connection with a terminal device based on a first WIFI SSID and a first WIFI password; the router receives a first domain name resolution request from the terminal device, the first domain name resolution request includes a domain name; in response to the first domain name resolution request, the router sends a first message to the terminal device, the first message includes: a virtual public network IP address; the virtual public network IP address is used to maintain the link activity of the first WIFI connection.
[0008] In this way, the subsequent terminal device can perform detection based on the virtual public IP address, for example, connectivity test, etc. The keep-alive time of the first WIFI link can be extended. The terminal device has time to obtain the relevant status of the router, which is convenient for configuring and troubleshooting the router.
[0009] Optionally, the router sends a second WIFI SSID and a second WIFI password to the terminal device based on the first WIFI connection; the router establishes a second WIFI connection with the terminal device based on the second WIFI SSID and the second WIFI password.
[0010] In this way, the router can provide the terminal device with relevant information of the second WIFI based on the first WIFI, so as to facilitate the terminal device to subsequently establish a second WIFI connection and connect to the Internet.
[0011] Optionally, before establishing the second WIFI connection, the method also includes: the router receives a first connection request from the terminal device, the target address of the first connection request is the virtual public IP address; in response to the first connection request, the router sends a response message to the terminal device; the router receives a confirmation message from the terminal device, the target address of the confirmation message is the virtual public IP address; the router receives a detection message from the terminal device, the detection message is used to detect whether the network of the first WIFI is connected.
[0012] In this way, the router and the terminal device can establish a TCP connection based on the virtual public IP address, thereby increasing the duration of the connectivity test and extending the link activity of the first WIFI.
[0013] Optionally, the method further includes: the router receives a detection message retransmitted by the terminal device.
[0014] In this way, the terminal device retransmits the message, further increasing the duration of the connectivity test and extending the link activity of the first WIFI.
[0015] Optionally, the first domain name resolution request includes: a first private network IP address corresponding to the terminal device; the first private network IP address is used by the router to confirm that the WIFI to which the terminal device is connected is the first WIFI.
[0016] In this way, the router can easily identify and determine the network to which the terminal device is connected, and then confirm the network connection status of the terminal device and whether to return a virtual public IP address.
[0017] Optionally, after establishing the second WIFI connection, the method also includes: the router receives a second domain name resolution request from the terminal device, the second domain name request includes a domain name; in response to the second domain name request, the router sends a second message to the terminal device, the second message includes: a public IP address corresponding to the domain name; the public IP address is used to maintain the link activity of the second WIFI connection.
[0018] In this way, after the terminal device is connected to the second WIFI, the link activity of the second WIFI can be maintained based on the public IP address.
[0019] Optionally, the second domain name resolution request includes: a second private IP address corresponding to the terminal device; the second private IP address is used by the router to confirm that the WIFI to which the terminal device is connected is the second WIFI.
[0020] In this way, the router can easily identify and determine the network to which the terminal device is connected, and then confirm the network connection status of the terminal device and whether to return a public IP address.
[0021] Optionally, the first WIFI connection is a local area network connection.
[0022] Optionally, after establishing the second WIFI connection, the method also includes: the router receives a first data packet from the terminal device, the first data packet is a data packet for accessing the network server through the router; the router sends a second data packet to the terminal device, the second data packet is a response data packet generated when the network server receives the first data packet.
[0023] In this way, the terminal device can perform data exchange through the second WIFI and connect to the Internet.
[0024] Optionally, the first WIFI SSID and the first WIFI password are obtained by a user scanning a target QR code, the target QR code is a QR code of a router, and the first WIFI SSID and the first WIFI password are determined based on attribute parameters of the router.
[0025] In this way, the terminal device can obtain the first WIFI SSID and the first WIFI password from the target QR code, and then connect to the first WIFI, which is convenient and fast.
[0026] Optionally, the target QR code is a mini program code.
[0027] In this way, users can make full use of the convenient attributes of the mini program, making it convenient for ordinary users to connect and configure the router with zero threshold.
[0028] Optionally, the attribute parameters of the router include: a serial number SN of the router, and the first WIFI SSID and the first WIFI password are determined based on the SN.
[0029] In this way, the SN of the router is unique, and the first WIFI SSID and the first WIFI password resolved by the SN are also unique. Therefore, regardless of whether the user knows the WIFI password, the terminal device can use the first WIFI SSID and the first WIFI password to achieve a LAN connection with the router.
[0030] Optionally, after establishing the first WIFI connection, the method also includes: the router receives a first request from the terminal device; in response to the first request, the router sends a third message to the terminal device, the third message includes a symmetric key, and the third message is a message generated by the router after encrypting the second WIFI SSID and the second WIFI password using the symmetric key.
[0031] In this way, the terminal device can obtain the symmetric key supported by the router through the first request and the third message, so that the communication link between the terminal device and the router can be encrypted based on the symmetric key to ensure the security of data transmission.
[0032] Optionally, the symmetric key is an AES symmetric encryption key.
[0033] In this way, encryption and decryption are efficient and time-saving, which can further shorten the interaction time between the terminal device and the router.
[0034] In the second aspect, the embodiment of the present application proposes a network connection method. The method includes: the terminal device establishes a first WIFI connection with a router based on a first WIFI SSID and a first WIFI password; the terminal device sends a first domain name resolution request to the router, and the first domain name resolution request includes a domain name; the terminal device receives a first message from the router, and the first message is a message generated by the router in response to the first domain name resolution request, and the first message includes: a virtual public network IP address; the virtual public network IP address is used to maintain the link activity of the first WIFI connection; the terminal device obtains a second WIFI SSID and a second WIFI password from the router based on the first WIFI connection; the terminal device establishes a second WIFI connection with the router based on the second WIFI SSID and the second WIFI password.
[0035] In this way, the terminal device can perform detection based on the virtual public IP address, for example, connectivity test, etc. The keep-alive time of the first WIFI link can be extended, and the terminal device can obtain the relevant status of the router, configure and troubleshoot the router.
[0036] Optionally, before establishing the second WIFI connection, the method also includes: the terminal device sends a first connection request to the router, and the target address of the first connection request is the virtual public IP address; the terminal device receives a response message from the router, and the response message is a message generated by the router in response to the connection request; after receiving the response message, the terminal device sends a confirmation message to the router, and the target address of the confirmation message is the virtual public IP address; the terminal device sends a detection message to the router, and the detection message is used to detect whether the network of the first WIFI is connected.
[0037] In this way, the terminal device can establish a TCP connection with the router based on the virtual public IP address, thereby increasing the duration of the connectivity test and extending the link activity of the first WIFI.
[0038] Optionally, the method further includes: the terminal device does not receive a message from the router within a first preset time period after sending the detection message; and the terminal device retransmits the detection message to the router.
[0039] In this way, the terminal device retransmits the message, further increasing the duration of the connectivity test and extending the link activity of the first WIFI.
[0040] Optionally, the first domain name resolution request includes: a first private IP address corresponding to the terminal device; the first private IP address is used by the router to confirm the first WIFI to which the terminal device is connected.
[0041] In this way, the router can easily identify and determine the network to which the terminal device is connected, and then confirm the network connection status of the terminal device and whether to return a virtual public IP address.
[0042] Optionally, after establishing the second WIFI connection, the method also includes: the terminal device sends a second domain name resolution request to the router, the second domain name request includes the domain name; the terminal device receives a second message from the router, the second message is a message generated by the router in response to the second domain name resolution request, the second message includes: the public IP address corresponding to the domain name; the public IP address is used to maintain the link activity of the second WIFI connection.
[0043] In this way, after the terminal device is connected to the second WIFI, the link activity of the second WIFI can be maintained based on the public IP address.
[0044] Optionally, after the terminal device receives the second message from the router, the method also includes: the terminal device sends a second connection request to the detection server corresponding to the public IP address; the terminal device receives a response message from the detection server, and the response message is a message generated by the detection server in response to the second connection request.
[0045] In this way, the terminal device can perform a connectivity test based on the public IP address and maintain the connection of the second WIFI.
[0046] Optionally, the second domain name resolution request includes: a second private IP address corresponding to the terminal device; the second private IP address is used by the router to confirm the second WIFI to which the terminal device is connected.
[0047] In this way, the router can easily identify and determine the network to which the terminal device is connected, and then confirm the network connection status of the terminal device and whether to return a public IP address.
[0048] Optionally, the first WIFI connection is a local area network connection.
[0049] Optionally, after establishing the second WIFI connection, the method also includes: the terminal device sends a first data packet to the router based on the second WIFI connection, the first data packet being a data packet for accessing the network server through the router; the terminal device receives a second data packet from the router, the second data packet being a response data packet generated when the network server receives the first data packet.
[0050] In this way, the terminal device can perform data exchange through the second WIFI and connect to the Internet.
[0051] Optionally, before establishing the first WIFI connection, the method also includes: the terminal device receives a first operation of a user scanning a target QR code, where the target QR code is a QR code corresponding to a router; in response to the first operation, the terminal device obtains a first WIFI SSID and a first WIFI password based on the target QR code, where the first WIFI SSID and the first WIFI password are determined based on attribute parameters of the router.
[0052] In this way, the terminal device can obtain the first WIFI SSID and the first WIFI password from the target QR code, and then connect to the first WIFI, which is convenient and fast.
[0053] Optionally, the target QR code is a mini program code.
[0054] In this way, users can make full use of the convenient attributes of the mini program, making it convenient for ordinary users to connect and configure the router with zero threshold.
[0055] Optionally, the attribute parameters of the router include: a serial number SN of the router, and the first WIFI SSID and the first WIFI password are determined based on the SN.
[0056] In this way, the SN of the router is unique, and the first WIFI SSID and the first WIFI password resolved by the SN are also unique. Therefore, regardless of whether the user knows the WIFI password, the terminal device can use the first WIFI SSID and the first WIFI password to achieve a LAN connection with the router.
[0057] Optionally, after establishing the first WIFI connection, the method also includes: the terminal device sends a first request to the router; the terminal device receives a third message from the router, the third message includes a symmetric key, the third message is a message generated by the router in response to the first request, and the third message is a message generated by the router after encrypting the second WIFI SSID and the second WIFI password using the symmetric key.
[0058] In this way, the terminal device can obtain the symmetric key supported by the router through the first request and the third message, so that the communication link between the terminal device and the router can be encrypted based on the symmetric key to ensure the security of data transmission.
[0059] Optionally, the symmetric key is an AES symmetric encryption key.
[0060] In this way, encryption and decryption are efficient and time-saving, which can further shorten the interaction time between the terminal device and the router.
[0061] In a third aspect, an embodiment of the present application provides a router, comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the router executes the method of the first aspect.
[0062] In a fourth aspect, an embodiment of the present application provides a terminal device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc.
[0063] The terminal device comprises: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method as in the second aspect.
[0064] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method of the first aspect or the second aspect is implemented.
[0065] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect or the second aspect.
[0066] In a seventh aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute a method such as the first aspect or the second aspect.
[0067] It should be understood that the second to seventh aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0069] Figure 2 A schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0070] Figure 3 A flowchart of a network connection method provided in an embodiment of the present application;
[0071] Figure 4 A schematic diagram of the flow of interaction between a terminal device and a router when connecting to a network in a possible design;
[0072] Figure 5 A flowchart of a network connection method provided in an embodiment of the present application;
[0073] Figure 6 A schematic diagram of an interface for an Internet access method of a terminal device provided in an embodiment of the present application;
[0074] Fig. 7A A schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0075] Figure 7B A schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0076] Figure 8 A schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0077] Fig. 9 A schematic diagram of a flow chart of a router configuration method for a terminal device provided in an embodiment of the present application;
[0078] Fig.10 A flowchart of a network connectivity testing method provided in an embodiment of the present application;
[0079] Fig.11 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] To facilitate understanding of the embodiments of the present application, some terms involved in the present application are first briefly explained.
[0081] 1. Domain name: It is the name of a computer or computer group on the Internet, which is a string of names separated by dots. Domain name is used to locate the computer during data transmission (sometimes also refers to the geographical location).
[0082] 2. Domain name server (DNS): It is a server that converts domain names and their corresponding IP addresses. The domain name server stores a table that maps domain names and IP addresses to resolve domain names in messages.
[0083] 3. Public network: refers to the Internet. The public network can also be called wide area network, extranet, etc.
[0084] 4. Private network: refers to the local Internet created under a router or switch. Private network can also be called intranet or local area network.
[0085] 5. Public IP address: It is the IP address used in the public network.
[0086] It is understandable that a public IP is an independent identity on the Internet that can directly access other IPs and can also be directly accessed by other IPs. Through a public IP, other terminal devices on the Internet can be directly found and can also be found by other terminal devices.
[0087] 6. Private IP address: It is the IP address used in the local area network.
[0088] It is understandable that a private IP can directly access other IPs in the public network, but cannot be directly accessed by other IPs in the public network.
[0089] The private IP is in the LAN. When the terminal device in the LAN accesses the Internet, it needs to be converted into a public IP (i.e., the gateway IP of the LAN). For other terminal devices on the public network, no matter which device in the LAN accesses it, the other party's IP obtained is the gateway IP of the LAN, and it is impossible to confirm which specific device in the LAN is accessing it.
[0090] 7. Other terms
[0091] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0092] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0093] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0094] 8. Terminal equipment
[0095] The terminal device of the embodiment of the present application may also be any form of electronic device. For example, the electronic device may include a handheld device with communication function, a vehicle-mounted device, etc. For example, some electronic devices are: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (public land mobile The embodiments of the present application do not limit this.
[0096] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.
[0097] In addition, in the embodiments of the present application, the electronic device can also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.
[0098] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0099] In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0100] For example, Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario includes: a terminal device 101 and a router 102 .
[0101] The terminal device 101 can scan the mini-program code on the router 102 to open the mini-program page, and connect to the wireless fidelity (WIFI) of the router and configure the router based on the user operation on the mini-program page. Mini-programs within applications.
[0102] For example, Figure 2 A schematic diagram of an interface of a terminal device provided in an embodiment of the present application.
[0103] Open WeChat on your terminal device When you use the Scan function of the application and point the camera in the terminal device at the mini program code on the router body, the terminal device can display the following Figure 2 The interface shown in a in , which may include: mini program code.
[0104] After the terminal device scans the mini program code on the router body, the terminal device can pull up the mini program page corresponding to the mini program code and display the following information: Figure 2 The interface shown in b in the figure. The interface may be the homepage of the mini program, and the interface is used to indicate that the user has opened the mini program. The interface may include one or more of the following: a text message for indicating that the user is welcome to join the XX-scan connection system, a control for exiting the mini program, or a control for forwarding the mini program, etc.
[0105] The text message for indicating that the user is welcome to join the one-scan-to-connect system can be displayed as: Welcome to join the XX one-scan-to-connect system. One-scan-to-connect (or the preset function) can be understood as when the user uses the terminal device to scan the mini program code, the terminal device can be connected to the router WIFI.
[0106] The terminal device can be Figure 2 After staying in the interface shown in b for 2 seconds, it will automatically jump to Figure 2 The interface shown in c in Figure 1 is as follows. Figure 2 The interface shown in c in FIG. 1 is used to indicate that the routing information is being synchronized. The interface may include one or more of the following: text information indicating that the routing information is being synchronized, a progress bar indicating the synchronization status of the routing information, or a graphic icon indicating that the terminal device and the router are synchronizing the routing information.
[0107] After the terminal device obtains the routing information from the router, the terminal device can Figure 2 The interface shown in c in the figure switches to Figure 2 The interface shown in d. Figure 2 The interface shown in d in the figure is used to indicate that the terminal device has obtained the routing information. The interface may include one or more of the following: an identifier 201 for indicating that the device is connected to the router WIFI, text information for indicating that the routing information has been synchronized, a text identifier for indicating that the terminal device and the router have completed information synchronization, a text identifier for indicating that the router WIFI is connected in the second step, or a graphic representation for indicating that the terminal device and the router have completed routing information synchronization.
[0108] The identifier 201 is used to indicate that the terminal device has been connected to the first WIFI of the router. The specific description of the first WIFI can be found in the following Figure 3 The corresponding embodiments.
[0109] In a possible implementation, the logo 201 may also be displayed in Figure 2 The interface shown in c can be understood as the terminal device being connected to the first WIFI of the router during the process of synchronizing the routing information.
[0110] Typically, the time for a terminal device to synchronize routing information can be 6 seconds or so, that is, the terminal device is Figure 2 The interface shown in c in the figure switches to Figure 2 The duration of the interface shown in d may be 6 seconds, etc.
[0111] Further, when the terminal device determines that the router has been configured based on the routing information, the terminal device can Figure 2 The interface shown in d in the figure switches to Figure 2 In the interface shown in e, the Figure 2 The interface shown in e in the figure is used to indicate that the terminal device is connecting to the router WIFI. The terminal device can display the following after connecting to the router WIFI: Figure 2 The interface shown in f in the figure is used to indicate that the terminal device has been connected to the router WIFI.
[0112] Combine the following Figure 3 right Figure 2 The interaction between the terminal device and the router during the network connection process shown is explained.
[0113] For example, Figure 3 A schematic diagram of a network connection method provided in an embodiment of the present application. Figure 3 As shown, the network connection methods include:
[0114] S301, the terminal device receives the operation of the user scanning the mini-program code on the router body.
[0115] The body of the router may be affixed with a mini-program code, which may be generated by the mini-program uniform resource locator (URL) and the router serial number (SN), so the terminal device may obtain the mini-program URL and the router SN by scanning the mini-program code.
[0116] It is understandable that the router SN is unique, so the mini-program code is also unique, that is, one router can correspond to one mini-program code. The WIFI carried by the mini-program code can be non-hidden, that is, the user can search for the WIFI corresponding to the router through the terminal device. If the WIFI carried by the mini-program is hidden, the terminal device cannot successfully connect to the router WIFI.
[0117] S302: In response to the user scanning the mini-program code on the router body, the terminal device obtains the mini-program URL and the router SN from the mini-program code.
[0118] S303: The terminal device uses the mini-program URL to pull the mini-program page from the server.
[0119] The server can be understood as WeChat Application public platform, used for WeChat in terminal devices The application provides a mini-program page. For example, the terminal device may send a request to the server for obtaining the mini-program page, which may include the mini-program URL, and the server may return the pre-stored mini-program page to the terminal device, so that the terminal device can pull up the mini-program page from the server according to the mini-program URL parsed in the mini-program code.
[0120] S304: The server returns page information corresponding to the mini-program to the terminal device.
[0121] Among them, the page information corresponding to the mini program may include: page information corresponding to any interface in the mini program described in the embodiments of the present application, such as page information corresponding to the homepage of the mini program.
[0122] Exemplarily, after receiving the page information corresponding to the mini-program, the terminal device may perform rendering and other operations according to the page information, so that the terminal device can display different interface contents in the mini-program.
[0123] S305. The terminal device displays the homepage of the mini-program and calculates the first WIFI SSID and the first WIFI password using the SN.
[0124] The homepage of the mini program can be Figure 2 The interface shown in b.
[0125] The first WIFI may be the initial WIFI of the router or called a fixed WIFI. The first WIFI SSID and the first WIFI password are both obtained based on SN resolution, so the first WIFI SSID and the first WIFI password are also unique.
[0126] It can be understood that the first WIFI SSID and the first WIFI password are determined based on the attribute parameter SN of the router, so the user is not allowed to modify the first WIFI SSID and the first WIFI password at will.
[0127] S306: The terminal device sends a request for connecting to the first WIFI of the router to the router.
[0128] The request for connecting to the first WIFI of the router may include: a first WIFI SSID and a first WIFI password.
[0129] S307: The router returns a message indicating that the first WIFI connection is successful to the terminal device.
[0130] It is understandable that, since the first WIFI SSID and the first WIFI password are fixed, the terminal device can use the first WIFI to access the LAN of the router, and the first WIFI SSID and the first WIFI can serve as a bridge to achieve data interaction between the terminal device and the router. In this scenario, the router has been set up with security in the firewall so that the terminal device and the router can communicate in the LAN, but cannot connect to the Internet.
[0131] After S307, the terminal device may send a request to the router for obtaining an IP address, and a bridge in the router, such as br2, may allocate a first IP address to the terminal device. When the terminal device sends a message to the router based on the first IP address and the gateway IP address corresponding to br2, br2 may forward the message; further, the forward checkpoint in the firewall may intercept the message reported by br2 to prevent the terminal device from accessing the Internet through the first WIFI connection. The gateway IP address corresponding to br2 may be set by default in the terminal device.
[0132] S308: The terminal device sends a request for obtaining routing information to the router.
[0133] The routing information may be information obtained from the router, and the routing information may include one or more of the following: the second WIFI SSID, the second WIFI password, the gateway address, the Internet access status, or information indicating whether the router wizard configuration is completed in the router.
[0134] The second WIFI can be understood as the real WIFI of the router or the modifiable WIFI. The second WIFI SSID can be the WIFI SSID obtained by the user after modifying the first WIFI SSID or can also be the first WIFI SSID. For example, under normal circumstances, the user can modify the second WIFI SSID to a name that is easy to identify, and the second WIFI SSID is the same as the first WIFI SSID; or the user can not modify the first WIFI SSID, and the second WIFI SSID is the same as the first WIFI SSID. The second WIFI password can be set according to the user's habits.
[0135] The Internet access status may include: network connected, network disconnected, etc. The router wizard configuration may be understood as setting the Internet access mode of the router, so that the router can directly connect to the router to access the Internet after scanning the mini program code.
[0136] It is understandable that, when the terminal device has not configured the router, the routing information may not include: the second WIFI SSID and the second WIFI password, and the information for indicating whether the router wizard configuration is completed may be an incomplete router wizard configuration.
[0137] In some embodiments, the terminal device sends a UDP message to the router to obtain routing information.
[0138] S309: The router returns routing information to the terminal device.
[0139] Suitably, after the terminal device receives the routing information returned by the router, the terminal device can display the following information: Figure 2 Further, the terminal device can use the second WIFI SSID and the second WIFI password in the routing information to connect to the router WIFI, for example, by executing the step shown in S310.
[0140] In a possible implementation, when the terminal device determines that the user has performed the wizard configuration based on the information in the routing information indicating whether the router wizard configuration is completed, the terminal device can connect to the router WIFI based on the second WIFI SSID and the second WIFI password, for example, executing the steps shown in S310.
[0141] S310: The terminal device sends a request for connecting to a second WIFI of the router to the router. The request for connecting to the second WIFI of the router may include: a second WIFI SSID and a second WIFI password.
[0142] Adaptively, the router returns a message to the terminal device indicating that the second WIFI connection is successful. When the terminal device receives the message indicating that the second WIFI connection is successful, the terminal device can determine that it has been successfully connected to the router WIFI.
[0143] In this way, the terminal device can quickly connect to the router WIFI by scanning the small program code on the router body, reducing a series of complex operations such as searching WIFI and entering WIFI passwords.
[0144] After S310, the terminal device can send a request to the router for obtaining an IP address, and br0 in the router can allocate a second IP address to the terminal device. When the terminal device sends a message to the router based on the second IP address and the gateway IP address corresponding to br0, br0 can forward the message; further, the forward checkpoint in the firewall can forward the message reported by br2 and forward it to the network server, so that the terminal device can connect to the Internet through the second WIFI.
[0145] Exemplarily, based on the second WIFI connection, the terminal device sends a first data packet to the router, and the router can send the first data packet to the network server; adapted, the network server can respond to the received first data packet and generate a second data packet corresponding to the first data packet, and then the network data packet can return the second data packet to the terminal device through the router, so that the terminal device can access the Internet through the second WIFI connection. It can be understood that the first data packet is a data packet that accesses the network server through the router, and the second data packet is a response data packet generated when the network server receives the first data packet.
[0146] In a possible implementation, the terminal device may close the first WIFI connection after establishing the second WIFI connection. For example, the terminal device sends a request to the router to close the first WIFI connection, and the router returns a message to the terminal device indicating that the first WIFI connection is successfully closed. Alternatively, the terminal device may close the first WIFI connection after acquiring the routing information, and then establish a second WIFI connection with the router.
[0147] Compared to storing the router's WIFI SSID and WIFI password in the cloud, the router connection method described in the embodiment of the present application can use the SN in the mini-program code to obtain the first WIFI SSID and the first WIFI password, without the need for cloud participation, thus saving resource consumption.
[0148] Figure 3 In the process shown, the terminal device can first establish a local area network connection with the router by directly scanning the target QR code preset in the router, and then automatically obtain the WIFI connection information that can access the Internet through the local area network connection, and then establish a WIFI connection that can access the Internet through the router. The user only needs to scan the target QR code preset in the router, and the user does not need to actively enter the WIFI password and other information to achieve automatic WIFI connection, which brings a better connection experience to the user.
[0149] The terminal device first establishes a local area network connection with the router through the first WIFI SSID and the first WIFI password parsed from the target QR code, thereby initially establishing a connection with the router. After the connection is established, the terminal device can obtain WIFI connection information that can access the Internet from the router through the local area network, such as the second WIFI SSID and the second WIFI password. Then, after connecting to the router using the WIFI connection information that can access the Internet, the terminal device can connect to the network server through the router to access the Internet.
[0150] Among them, since the first WIFI SSID and the first WIFI password are parameters generated based on the attribute parameters of the router, the second WIFI SSID and the second WIFI password are parameters for connecting to the router and accessing the Internet. Figure 3 The process shown can establish a local area network connection between the terminal device and the router through the first WIFI, and obtain WIFI connection information that can access the Internet, such as the second WIFI SSID and the second WIFI password, when the LAN connection is established, thereby reducing the trouble caused by the user remembering the WIFI password.
[0151] However, during the connection process between the terminal device and the router, the terminal device may automatically disconnect the WIFI after connecting to the router at S307, and cannot connect to the second WIFI and the Internet.
[0152] It is understandable that due to the restrictions of the security policies in the terminal devices, the mini-programs in the third-party applications of the terminal devices cannot obtain the system permissions of the terminal devices, and thus in some scenarios, they cannot connect to the router WIFI.
[0153] For example, Figure 4 The following is a flow chart of the interaction between the terminal device and the router during network connection in a possible design. Figure 4 As shown, the interaction process includes:
[0154] S401. The terminal device scans the applet code on the router body to trigger the applet to start.
[0155] S402: The applet of the terminal device sends a message to the connectivity service for instructing to make a WIFI connection.
[0156] The connection manager is used to perform network validity detection (network monitor), network scoring and selection (for example, network factory, network agent, network agent information, etc.) networkg factory, network agent, networkagentInfo), configuration parameters (network port, routing, DNS, etc.), and provide a network application interface (connectivity manager).
[0157] The network validity detection can be a network monitor.
[0158] S403: In response to the message for instructing to establish a WIFI connection, the connection manager establishes a WIFI connection with the router.
[0159] S404: When the connection is successful, the router sends the private network IP address to the connection manager.
[0160] For example, Figure 3 Taking the process shown as an example, when the terminal device is connected to the first WIFI, the router sends the private network IP address to the connection manager.
[0161] S405: The connection manager sends a domain name resolution request to the router to detect whether the router is connected to the Internet.
[0162] The domain name resolution request includes the domain name preset by the terminal device. The domain name resolution request is used to obtain the public IP address.
[0163] For example, Figure 3 Taking the process shown as an example, after S307, the terminal device executes S405.
[0164] S406: The router sends a domain name resolution request to the domain name server.
[0165] A domain name server is a server used to convert domain names and public IP addresses.
[0166] When the router is connected to the Internet, the interaction process includes S407 to S410. When the router is not connected to the Internet, the interaction process includes S411.
[0167] S407: When the router is connected to the Internet, the domain name server sends a response message to the router to reply to the domain name request.
[0168] Adaptively, the router receives a reply message from the domain name server.
[0169] In an embodiment of the present application, the domain name server may pre-store the correspondence between the domain name and the public IP address, or may obtain the correspondence between the domain name and the public IP address from other domain name servers after receiving a domain name resolution request.
[0170] When the router is connected to the Internet, the domain name server receives the domain name resolution request and resolves the domain name according to the domain name in the domain name resolution request. The domain name server sends a reply message to the router to reply to the domain name resolution request.
[0171] The response message includes the public IP address corresponding to the domain name.
[0172] S408: The router sends a response message to the connection manager, wherein the response message includes: the public network IP address corresponding to the domain name preset by the terminal device.
[0173] S409: The connection manager sends a connection request to the detection server according to the public network IP address in the response message to detect the connectivity of the network.
[0174] The IP address of the detection server corresponds to the public IP address corresponding to the domain name preset in the terminal device.
[0175] In the embodiment of the present application, the connection request may be a TCP 443 request. A TCP 443 request may also be referred to as an HTTPs request. The terminal device sends a TCP 443 request to the detection server, including: the terminal device establishes a TCP session connection with the detection server, and after the TCP session connection is established, the terminal device and the detection server encrypt and transmit data through SSL / TLS.
[0176] S410. The detection server sends a response message to the terminal device.
[0177] S411: If the terminal device does not receive a response message within a preset time period after S405, the terminal device disconnects from the router.
[0178] It is understandable that the terminal device connects to the second WIFI of the router after connecting to the first WIFI for a first period of time. Due to various reasons, the time corresponding to the first period is relatively long, and the terminal device has not been connected to the second WIFI for a long time, and then the terminal device may not receive a response message for replying to the domain name resolution request within the preset period of time, causing the terminal device to automatically disconnect from the router.
[0179] The various reasons may be slow network speed, packet loss, unconfigured router, long time required for the terminal device to connect to the network, etc. The embodiment of the present application does not limit the reasons for the long first duration.
[0180] In view of this, the embodiment of the present application provides a network connection method, whereby the router can feedback the virtual public network IP address to the terminal device, and then the terminal device can continue to detect the connectivity of the router. In this way, the detection time is extended, the link keep alive time is increased, and at the same time, the terminal device can obtain the relevant status of the router, configure and troubleshoot the router.
[0181] For example, Figure 5 A flow chart of a network connection method provided by an embodiment of the present application. The terminal device includes a small program and a connection manager (connectivity manager), and the router includes: a domain name resolution relay module (DNS relay) and a business process. Figure 5 As shown, the method includes:
[0182] S501. The terminal device scans the applet code on the router body to trigger the applet to start.
[0183] by Figure 3 Taking the connection process shown as an example, S501 includes the above S301-S305.
[0184] S502: The applet of the terminal device sends a message for instructing to make a first WIFI connection to the connection manager.
[0185] Specifically, the terminal device sends a message for instructing to connect to WIFI to the connection manager through the connection function (connectWifi function). Take the mini program in the application as an example, WeChat The application sends a message for instructing to make a first WIFI connection to the connection manager through the wx.connectWifi function.
[0186] S503: In response to the message for instructing to establish a first WIFI connection, the terminal device sends a request for connecting to the first WIFI to a domain name resolution relay module (DNS relay) in the router.
[0187] by Figure 3 Taking the connection process shown as an example, S503 may be that the connection manager sends a request for connecting to the first WIFI of the router to the domain name resolution relay module in the router.
[0188] S504: When the connection is successful, the domain name resolution relay module sends the first private network IP address to the connection manager.
[0189] The first private network IP address is an address in the network segment corresponding to the first WIFI. The embodiment of the present application does not limit the network segment corresponding to the first WIFI and the first private network IP address.
[0190] Exemplarily, taking the network segment corresponding to the first WIFI as 192.168.1.0 to 192.168.1.31 as an example, the first private network IP address may be 192.168.1.2.
[0191] by Figure 3 Taking the connection process shown as an example, S504 may be that the domain name resolution relay module returns a message indicating that the first WIFI connection is successful to the connection manager, and the message includes the first private network IP address.
[0192] S505: The terminal device sends a first domain name resolution request to the domain name resolution relay module of the router to detect whether the router is connected to the Internet.
[0193] The first domain name resolution request includes a domain name preset in the terminal device and a first private network IP address. The first domain name resolution request is used to obtain a public network IP address.
[0194] In the embodiment of the present application, the preset domain name can be the domain name corresponding to the setting interface of the router, or it can be the domain name corresponding to any web page. The embodiment of the present application does not specifically limit the preset domain name.
[0195] by Figure 3 Taking the connection process shown as an example, the terminal device can execute S505 and S308 simultaneously, the terminal device can execute S505 first and then S308, or the terminal device can execute S308 first and then S505. The embodiment of the present application does not limit the order of S505 and S308.
[0196] S506: After receiving the first domain name resolution request, the router generates a virtual public IP address and sends the virtual public IP address to the connection manager.
[0197] It is understandable that the router can confirm the network to which the terminal device is connected based on the private IP address in the domain name resolution request. When the network to which the terminal device is connected cannot be connected to the Internet, the steps performed by the terminal device and the router can refer to S507-S511 below. When the network to which the terminal device is connected can be connected to the Internet, the steps performed by the terminal device and the router can refer to S512-S518 below.
[0198] For example, Figure 3 Taking the network connection process shown as an example, when the terminal device is connected to the first WIFI, since the first WIFI cannot be connected to the Internet, the terminal device and the router execute the following S507-S511.
[0199] S507: The connection manager sends a connection request according to the virtual public network IP address to detect network connectivity.
[0200] If the network connectivity detection is performed through the TCP protocol, the connection manager sends a TCP synchronization message to the server. The synchronization message includes: synchronization bit SYN, source address and target IP address. The synchronization bit SYN is set to 1, the source address is the private network IP address of the terminal device, and the target IP address is the virtual public network IP address.
[0201] S508: The service process module in the router sends a response message to the connection manager, where the response message is used to confirm that the connection request has been received.
[0202] If the network connectivity detection is performed through the TCP protocol, the response message is a TCP confirmation message. The message includes: synchronization bit SYN, confirmation bit ACK, source address and destination IP address. The synchronization bit SYN and confirmation bit ACK are both set to 1, the source address is the virtual public IP address, and the destination IP address is the private IP address of the terminal device.
[0203] S509: After receiving the response message, the connection manager sends a confirmation message to the router, which is used to indicate that the connection has been established.
[0204] If the network connectivity detection is performed through the TCP protocol, the confirmation message is a TCP confirmation message. The message includes: confirmation bit ACK, source address and destination IP address. The confirmation bit ACK is set to 1, the source address is the private network IP address of the terminal device, and the destination IP address is the virtual public network IP address. The synchronization bit SYN and the confirmation bit ACK are both set to 1. The terminal device is in the connection established state.
[0205] In some embodiments, taking a TCP session connection as an example, S507 - S509 correspond to a three-way handshake process in a TCP session connection.
[0206] S510: After receiving the confirmation message, the router deletes the confirmation message.
[0207] Adaptively, the router is in synchronous receiving state.
[0208] The router deletes the confirmation message through the drop function.
[0209] Exemplarily, taking a TCP session connection as an example, the router deletes the confirmation message, which can be understood as the router releasing the TCP session connection. The router can release the TCP session connection through a firewall setting. Alternatively, it can also be understood as the router blocking the confirmation message.
[0210] S511. The connection manager sends a detection message to the router.
[0211] The detection message is used to detect whether the router is connected. The detection message includes: source address and destination IP address. The source address is the private IP address of the terminal device, and the destination address is the virtual public IP address.
[0212] It is understandable that since the router deletes the confirmation message, the router will not reply to the probe message.
[0213] If no message for replying the detection message is received within the first preset time period after S511, the connection manager resends the detection message to the router.
[0214] The first preset time length may be 1 second or 2 seconds. The embodiment of the present application does not limit the specific value of the first preset time length.
[0215] If no message for replying the detection message is received within the second preset time after S511, the connection manager confirms that the connection with the router is disconnected and disconnects the connection with the router. The second preset time is greater than the first preset time.
[0216] The second preset time length may be 3 seconds or 5 seconds. The embodiment of the present application does not limit the specific value of the second preset time length.
[0217] If the terminal device receives the routing information returned by the router, the terminal device disconnects from the first WIFI and starts to connect to the second WIFI.
[0218] It is understandable that if the terminal device disconnects from the first WIFI, the connectivity of the terminal device to the first WIFI is automatically terminated. When the terminal device connects to the second WIFI, the terminal device starts to perform connectivity test on the second WIFI.
[0219] When the terminal device is connected to the second WIFI, since the second WIFI can be connected to the Internet, the terminal device and the router execute the corresponding steps in S512-S518 below.
[0220] S512: The applet of the terminal device sends a message for instructing to make a second WIFI connection to the connection manager.
[0221] Specifically, the terminal device sends a message for instructing to connect to WIFI to the connection manager through the connection function (connectWifi function). Take the mini program in the application as an example, WeChat The application sends a message for instructing to make a second WIFI connection to the connection manager through the wx.connectWifi function.
[0222] S513: In response to the message for instructing to connect to the second WIFI, the terminal device sends a request for connecting to the second WIFI to a domain name resolution relay module (DNS relay) in the router.
[0223] S514: When the second WIFI connection is successful, the domain name resolution relay module sends the second private network IP address to the connection manager.
[0224] The second private network IP address is an address in the network segment corresponding to the second WIFI. The embodiment of the present application does not limit the network segment corresponding to the second WIFI and the second private network IP address.
[0225] Exemplarily, taking the network segment corresponding to the second WIFI as 192.168.1.31 to 192.168.1.63 as an example, the second private network IP address may be 192.168.1.32.
[0226] by Figure 3 Taking the connection process shown as an example, S514 may be that the domain name resolution relay module returns a message indicating that the second WIFI connection is successful to the connection manager, and the message includes the second private network IP address.
[0227] S515. The terminal device sends a second domain name resolution request to the domain name resolution relay module of the router to detect whether the router is connected to the Internet.
[0228] The second domain name resolution request includes a domain name preset in the terminal device and a second private network IP address. The second domain name resolution request is used to obtain a public network IP address.
[0229] In the embodiment of the present application, the preset domain name can be the domain name corresponding to the setting interface of the router, or it can be the domain name corresponding to any web page. The embodiment of the present application does not specifically limit the preset domain name.
[0230] S516. After receiving the second domain name resolution request, the router obtains a public IP address from the domain name server.
[0231] S517: The router sends the public IP address to the connection manager.
[0232] S518: The connection manager sends a connection request to the detection server according to the public network IP address to detect the connectivity of the network.
[0233] The IP address of the detection server corresponds to the public IP address.
[0234] The connection request may be a TCP 443 request. The terminal device sends a TCP 443 request to the detection server, which includes: the terminal device establishes a TCP session connection with the detection server, and after the TCP session connection is established, the terminal device and the detection server transmit data through SSL / TLS encryption.
[0235] Compared to Figure 4 The process shown, Figure 5 In the process shown, the router feeds back a fake IP address to the terminal device and interacts with the terminal device based on the fake IP address to establish a TCP session connection. The terminal device enters a connection established state, thereby extending the time for the terminal device to detect the first WIFI, increasing the link keep-alive time, reducing the situation where the terminal device automatically disconnects from the network and cannot obtain routing information, thereby reducing the situation where the terminal device cannot connect to the second WIFI and cannot connect to the Internet.
[0236] Based on the above embodiment, during the network connection process, the routing information further includes: information for indicating whether the router wizard configuration is completed.
[0237] The router wizard configuration can be understood as setting the router's Internet access method, so that the router can directly connect to the router to access the Internet after scanning the mini-program code.
[0238] It is understandable that, when the terminal device has not configured the router, the routing information may not include: the second WIFI SSID and the second WIFI password, and the information for indicating whether the router wizard configuration is completed may be an incomplete router wizard configuration.
[0239] After the above S309, when the terminal device determines that the user has performed the wizard configuration based on the information in the routing information used to indicate whether the router wizard configuration is completed, the terminal device can connect to the second WIFI of the router based on the second gateway address, the second WIFI SSID and the second WIFI password, for example, executing the steps shown in S310.
[0240] Alternatively, when the terminal device determines that the user has not performed wizard configuration based on the information in the routing information indicating whether the router wizard configuration is completed, the terminal device may display the following information: Figure 6 The interface shown detects the Internet access mode. The interface includes: a text mark for indicating that the terminal device and the router have completed information synchronization, a text mark for indicating that the Internet access configuration is performed in the second step, and a text mark for indicating that the settings are completed in the third step.
[0241] The terminal device can access the Internet through DHCP or PPPOE, and after completing the router configuration, execute the steps shown in S311.
[0242] When the terminal device detects that the Internet access method is DHCP, the terminal device can Figure 6 The interface shown switches to Fig. 7A The interface includes: an indicator for indicating the Internet access status, a text box 1001 for setting the WIFI name, a text box 1002 for setting the WIFI password, a control for downloading the Smart Space APP, a control for agreeing to the privacy statement, a control for agreeing to join the user experience improvement plan, a control for agreeing to automatically upgrade the mini-program, or a complete configuration control 1003, etc.
[0243] The words "Network connected" may be displayed around the logo indicating the Internet access status; the words "I have read and agreed to the End User License Agreement and are aware of the statement about the smart router and privacy" may be displayed around the control for agreeing to the privacy statement. The smart router is the router described in the embodiment of the present application; the words "Go to download" may be displayed around the control for downloading the Smart Space APP; the words "Automatically upgrade the device's applications and services to provide a better user experience (3:00-5:00 am)" may be displayed around the control for agreeing to automatically upgrade the mini-program.
[0244] The first WIFI service set identifier (SSID) may be displayed in text box 1001 by default, and the password may not be displayed in text box 1002, and only the words "Please enter password" may be displayed to prompt the user to enter the second WIFI password. For example, mingcheng1234 may be displayed in text box 1001. Alternatively, the first WIFI SSID may not be displayed in text box 1001. In this scenario, the words "Please enter WIFI name" may be displayed in text box 1001 to prompt the user to enter the second WIFI SSID. Fig. 7A The WIFI SSID is not shown in the interface shown. The WIFI SSID is the name of the wireless signal sent by the router, which can also be called the WIFI name.
[0245] When the terminal device receives the operation of the user inputting the second WIFI SSID in the text box 1001, the text box 1001 displays the second WIFI SSID input by the user; when the terminal device receives the operation of the user inputting the second WIFI password in the text box 1002, the text box 1002 displays the second WIFI password input by the user. In some embodiments, the terminal device can use "*" to hide the second WIFI password input by the user.
[0246] When the terminal device receives the user's trigger operation for completing the configuration control 1003, the terminal device sends corresponding configuration information to the router to complete the configuration of the router.
[0247] When the terminal device detects that the Internet access method is PPPOE, the terminal device can Figure 6 The interface shown switches to Figure 7B The interface includes: a text box 1004 for indicating input of a broadband account, or a text box 1005 for indicating input of a broadband password. Other contents displayed in the interface can be Fig. 7A The interface shown is similar and will not be described again here.
[0248] The words “Please enter the broadband account number” may be displayed in the text box 1004 to prompt the user to enter the broadband account number provided by the operator when the user applies for PPPOE Internet access; the words “Please enter the broadband password” may be displayed in the text box 1005 to prompt the user to enter the broadband password provided by the operator when the user applies for PPPOE Internet access, and PPPOE Internet access can only be achieved when the broadband account number and broadband password are entered correctly.
[0249] When the terminal device receives the operation of the user inputting a broadband account in text box 1004, text box 1004 displays the broadband account input by the user; when the terminal device receives the operation of the user inputting a broadband password in text box 1005, text box 1005 displays the broadband password input by the user; when the terminal device receives the operation of the user inputting a second WIFI SSID in text box 1006, text box 1006 displays the second WIFI SSID input by the user; when the terminal device receives the operation of the user inputting a second WIFI password in text box 1007, text box 1007 displays the second WIFI password input by the user. In some embodiments, the terminal device can use "*" to hide the second WIFI password input by the user.
[0250] When the terminal device receives the user's trigger operation for completing the configuration control 1008, the terminal device sends corresponding configuration information to the router to complete the configuration of the router.
[0251] In some embodiments, when the terminal device does not receive the routing information returned by the router within a time threshold of sending a request for obtaining routing information, the terminal device may display the following information: Figure 8 Further, when the terminal device detects the user's triggering operation for re-detecting the control 1101, the terminal device can re-execute the steps shown in S802-S810 to re-detect the routing information and enter Figure 8 The interface shown in b.
[0252] Based on the above embodiment, after the terminal device is connected to the second WIFI of the router, it can also configure the router. Fig. 9As shown, the configuration process includes: S901-S904.
[0253] S901. The terminal device sends a request to the router for obtaining an Internet access method.
[0254] Exemplarily, when the terminal device determines that the user has not performed wizard configuration based on the information indicating whether the router wizard configuration is completed in the routing information obtained in S309, the terminal device may display the following information: Fig. 7A The interface shown or Figure 7B The interface shown in S901 is displayed, and the step shown in S901 is executed to send a request for obtaining an Internet access method to the router.
[0255] S902: The router returns the Internet access mode detection result to the terminal device.
[0256] The Internet access detection result includes, but is not limited to: the second WIFI SSID, the second WIFI password, the second gateway address, the Internet access status, or the information indicating whether the router wizard configuration is completed in the router.
[0257] In the embodiment of the present application, the Internet access method can be DHCP Internet access, PPPOE Internet access, or other Internet access methods, which are not limited here. When the Internet access method is PPPOE Internet access, the parameter information also includes a broadband account and a broadband password.
[0258] S903: When the terminal device receives a trigger operation from the user to complete the configuration of the control, the terminal device sends configuration information to the router.
[0259] The configuration information may include: WIFI configuration information, or configuration information corresponding to the Internet access method and WIFI configuration information. Among them, the WIFI configuration information may include: gateway address, second WIFI SSID and second WIFI password. When the Internet access method is PPPOE, the configuration information corresponding to the Internet access method may include: broadband account and broadband password, or when the Internet access method is DHCP, the configuration information may not include configuration information corresponding to DHCP Internet access.
[0260] S904: The router returns the configuration result to the terminal device.
[0261] Further, when the terminal device receives a message returned by the router indicating successful configuration, the terminal device can execute steps S811-S812 based on the set second WIFI SSID and the second WIFI password to connect to the second WIFI of the router.
[0262] Based on this, the terminal device can not only realize one-scan connection, but also configure the router in one-scan connection, so as to simplify the method of user configuration of the router and facilitate ordinary users to configure the router with zero threshold.
[0263] On the basis of the above embodiment, when the terminal device is successfully connected to the first WIFI, the terminal device and the router can establish an encrypted communication link, thus increasing the security of the interaction between the terminal device and the router.
[0264] Exemplarily, the terminal device and the router may be encrypted using a symmetric key.
[0265] Specifically, the terminal device sends a request to the router for obtaining the symmetric key. The router adaptively returns the symmetric key to the terminal device. Subsequently, the communication link between the terminal device and the router can be encrypted based on the symmetric key to ensure the security of data transmission.
[0266] In the embodiment of the present application, the request for obtaining the symmetric key may include: a router SN and signature information, where the signature information is information obtained after the terminal device signs the router SN using a private key.
[0267] The private key of the RSA asymmetric encryption algorithm filled with 1024-bit public key cryptography standards (PKCS) #8 can be preset in the applet of the terminal device, and the public key of the RSA asymmetric encryption algorithm filled with 1024-bit PKCS #8 can be preset in the routing plug-in process of the router.
[0268] Adaptively, after the router receives the router SN and signature information in the request for obtaining the symmetric key, the router can use the public key to decrypt the signature information and compare the decrypted information with the router SN for consistency. After the signature verification is successful, the router can determine that the request for obtaining the symmetric key is a message sent by the applet in the terminal device, and then return the generated symmetric key to the terminal device.
[0269] In the embodiment of the present application, the symmetric key can be encrypted using encryption methods such as data encryption algorithm (DEA), advanced encryption standard (AES) AES, and RSA encryption algorithm.
[0270] In some embodiments, the symmetric key may be an AES symmetric encryption key. In this way, the encryption and decryption efficiency is high and the time consumption is short, which can further shorten the interaction time between the terminal device and the router and reduce the situation where the terminal device automatically disconnects from the router due to detection timeout.
[0271] For example, Fig.10 A flow chart of a network connectivity testing method provided in an embodiment of the present application. Fig.10 As shown, the method includes:
[0272] S1001. The terminal device sends a domain name resolution request to the router.
[0273] Adaptively, the router receives a domain name resolution request from a terminal device.
[0274] The domain name resolution request includes: a domain name and a private network IP address of a terminal device. The embodiments of the present application do not limit the domain name, the IP address of the terminal device, etc.
[0275] It is understandable that the router can determine whether the network to which the terminal device is connected can be connected to the Internet based on the private IP address.
[0276] S1002: When the network corresponding to the private IP address in the domain name resolution request is disconnected from the Internet, the router sends a virtual public IP address to the terminal device.
[0277] S1003. The terminal device performs a network connectivity test based on the virtual public IP address.
[0278] In the embodiment of the present application, the terminal device can perform a network connectivity test through the Internet Control Message Protocol (ICMP). Specifically, the terminal device can perform a network connectivity test through a Tracert command for tracing a route, a tracert command, and a Ping command for checking whether the network is connected.
[0279] The terminal device can also perform a network connectivity test through the transmission control protocol (TCP). Specifically, the terminal device can perform a network connectivity test through the telnet tool, Tcping / tcpping command, etc.
[0280] It is understandable that the target address in the message sent by the terminal device in S1003 for testing network connectivity is a virtual public network IP address. Exemplarily, the connectivity test in S1003 can refer to the above S507-S511. This embodiment of the present application will not be described in detail.
[0281] In this way, the terminal device and the router can enter a connection established state, thereby extending the time for the terminal device to detect WIFI, allowing the terminal device to obtain more network information, making it easier to determine the cause of the network interruption later.
[0282] It is understood that the network connectivity test is performed through a TCP session, and Figure 5 Taking the first WIFI connection process shown as an example, if the first WIFI is not connected to the Internet. When the router receives the first domain name resolution request, the router replies to the terminal device with the virtual public IP address. The terminal device and the router perform a connectivity test based on the virtual public IP address. For details, please refer to S507-S511 above. In this way, the terminal device and the router can enter the connection established state, thereby extending the time for the terminal device to detect the first WIFI, so that the terminal device can obtain more network information, which is convenient for subsequent determination of the cause of the network interruption.
[0283] In addition, the terminal device and the router perform connectivity tests based on the virtual public IP address, which increases the keep-alive time of the link, allowing the terminal device to have more time to obtain routing information, thereby facilitating subsequent connection to the second WIFI and reducing the situation where the terminal device automatically disconnects from the network.
[0284] To test network connectivity via TCP session, and Figure 5 Taking the second WIFI connection process shown as an example, if the connection between the second WIFI and the Internet is interrupted. When the router receives the second domain name resolution request, the router replies to the terminal device with the virtual public IP address. The terminal device and the router perform a connectivity test based on the virtual public IP address. The specific process is similar to S507-S511 above. In this way, the terminal device and the router can enter a connection established state, thereby extending the time for the terminal device to detect the second WIFI, so that the terminal device can obtain more network information, which is convenient for subsequent determination of the cause of the network interruption.
[0285] S1004: When the network corresponding to the private IP address in the domain name resolution request is connected to the Internet, the router sends the public IP address to the terminal device.
[0286] S1005. The terminal device performs a network connectivity test based on the public IP address.
[0287] In the embodiment of the present application, the terminal device can perform a network connectivity test through the Internet Control Message Protocol (ICMP). Specifically, the terminal device can perform a network connectivity test through a Tracert command for tracing a route, a tracert command, and a Ping command for checking whether the network is connected.
[0288] The terminal device can also perform a network connectivity test through the transmission control protocol (TCP). Specifically, the terminal device can perform a network connectivity test through the telnet tool, Tcping / tcpping command, etc.
[0289] It is understandable that the target address in the message sent by the terminal device in S1005 for testing network connectivity is a public network IP address. Exemplarily, the connectivity test in S1005 may refer to the above S518. This embodiment of the present application will not be described in detail.
[0290] It is understandable that the method of the above router replying a virtual public IP address to a terminal device when the network to which the terminal device is connected cannot be connected to the Internet can also be applied to other network connection situations. The use of this method is not specifically limited in the embodiments of the present application.
[0291] The method of the embodiment of the present application has been described above, and the device for executing the above method provided by the embodiment of the present application is described below. Those skilled in the art can understand that the method and the device can be combined and referenced with each other, and the relevant device provided by the embodiment of the present application can execute the steps in the above method.
[0292] The network connection method provided in the embodiment of the present application can be applied to electronic devices with communication functions. The electronic devices include terminal devices, and the specific device form of the terminal devices can refer to the above related descriptions, which will not be repeated here.
[0293] For example, Fig.11 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Fig.11As shown, the terminal device includes: the terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0294] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0295] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0296] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0297] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0298] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0299] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the terminal device. In other embodiments of the present application, the terminal device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0300] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input through a wireless charging coil of a terminal device. While the charging management module 140 is charging the battery 142, it can also power the electronic device through the power management module 141.
[0301] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0302] The terminal device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0303] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0304] The terminal device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0305] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0306] The camera 193 is used to capture static images or videos. In some embodiments, the terminal device may include 1 or N cameras 193, where N is a positive integer greater than 1. The types of the multiple cameras 193 may be different. For example, the camera 193 may include a camera for acquiring color images or a TOF camera, etc. In the embodiment of the present application, the camera may be understood as a camera. The camera includes: an AO camera, a TOF camera, etc. in the embodiment of the present application.
[0307] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0308] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area.
[0309] The terminal device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
[0310] The button 190 includes a power button, a volume button, etc. The button 190 may be a mechanical button. It may also be a touch button. The terminal device may receive the button input and generate a key signal input related to the user settings and function control of the terminal device. The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, message, missed call, notification, etc.
[0311] In addition, on top of the above components, the device also runs an operating system, such as an iOS operating system, an Android operating system, or a Windows operating system, etc. Applications can be installed and run on the operating system.
[0312] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture, etc., which will not be elaborated here.
[0313] An embodiment of the present application provides a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.
[0314] An embodiment of the present application provides a router, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the router executes the above method.
[0315] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0316] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.
[0317] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that is intended to carry or store the required program code in the form of instructions or data structures and can be accessed by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disks and optical disks as used herein include optical disks, laser disks, optical disks, digital versatile disks (DVD), floppy disks and Blu-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.
[0318] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.
[0319] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0320] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. A network connection method, characterized in that: Applied to a router, the method comprises: The router establishes a first WIFI connection with the terminal device based on the first WIFI SSID and the first WIFI password; wherein the first WIFI SSID and the first WIFI password are obtained by the terminal device after receiving a first operation of the user scanning a target QR code of the router; The router receives a first domain name resolution request from the terminal device, where the first domain name resolution request includes a domain name; In response to the first domain name resolution request, the router sends a first message to the terminal device, the first message including: a virtual public network IP address; The router sends the second WIFI SSID and the second WIFI password to the terminal device based on the first WIFI connection; The router establishes a second WIFI connection with the terminal device based on the second WIFI SSID and the second WIFI password.
2. The method according to claim 1, characterized in that Before establishing the second WIFI connection, the method further includes: The router receives a first connection request from the terminal device, wherein the target address of the first connection request is the virtual public IP address; In response to the first connection request, the router sends a response message to the terminal device; The router receives a confirmation message from the terminal device, wherein the destination address of the confirmation message is the virtual public network IP address; The router receives a detection message from the terminal device, where the detection message is used to detect whether the first WIFI network is connected.
3. The method according to claim 2, characterized in that The method further comprises: The router receives the detection message retransmitted by the terminal device.
4. The method according to any one of claims 1 to 3, characterized in that: The first domain name resolution request includes: a first private IP address corresponding to the terminal device; the first private IP address is used by the router to confirm that the WIFI connected to the terminal device is the first WIFI.
5. The method according to any one of claims 1 to 4, characterized in that: After establishing the second WIFI connection, the method further includes: The router receives a second domain name resolution request from the terminal device, where the second domain name request includes a domain name; In response to the second domain name resolution request, the router sends a second message to the terminal device, where the second message includes: a public IP address corresponding to the domain name; the public IP address is used to maintain the link activity of the second WIFI connection.
6. The method according to claim 5, characterized in that The second domain name resolution request includes: a second private IP address corresponding to the terminal device; the second private IP address is used by the router to confirm that the WIFI connected to the terminal device is the second WIFI.
7. The method according to any one of claims 1 to 6, characterized in that: The first WIFI connection is a local area network connection.
8. The method according to any one of claims 1 to 7, characterized in that: After establishing the second WIFI connection, the method further includes: The router receives a first data packet from the terminal device, where the first data packet is a data packet for accessing a network server through the router; The router sends a second data packet to the terminal device, where the second data packet is a response data packet generated when the network server receives the first data packet.
9. The method according to any one of claims 1 to 8, characterized in that: The first WIFI SSID and the first WIFI password are determined based on attribute parameters of the router.
10. The method according to claim 9, characterized in that The target QR code is a mini program code.
11. The method according to any one of claims 1 to 10, characterized in that: The attribute parameters of the router include: a serial number SN of the router, and the first WIFI SSID and the first WIFI password are determined based on the SN.
12. The method according to any one of claims 1 to 11, characterized in that: After establishing the first WIFI connection, the method further includes: The router receives a first request from the terminal device; In response to the first request, the router sends a third message to the terminal device, the third message including a symmetric key, and the third message is a message generated by the router after encrypting the second WIFI SSID and the second WIFI password using the symmetric key.
13. The method according to claim 12, characterized in that The symmetric key is an Advanced Encryption Standard AES symmetric encryption key.
14. A network connection method, characterized in that: Applied to a terminal device, the method comprises: The terminal device receives a first operation of a user scanning a target QR code of a router, and obtains a first WIFI SSID and a first WIFI password; The terminal device establishes a first WIFI connection with the router based on the first WIFI SSID and the first WIFI password; The terminal device sends a first domain name resolution request to the router, where the first domain name resolution request includes a domain name; The terminal device receives a first message from the router, the first message is a message generated by the router in response to the first domain name resolution request, and the first message includes: a virtual public network IP address; The terminal device obtains a second WIFI SSID and a second WIFI password from the router based on the first WIFI connection; The terminal device establishes a second WIFI connection with the router based on the second WIFI SSID and the second WIFI password.
15. The method according to claim 14, characterized in that Before establishing the second WIFI connection, the method further includes: The terminal device sends a first connection request to the router, wherein the target address of the first connection request is the virtual public IP address; The terminal device receives a response message from the router, where the response message is a message generated by the router in response to the first connection request; After receiving the response message, the terminal device sends a confirmation message to the router, wherein the destination address of the confirmation message is the virtual public IP address; The terminal device sends a detection message to the router, where the detection message is used to detect whether the first WIFI network is connected.
16. The method according to claim 15, characterized in that The method further comprises: The terminal device does not receive a message from the router within a first preset time period after sending the detection message; The terminal device retransmits the detection message to the router.
17. The method according to any one of claims 14 to 16, characterized in that: The first domain name resolution request includes: a first private IP address corresponding to the terminal device; the first private IP address is used by the router to confirm the first WIFI to which the terminal device is connected.
18. The method according to any one of claims 14 to 17, characterized in that: After establishing the second WIFI connection, the method further includes: The terminal device sends a second domain name resolution request to the router, where the second domain name request includes a domain name; The terminal device receives a second message from the router, where the second message is a message generated by the router in response to the second domain name resolution request, and the second message includes: a public IP address corresponding to the domain name; and the public IP address is used to maintain the link activity of the second WIFI connection.
19. The method according to claim 18, characterized in that After the terminal device receives the second message from the router, the method further includes: The terminal device sends a second connection request to the detection server corresponding to the public IP address; The terminal device receives a response message from the detection server, where the response message is a message generated by the detection server in response to the second connection request.
20. The method according to claim 18 or 19, characterized in that The second domain name resolution request includes: a second private IP address corresponding to the terminal device; the second private IP address is used by the router to confirm the second WIFI to which the terminal device is connected.
21. The method according to any one of claims 14 to 20, characterized in that: The first WIFI connection is a local area network connection.
22. The method according to any one of claims 14 to 21, characterized in that: After establishing the second WIFI connection, the method further includes: The terminal device sends a first data packet to the router based on the second WIFI connection, where the first data packet is a data packet for accessing a network server through the router; The terminal device receives a second data packet from the router, where the second data packet is a response data packet generated when the network server receives the first data packet.
23. The method according to any one of claims 14 to 22, characterized in that: The first WIFI SSID and the first WIFI password are determined based on attribute parameters of the router.
24. The method according to claim 23, characterized in that The target QR code is a mini program code.
25. The method according to any one of claims 14 to 24, characterized in that: The attribute parameters of the router include: a serial number SN of the router, and the first WIFI SSID and the first WIFI password are determined based on the SN.
26. The method according to any one of claims 14 to 25, characterized in that: After establishing the first WIFI connection, the method further includes: The terminal device sends a first request to the router; The terminal device receives a third message from the router, the third message including a symmetric key, the third message being a message generated by the router in response to the first request, and the third message being a message generated by the router after encrypting the second WIFI SSID and the second WIFI password using the symmetric key.
27. A router, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the router performs the method according to any one of claims 1 to 13.
28. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the terminal device performs the method according to any one of claims 14 to 26.
29. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented, or the method according to any one of claims 14 to 26 is implemented.
30. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables a computer to execute the method according to any one of claims 1 to 13, or implement the method according to any one of claims 14 to 26.