Network connection method and related equipment

By randomly generating IP addresses after implementing DHCP requests in the terminal device and confirming their availability, the problem of failure to allocate IP addresses in network devices is solved, the success rate and speed of network connections are improved, and the cost of manual configuration is reduced.

CN117692432BActive Publication Date: 2024-11-15HONOR DEVICE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310707121.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-14
Publication Date
2024-11-15
Estimated Expiration
2043-06-14

AI Technical Summary

Technical Problem

When a terminal device connects to the network, the device fails to allocate IP addresses through DHCP, causing the device to be unable to access the network. The existing solutions are relatively low in speed and cost.

Method used

After sending a DHCP request to the network device, if the IP address is not received, the IP address is randomly generated by determining the IP address pool of the network device and broadcasting ARP message to confirm whether the address is used. If it is not used, it will be accessed. Network, otherwise it will be generated repeatedly.

Benefits of technology

It improves the success rate and speed of terminal devices accessing the network, reduces the cost of manually configuring static IP addresses, and avoids connection failure caused by unallocated IP addresses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117692432B_ABST
    Figure CN117692432B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a network connection method and related equipment, wherein the method includes: after sending a Dynamic Host Configuration Protocol DHCP request to a network device, if an Internet Protocol IP address required for accessing the network is not received, determining an IP address pool corresponding to the network device, the DHCP request is used to request an IP address required for accessing the network; based on the IP address pool, randomly generating a first IP address; based on the first IP address, accessing the network. By adopting the embodiment of the present application, the problem that a terminal device cannot access the network due to failure to receive an IP address required for accessing the network can be avoided, thereby improving the success rate of the terminal device accessing the network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal and communication technology, and in particular to a network connection method and related equipment. Background Art

[0002] Currently, when a terminal device is connected to a network, there is a problem that the network device fails to allocate an Internet Protocol (IP) address to the terminal device through the Dynamic Host Configuration Protocol (DHCP), resulting in the terminal device being unable to access the network. Summary of the invention

[0003] The embodiments of the present application provide a network connection method and related devices, which can improve the success rate of terminal devices accessing the network.

[0004] In a first aspect, an embodiment of the present application provides a network connection method, the method comprising:

[0005] After sending a Dynamic Host Configuration Protocol DHCP request to the network device, if an Internet Protocol IP address required for accessing the network is not received, determining an IP address pool corresponding to the network device; the DHCP request is used to request the IP address required for accessing the network;

[0006] Based on the IP address pool, a first IP address is randomly generated;

[0007] Based on the first IP address, access the network.

[0008] After implementing the method provided in the first aspect, the problem of the terminal device being unable to access the network due to failure to receive the IP address required for accessing the network can be avoided, thereby improving the success rate of the terminal device accessing the network.

[0009] In combination with the first aspect, in an optional implementation, the method further includes: determining whether the first IP address has been used; if not, executing the step of accessing the network based on the first IP address.

[0010] In this implementation, the terminal device can access the network based on the first IP address after determining that the first IP address is not in use. This avoids the possibility of network access failure due to the first IP address being occupied, thereby improving the success rate of the terminal device accessing the network.

[0011] In combination with the first aspect, in an optional implementation, determining whether the first IP address has been used includes: broadcasting an Address Resolution Protocol ARP message to other terminal devices; if no response message to the ARP message is received, determining that the first IP address is not in use; if a response message to the ARP message is received, determining that the first IP address has been used.

[0012] In this implementation, the terminal device can broadcast an address resolution protocol (ARP) message to inquire about the physical addresses of other terminal devices using the first IP address. If no response message is received to the ARP message, it can determine that the first IP address is not in use, and thus use the first IP address to access the network, thereby improving the success rate of the terminal device accessing the network.

[0013] In combination with the first aspect, in an optional implementation, the method further includes: if it is determined that the first IP address has been used, then executing again the step of randomly generating the first IP address based on the IP address pool.

[0014] In this implementation, when the terminal device determines that the first IP address has been used, it can perform the step of randomly generating the first IP address based on the IP address pool again until it determines that the generated IP address is not in use. This is conducive to the terminal device accessing the network based on the generated unused IP address, thereby improving the success rate of the terminal device accessing the network.

[0015] In combination with the first aspect, in an optional implementation, the method further includes: using the first IP address to test whether the network between the network device and the network is connected; if the network between the network device and the network is connected, it is determined that the network has been successfully accessed.

[0016] In this implementation, the terminal device determines that it has successfully accessed the network, and thus can communicate with the network device.

[0017] In combination with the first aspect, in an optional implementation, determining an Internet Protocol IP address pool corresponding to a network device includes: determining brand information of the network device; and determining an IP address pool corresponding to the network device based on the brand information.

[0018] In this implementation, the terminal device can determine the IP address pool corresponding to the network device based on the brand information of the network device, thereby facilitating the terminal device to randomly generate a first IP address from the IP address pool, and further improving the success rate of accessing the network when the terminal device accesses the network based on the first IP address.

[0019] In combination with the first aspect, in an optional implementation, before sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: determining a transmission key with the network device.

[0020] In combination with the first aspect, in an optional implementation, after sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: determining whether an IP address required for accessing the network is received within a preset time; if the IP address required for accessing the network is not received within the preset time, determining whether the number of repetitions of sending the DHCP request reaches a preset number; if the number of repetitions of sending the DHCP request reaches the preset number, executing the step of determining an Internet Protocol IP address pool corresponding to the network device.

[0021] In combination with the first aspect, in an optional implementation, the method further includes: if it is determined that the number of repetitions of sending the DHCP request does not reach a preset number, executing the step of sending the DHCP request to the network device again.

[0022] In a second aspect, the present application provides a terminal device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the terminal device to execute: after sending a Dynamic Host Configuration Protocol DHCP request to a network device, if the Internet Protocol IP address required for accessing the network is not received, determine the IP address pool corresponding to the network device; the DHCP request is used to request the IP address required for accessing the network; based on the IP address pool, randomly generate a first IP address; based on the first IP address, access the network.

[0023] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instructions to cause the device to execute: determining whether the first IP address has been used; if not, executing the step of accessing the network based on the first IP address.

[0024] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instructions to cause the device to execute: broadcast an Address Resolution Protocol ARP message to other terminal devices; if no response message to the ARP message is received, determine that the first IP address is not in use; if a response message to the ARP message is received, determine that the first IP address is in use.

[0025] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instruction to cause the device to execute: if it is determined that the first IP address has been used, then re-execute the step of randomly generating the first IP address based on the IP address pool.

[0026] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instructions to cause the device to execute: using the first IP address, testing whether the network between the network device is connected; if the network between the network device is connected, determining that the network has been successfully accessed.

[0027] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instructions to cause the device to execute: determining brand information of the network device; and determining an IP address pool corresponding to the network device based on the brand information.

[0028] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instruction to cause the device to execute: before sending a Dynamic Host Configuration Protocol DHCP request to the network device, determine a transmission key with the network device.

[0029] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instructions to cause the device to execute: determining whether the IP address required for accessing the network is received within a preset time; if the IP address required for accessing the network is not received within the preset time, determining whether the number of repetitions of sending the DHCP request reaches a preset number; if the number of repetitions of sending the DHCP request reaches the preset number, executing the step of determining the Internet Protocol IP address pool corresponding to the network device.

[0030] In combination with the second aspect, in an optional implementation, the one or more processors call the computer instruction to cause the device to execute: if it is determined that the number of repetitions of sending the DHCP request does not reach a preset number, then execute the step of sending the DHCP request to the network device again.

[0031] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a touch screen, a camera, one or more processors and one or more memories; the one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the terminal device executes the method described in the first aspect or any optional implementation method of the first aspect.

[0032] In a fourth aspect, the present application provides a chip system, which is applied to a device, and the chip system includes one or more processors, which are used to call computer instructions so that the device executes the method described in the first aspect or any optional embodiment of the first aspect.

[0033] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a device, enables the terminal device to execute a method as described in the first aspect or any optional implementation of the first aspect.

[0034] In a sixth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a terminal device, causes the terminal device to execute a method as described in the first aspect or any optional implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figures 1a to 1e are some user interface schematic diagrams provided in the embodiments of the present application;

[0036] Figure 2 It is a flowchart of a network connection method provided in an embodiment of the present application;

[0037] Figure 3 It is a flowchart of another network connection method provided in an embodiment of the present application;

[0038] Figure 4 It is a flowchart of another network connection method provided in an embodiment of the present application;

[0039] Figure 5 It is a schematic diagram of a process for a terminal device and a network device to determine a transmission key provided by an embodiment of the present application;

[0040] Figure 6 1 is a schematic diagram of a hardware architecture of a terminal device 100 provided in an embodiment of the present application;

[0041] Figure 7 It is a schematic diagram of the software architecture of a terminal device 100 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiments may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0043] The terms "first", "second", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.

[0044] Only the part relevant to the present application but not all content is shown in the accompanying drawings.Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods described as flow charts.Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously.In addition, the order of various operations can be rearranged.Described processing can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings.Described processing can correspond to method, function, procedure, subroutine, subprogram etc.

[0045] As used in this specification, the terms "component", "module", "system", "unit", etc. are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).

[0046] Currently, when a terminal device is connected to a network, there is a problem that the network device fails to allocate an Internet Protocol (IP) address to the terminal device through the Dynamic Host Configuration Protocol (DHCP), resulting in the terminal device being unable to access the network.

[0047] Among them, DHCP is a network protocol for local area networks that can be used to automatically assign IP addresses to terminal devices. In other words, network devices (such as routers) can automatically assign IP addresses to terminal devices from a pre-set IP address pool based on DHCP. It can not only ensure that IP addresses are not assigned repeatedly, but also recycle IP addresses in a timely manner to improve the utilization rate of IP addresses. DHCP includes 3 different address allocation mechanisms:

[0048] 1. Manual allocation: The administrator specifies a pre-allocated IP address for the client (terminal device), and DHCP only transmits the IP address to the terminal device.

[0049] 2. Automatic allocation: DHCP selects a static IP address from the available address pool and automatically and permanently allocates it to the terminal device without any lease issues.

[0050] 3. Dynamic allocation: DHCP automatically and dynamically allocates or leases IP addresses from the address pool for the lease period selected by the network device, or until the terminal device informs the network device that it no longer needs the address.

[0051] Currently, users can call a hotline and configure a static IP address for the terminal device to solve the problem that the terminal device cannot access the network due to the failure of the network device to assign an IP address to the terminal device through DHCP. However, using this method, the speed at which the terminal device accesses the network is low.

[0052] An embodiment of the present application provides a network connection method, in which, after a terminal device sends a Dynamic Host Configuration Protocol DHCP request to a network device, if the terminal device does not receive an Internet Protocol IP address required for accessing the network, an IP address pool corresponding to the network device can be determined; wherein the DHCP request is used to request the IP address required for accessing the network; a first IP address is randomly generated from the IP address pool; and the network is accessed based on the first IP address.

[0053] In an optional implementation, the method further includes: determining whether the first IP address has been used; if not, executing the step of accessing the network based on the first IP address.

[0054] In an optional implementation, determining whether the first IP address has been used includes: broadcasting an Address Resolution Protocol ARP message to other terminal devices; if no response message to the ARP message is received, determining that the first IP address is not in use; if a response message to the ARP message is received, determining that the first IP address has been used.

[0055] In an optional implementation, the method further includes: if it is determined that the first IP address has been used, then executing again the step of randomly generating the first IP address based on the IP address pool.

[0056] In an optional implementation, the method further includes: using the first IP address to test whether the network between the network device and the network is connected; if the network between the network device and the network is connected, it is determined that the network has been successfully accessed.

[0057] In an optional implementation, determining an Internet Protocol IP address pool corresponding to a network device includes: determining brand information of the network device; and determining an IP address pool corresponding to the network device based on the brand information.

[0058] In an optional implementation, before sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: determining a transmission key with the network device.

[0059] In an optional implementation, after sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: determining whether an IP address required for accessing the network is received within a preset time; if the IP address required for accessing the network is not received within the preset time, determining whether the number of repetitions of sending the DHCP request reaches a preset number; if the number of repetitions of sending the DHCP request reaches the preset number, executing the step of determining an Internet Protocol IP address pool corresponding to the network device.

[0060] In an optional implementation, the method further includes: if it is determined that the number of repetitions of sending the DHCP request does not reach a preset number, executing the step of sending the DHCP request to the network device again.

[0061] After implementing the network connection method provided by this application, the following beneficial effects are achieved:

[0062] (1) It can avoid the problem that the terminal device cannot access the network due to failure to receive the IP address required for accessing the network, thereby improving the success rate of the terminal device accessing the network.

[0063] (2) Compared with the method of manually configuring the static IP address of the terminal device, it can improve the speed of the terminal device accessing the network and save labor costs.

[0064] The network connection method provided in the embodiment of the present application can be applied to a variety of scenarios, including but not limited to:

[0065] (1) Wireless network connection scenario

[0066] In wireless network connection scenarios (such as smartphones, tablets, smart screens, and other terminal devices that support wireless fidelity (WiFi) connecting to the network through WiFi hotspots), there is a problem that the network device fails to assign an IP address to the terminal device through DHCP, resulting in the terminal device being unable to access the wireless network.

[0067] In this case, after the terminal device sends a DHCP request to the network device, if it does not receive the IP address required to access the wireless network, it can determine the IP address pool corresponding to the network device; randomly generate a first IP address from the IP address pool; and access the wireless network based on the first IP address. Optionally, in this scenario, the network device is a device with routing function, such as a router, a three-layer switch, etc., and this application does not impose any special restrictions on the specific type of the network device.

[0068] (2) Ethernet connection scenario

[0069] In an Ethernet network connection scenario, after the terminal device sends a DHCP request to the network device, if it does not receive the IP address required to access the Ethernet network, it can determine the IP address pool corresponding to the network device; randomly generate a first IP address from the IP address pool; and access the Ethernet network based on the first IP address.

[0070] Optionally, in this scenario, the network device may be a router, a layer 2 Ethernet switch, a layer 3 Ethernet switch, etc.

[0071] The following takes the wireless network connection scenario as an example. Figures 1a to 1e The application scenarios of the network connection method provided in the embodiments of the present application are introduced.

[0072] See also Figures 1a to 1e , Figures 1a to 1e These are some user interface schematic diagrams provided in the embodiments of the present application.

[0073] like Figure 1a As shown, a user interface 11 of a terminal device 100 showing a main screen provided by an embodiment of the present application is shown. In the user interface 11, a page with application icons is displayed, and the page includes multiple application icons, such as a phone application icon, a setting application icon, a contact application icon, a message application icon, etc. A page indicator is also displayed below the multiple application icons to indicate the positional relationship between the currently displayed page and other pages.

[0074] The terminal device 100 can detect the user's touch operation on different application icons in the user interface 11. In response to the operation, the terminal device can open a phone application, a setting application, a contact application, a message application, etc. For example, the terminal device 100 can detect the user's touch operation on the setting application icon and open the setting application.

[0075] like Figure 1b As shown, a default user interface 12 provided by a setting application after a terminal device 100 according to an embodiment of the present application opens a setting application. The user interface 12 may include multiple functional options such as flight mode, WiFi, Bluetooth, personal hotspot, and mobile network. The terminal device 100 may detect a user's touch operation on different functional options in the user interface 12, and in response to the operation, the terminal device 100 may turn on or off functions such as flight mode, WiFi, Bluetooth, personal hotspot, and mobile network.

[0076] Among them, the "WiFi" option 111 in the user interface 12 is used to turn on or off the wireless network connection function of the terminal device, and the wireless network connection function can be used for the terminal device 100 to access the wireless network. The "WiFi" option 111 includes a setting switch 111A, and the setting switch 111A can detect the user's touch operation. In response to the operation, the first device 101 turns on or off the wireless network connection function. Exemplarily, when the main body color displayed by the setting switch 111A is white, the wireless network connection function is in a closed state, and when the main body color displayed by the switch 111A is gray, the wireless network connection function is in an open state.

[0077] like Figure 1b As shown, the terminal device 100 can detect the user's touch operation on the setting switch 111A. In response to the operation, the terminal device 100 turns on the wireless network connection function, and the main body color of the setting switch 111A changes from white to gray. At this time, the terminal device 100 can start the wireless network connection function to prepare for accessing the wireless network.

[0078] like Figure 1c As shown, a user interface 13 of a terminal device 100 provided in an embodiment of the present application is shown. The user interface 13 includes a wireless network connection prompt icon 131. The wireless network connection prompt icon 131 is used to indicate that the terminal device 100 fails to access the wireless network when the wireless network connection function of the terminal device 100 is turned on. In some embodiments, the wireless network connection prompt icon 131 may indicate that the terminal device has not received the IP address required to access the wireless network. In this case, the terminal device 100 can determine the IP address pool corresponding to the network device.

[0079] like Figure 1d As shown, a user interface 14 of a terminal device 100 provided in an embodiment of the present application is shown. The user interface 14 includes an IP address display bar 141. The IP address display bar 141 displays a first IP address randomly generated by the terminal device 100 from a determined IP address pool. The terminal device 100 can access a wireless network based on the first IP address.

[0080] In some embodiments, before the terminal device accesses the wireless network based on the first IP address, it can also broadcast an ARP message to other terminal devices and determine whether an ARP response message is received. If so, the terminal device 100 can display a prompt message to remind the user that the first IP address has been used. Figure 1e As shown, a user interface 15 of a terminal device 100 provided in an embodiment of the present application is shown. The user interface 15 includes an information prompt box 151, which prompts the user whether the first IP address has been used. For example, the information prompt box 151 may display "the first IP address has been used" or "the first IP address is not used".

[0081] Exemplarily, if the terminal device 100 does not receive an ARP response message after broadcasting an ARP message to other terminal devices, the information prompt box 151 displays "The first IP address is not in use". In this case, the terminal device 100 can access the wireless network based on the first IP address. If the terminal device 100 receives an ARP response message after broadcasting an ARP message to other terminal devices, the information prompt box 151 displays "The first IP address is in use". In this case, the terminal device 100 can perform the step of randomly generating the first IP address from the determined IP address pool again.

[0082] The network connection method provided in the embodiment of the present application is described below.

[0083] See also Figure 2 , Figure 2 Schematic diagram of a network connection method provided by an embodiment of the present application. Figure 2 As shown, the network connection method may include but is not limited to the following steps:

[0084] S201. After sending a Dynamic Host Configuration Protocol DHCP request to a network device, if an Internet Protocol IP address required for accessing the network is not received, determine an IP address pool corresponding to the network device.

[0085] The DHCP request is used to request an IP address required for accessing the network.

[0086] In an optional implementation, the terminal device determines the IP address pool corresponding to the network device in the following manner: determining brand information of the network device; and determining the IP address pool corresponding to the network device based on the brand information.

[0087] For example, the terminal device determines that the brand information of the network device is brand A; based on brand A, it is determined that the address pool commonly used by brand A network devices is 192.168.1.0-192.168.1.255.

[0088] In this implementation, the terminal device can obtain the organizationally unique identifier (OUI) information of the network device from the physical address of the network device, and determine the brand information of the network device based on the OUI information. The physical address of the network device is broadcast by the network device before the terminal device and the network device perform a four-way handshake.

[0089] S202: Randomly generate a first IP address based on an IP address pool.

[0090] For example, the terminal device can randomly generate an IP address of 192.168.1.xy from the address pool of 192.168.1.0-192.168.1.255, where xy represents the final randomly generated address. If xy is 22, the first IP address is 192.168.1.22.

[0091] S203: Access the network based on the first IP address.

[0092] In an optional implementation, the terminal device may also determine whether the first IP address has been used; if not, execute step S203.

[0093] In the embodiment of the present application, the terminal device can determine the address pool corresponding to the network when it has not received the IP address required for accessing the network device; randomly generate a first IP address from the address pool; and access the network based on the first IP address. In this way, the problem that the terminal device cannot access the network due to failure to receive the IP address required for accessing the network can be avoided, thereby improving the success rate of the terminal device accessing the network.

[0094] See also Figure 3 , Figure 3 FIG. 1 is a flow chart of another network connection method provided in an embodiment of the present application. Figure 2 Compared to the network connection method shown, Figure 3 In the network connection method shown in FIG. 1 , the terminal device also broadcasts an ARP message to other terminal devices to determine whether the first IP address has been used. Figure 3As shown, the network connection method may include but is not limited to the following steps:

[0095] S301. After sending a Dynamic Host Configuration Protocol DHCP request to a network device, if an Internet Protocol IP address required for accessing the network is not received, determine an IP address pool corresponding to the network device.

[0096] The DHCP request is used to request the IP address required for accessing the network.

[0097] In an optional implementation, after the terminal device sends a Dynamic Host Configuration Protocol DHCP request to the network device, it can also determine whether the IP address required for accessing the network is received within a preset time; if the IP address required for accessing the network is not received within the preset time, determine whether the number of repetitions of sending the DHCP request reaches a preset number; if the number of repetitions of sending the DHCP request reaches the preset number, execute the step of determining the Internet Protocol IP address pool corresponding to the network device.

[0098] Optionally, if it is determined that the number of repetitions of sending the DHCP request does not reach a preset number, the step of sending the DHCP request to the network device is executed again.

[0099] S302: Randomly generate a first IP address based on an IP address pool.

[0100] In an optional implementation, the relevant descriptions of steps S301 and S302 can refer to the descriptions in the aforementioned steps S201 and S202, respectively, and will not be repeated here.

[0101] S303: Broadcast an Address Resolution Protocol ARP message to other terminal devices.

[0102] ARP is a TCP / IP protocol that obtains a physical address based on an IP address. That is, the purpose of a terminal device broadcasting an ARP message to other terminal devices is to inquire other terminal devices about the physical address using the first IP address.

[0103] S304, determine whether a response message to the ARP message is received; if so, execute step S305a; if not, execute step S305b.

[0104] The response message of the ARP message is a physical address sent by other terminal devices to the terminal device, which is used to indicate that the first IP address has been used. In other words, the terminal device can determine whether the first IP address has been used by determining whether the physical address has been received.

[0105] S305a: Determine that the first IP address has been used.

[0106] In an optional implementation, after step S305a, the terminal device may execute step S302 again.

[0107] S305b: Determine that the first IP address is not in use.

[0108] In an optional implementation, after step S305b, the terminal device may execute step S306.

[0109] S306: Access the network based on the first IP address.

[0110] In an optional implementation, the terminal device may also use the first IP address to test whether the network between the terminal device and the network device is connected; if the network between the terminal device and the network device is connected, it is determined that the terminal device has successfully accessed the network based on the first IP address. Optionally, if the network between the terminal device and the network device is not connected, step S301 may be performed again.

[0111] Optionally, the terminal device uses the first IP address to test whether the network between the terminal device and the network device is connected. The following method can be used: use the first IP address to ping the gateway address; if pinging the gateway address is successful, it is determined that the network connection between the terminal device and the network device is connected; if pinging the gateway address fails, it is determined that the network connection between the terminal device and the network device is not connected.

[0112] In the embodiment of the present application, the terminal device can determine the IP address pool corresponding to the network device when it does not receive the IP address required for accessing the network device; randomly generate a first IP address from the IP address pool; determine whether the first IP address has been used; if the first IP address has not been used, access the network based on the first IP address; if the first IP address has been used, perform the step of randomly generating the first IP address based on the IP address pool again. In this way, the terminal device can access the network based on the generated unused IP address, thereby improving the success rate of the terminal device accessing the network.

[0113] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of another network connection method provided in an embodiment of the present application. Figure 3 Compared to the network connection method shown, Figure 4 In the network connection method shown, before sending a DHCP request to the network device, the terminal device also determines to transmit a secret key with the network device, and when the terminal device determines that the first IP address is not in use, the terminal device uses the first IP address to test whether the network connection with the network device is connected. Figure 4As shown, the network connection method may include but is not limited to the following steps:

[0114] S401. Determine a transmission key with a network device.

[0115] In an optional implementation, before sending a DHCP request to the network device, the terminal device also determines a transmission key with the network device, wherein the transmission key is used to encrypt and / or decrypt data packets subsequently transmitted between the terminal device and the network device.

[0116] Optionally, the transmission key includes a pairwise transient key (PTK) and a group temporal key (GTK). The PTK is used to encrypt and / or decrypt unicast data frames between the terminal device and the network device; the GTK is used to encrypt and / or decrypt multicast data frames and broadcast data frames between the terminal device and the network device.

[0117] Optionally, the terminal device determines the transmission key with the network device in the following manner: the terminal device and the network device perform a four-way handshake (i.e., four information exchanges) through an extensible authentication protocol over LAN (EAPOL) protocol to determine the transmission key.

[0118] In an optional implementation, before the terminal device determines that the WiFi authentication and connection association with the network device are successful, the terminal device also determines that the WiFi authentication and connection association with the network device are successful. Optionally, the terminal device determines that the WiFi authentication and connection association with the network device are successful, and the following methods can be used: the terminal device sends an authentication request message to the network device, and the network device receives the authentication request message from the terminal device accordingly, and the authentication request message includes the identity information of the terminal device; the network device sends an authentication response message to the terminal device, and the terminal device receives the authentication response message from the network device accordingly, and the authentication response message is used to indicate that the identity authentication is successful; the terminal device sends an association request message to the network device, and the network device receives the association request message from the terminal device accordingly, and the association request message is used to request to establish a connection with the network device; the network device sends an association response message to the terminal device, and the terminal device receives the association response message from the network device accordingly, and the association response message is used to indicate that the connection association is successful.

[0119] S402: Send a Dynamic Host Configuration Protocol DHCP request to a network device.

[0120] The DHCP request is used to request the IP address required for accessing the network.

[0121] Optionally, the DHCP request may also be referred to as a DHCP Discover message.

[0122] S403: Determine whether the IP address required for accessing the network is received within a preset time.

[0123] Optionally, the IP address required for accessing the network may be carried in a DHCP Offer message.

[0124] S404: If the IP address required for accessing the network is not received within the preset time, determine whether the number of repetitions of sending the DHCP request reaches the preset number; if so, execute step S405; if not, execute step S402.

[0125] For example, assuming that the preset time is 10 seconds and the preset number of times is 5 times, after the terminal device sends a DHCP request to the network device for the first time, it can determine whether a DHCP Offer message is received within 10 seconds; if the terminal device determines that a DHCP Offer message is not received within 10 seconds, it is determined that the number of repetitions of sending the DHCP request (1 time) does not reach the preset number of times (5 times). In this case, the terminal device can send a DHCP request to the network device again.

[0126] For another example, assuming that the preset time is 10 seconds and the preset number of times is 5 times, after the terminal device sends the DHCP request to the network device for the fifth time, it can determine whether a DHCP Offer message is received within 10 seconds; if the terminal device determines that the DHCP Offer message is not received within 10 seconds, it is determined that the number of repetitions of sending the DHCP request (5 times) reaches the preset number of times (5 times). In this case, the terminal device can execute step S405.

[0127] Optionally, failure of the terminal device to receive the IP address required for accessing the network within a preset time period may also be indicated as a DHCP Discover timeout.

[0128] S405: Determine the Internet Protocol IP address pool corresponding to the network device.

[0129] S406: Randomly generate a first IP address based on the IP address pool.

[0130] S407: Broadcast an Address Resolution Protocol ARP message to other terminal devices.

[0131] S408, determine whether a response message to the ARP message is received; if so, execute step S409a; if not, execute step S409b.

[0132] S409a: Determine that the first IP address has been used.

[0133] In an optional implementation, after step S409a, the terminal device may execute step S406 again.

[0134] S409b: Determine that the first IP address is not in use.

[0135] In an optional implementation, after step S409b, the terminal device may execute step S410.

[0136] In an optional implementation, the relevant descriptions of steps S407 to S409b can refer to the descriptions in the aforementioned steps S303 to S305b, respectively, and will not be repeated here.

[0137] S410, using the first IP address, test whether the network connection with the network device is connected; if so, execute step S411; if not, execute step S401.

[0138] In an optional implementation, the terminal device uses the first IP address to test whether the network between the terminal device and the network device is connected. The following method can be used: use the first IP address to ping the gateway address; if the ping of the gateway address is successful, it is determined that the network connection between the terminal device and the network device is connected; if the ping of the gateway address fails, it is determined that the network connection between the terminal device and the network device is not connected.

[0139] S411. Determine that the network has been successfully accessed based on the first IP address.

[0140] Optionally, the terminal device can communicate with the network device using the first IP address.

[0141] In the embodiment of the present application, the terminal device can send a DHCP request to the network device, and the DHCP request is used to request the IP address required for accessing the network; if the IP address required for accessing the network device is not received within a preset time, and the number of repetitions of sending the DHCP request reaches a preset number, the IP address pool corresponding to the network device is determined; a first IP address is randomly generated from the IP address pool; if it is determined that the first IP address is not in use, the first IP address is used to test whether the network connection with the network device is connected; if it is connected, it is determined that the network has been successfully accessed based on the first IP address. In this way, the problem that the terminal device cannot access the network due to failure to receive the IP address required for accessing the network can be avoided, thereby improving the success rate of the terminal device accessing the network.

[0142] In an optional implementation, in the aforementioned step S401, the terminal device and the network device determine the transmission key in the following manner: the terminal device and the network device perform a four-way handshake (i.e., four information interactions) through an extensible authentication protocol over LAN (EAPOL) protocol to determine the transmission key.

[0143] Optionally, before the four-way handshake, the network device may broadcast the service set identifier (SSID) and the physical address, and accordingly, the terminal device may receive the SSID and the physical address of the network device; the terminal device generates a PMK (denoted as PMK-CL) based on the received SSID. Optionally, the terminal device may also generate a random code (denoted as SNonce).

[0144] Optionally, the network device may also generate a PMK (denoted as PMK-AP) and a random code (denoted as ANonce).

[0145] Combine the following Figure 5 , describes the process of determining the transmission key between the terminal device and the network device. Figure 5 FIG. 1 is a schematic diagram of a process for a terminal device and a network device to determine a transmission key provided by an embodiment of the present application. The process may include but is not limited to the following steps:

[0146] S501. The network device sends ANonce to the terminal device; correspondingly, the terminal device receives ANonce from the network device.

[0147] S502. The terminal device generates a PTK-CL based on the PMK-CL, SNonce and ANonce.

[0148] S503: The terminal device sends SNonce and MIC-CL to the network device. Correspondingly, the network device receives SNonce and MIC-CL from the terminal device. The MIC-CL is obtained by the terminal device based on PTK-CL.

[0149] Optionally, MIC-CL is obtained by the terminal device by extracting the first 16 bytes of PTK-CL using a hash algorithm.

[0150] S504: The network device generates PTK-AP based on SNonce, ANonce and PMK-AP.

[0151] Optionally, the network device may also obtain MIC-AP by extracting the first 16 bytes of PTK-AP.

[0152] Optionally, the network device may also compare the MIC-AP and the MIC-CL; if the MIC-AP and the MIC-CL are consistent, it is determined that they are consistent with the PTK-CL generated by the terminal device; and the PTK-CL or PTK-AP is used as the final PTK.

[0153] S505. The network device sends MIC-AP, GTK and a first message to the terminal device. Correspondingly, the terminal device receives MIC-AP, GTK and the first message from the network device. The first message is used to instruct the terminal device to install PTK and GTK.

[0154] Optionally, after step S505, the terminal device may install PTK and GTK.

[0155] Among them, installation refers to the use of PTK and GTK to encrypt data.

[0156] S506: The terminal device sends confirmation information to the network device. Correspondingly, the network device receives confirmation information from the terminal device. The confirmation information is used to indicate that the installation of PTK and GTK is complete.

[0157] Optionally, after step S506, the network device also installs PTK.

[0158] The following is an introduction to the terminal device used in the network connection method provided by this application.

[0159] In this application, the terminal device may be equipped with Or terminal devices of other operating systems, such as mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPC), netbooks, as well as cellular phones, personal digital assistants (PDA), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, vehicle-mounted devices, smart home devices and / or smart city devices, etc. The present application does not impose any special restrictions on the specific type of the terminal device.

[0160] See also Figure 6 , Figure 6 1 is a schematic diagram of the hardware architecture of a terminal device 100 provided in an embodiment of the present application. Figure 6As shown, the terminal device 100 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.

[0161] It is understandable that the structure shown in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include Figure 6 More or fewer components may be shown, or some components may be combined or separated, or the components may be arranged differently. Figure 6 The components shown may be implemented in hardware, software or a combination of software and hardware.

[0162] 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, an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0163] The controller may be the nerve center and command center of the terminal device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0164] A memory may also be provided in the processor 110 for storing instructions and data. In an optional implementation, 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.

[0165] In the embodiment of the present application, the processor 110 can be used to connect to the network, and specifically can be used to: after sending a Dynamic Host Configuration Protocol DHCP request to the network device, if the Internet Protocol IP address required for accessing the network is not received, determine the IP address pool corresponding to the network device; the DHCP request is used to request the IP address required for accessing the network; based on the IP address pool, randomly generate a first IP address; based on the first IP address, access the network. The specific steps executed by the processor 110 can refer to the description of the above steps S201-S203, which will not be repeated here.

[0166] In addition, the processor 110 is further configured to: determine whether the first IP address has been used; if not, execute the step of accessing the network based on the first IP address.

[0167] In addition, when determining whether the first IP address has been used, the processor 110 is specifically used to: broadcast an Address Resolution Protocol ARP message to other terminal devices; if no response message to the ARP message is received, it is determined that the first IP address is not in use; if a response message to the ARP message is received, it is determined that the first IP address has been used.

[0168] In addition, the processor 110 is further configured to: if the first IP address has been used, execute again the step of randomly generating the first IP address based on the IP address pool.

[0169] In addition, the processor 110 is further configured to: use the first IP address to test whether the network between the network device and the network is connected; if the network between the network device and the network is connected, it is determined that the network has been successfully accessed.

[0170] In addition, when the processor 110 is used to determine the Internet Protocol IP address pool corresponding to the network device, it is specifically used to: determine the brand information of the network device; and determine the IP address pool corresponding to the network device based on the brand information.

[0171] In addition, before sending a Dynamic Host Configuration Protocol DHCP request to the network device, the processor 110 is further used to: determine a transmission key with the network device. In addition, after sending a Dynamic Host Configuration Protocol DHCP request to the network device, the processor 110 is further used to: determine whether an IP address required for accessing the network is received within a preset time; if the IP address required for accessing the network is not received within the preset time, determine whether the number of repetitions of sending the DHCP request reaches a preset number; if the number of repetitions of sending the DHCP request reaches a preset number, perform a step of determining an Internet Protocol IP address pool corresponding to the network device.

[0172] In addition, the processor 110 is further configured to: if it is determined that the number of repetitions of sending the DHCP request does not reach a preset number, execute the step of sending the DHCP request to the network device again.

[0173] In an optional implementation, 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.

[0174] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0175] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0176] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.;

[0177] Non-volatile memory may include disk storage devices and flash memory.

[0178] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; can be divided into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; can be divided into universal flash storage (UFS), embedded multi media card (eMMC), etc. according to the storage specification.

[0179] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0180] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0181] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the terminal device 100. The external non-volatile memory 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 are stored in the external non-volatile memory.

[0182] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, etc.

[0183] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0184] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In an optional embodiment, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In an optional embodiment, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0185] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0186] The terminal device 100 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, which execute program instructions to generate or change display information.

[0187] 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 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0188] The terminal device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0189] 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.

[0190] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0191] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0192] The terminal device 100 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 headphone jack 170D, and the application processor.

[0193] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0194] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The terminal device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0195] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the terminal device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the ear.

[0196] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by putting his mouth close to the microphone 170C to input the sound signal into the microphone 170C. The terminal device 100 can be provided with at least one microphone 170C. In other embodiments, the terminal device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the terminal device 100 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, and realization of directional recording function, etc.

[0197] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .

[0198] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0199] The magnetic sensor 180D includes a Hall sensor, and the terminal device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case.

[0200] The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). When the terminal device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0201] The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0202] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the terminal device 100, which is different from the position of the display screen 194.

[0203] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of a human vocal part.

[0204] In the embodiment of the present application, the software system of the terminal device 100 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device 100.

[0205] See also Figure 7 , Figure 7 It is a schematic diagram of the software architecture of a terminal device 100 provided in an embodiment of the present application.

[0206] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In an optional implementation, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the hardware abstraction layer (HAL), and the kernel layer.

[0207] The application layer can include a series of application packages. Figure 7 As shown, the application package can include applications such as settings, smart assistant, gallery, calls, maps, navigation, Bluetooth, network and sharing center applications.

[0208] Among them, the setting application can provide a network connection switch, which can be used to turn on or off the network connection function, and the network connection function can be used to access the network.

[0209] The Network and Sharing Center is used to provide the function of accessing a wireless network or an Ethernet network.

[0210] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 7 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0211] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0212] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0213] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0214] The phone manager is used to provide communication functions of the device 100, such as management of call status (including connection, disconnection, etc.).

[0215] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0216] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0217] The hardware abstraction layer may include multiple functional modules, such as a communication module, a generation module, a determination module, and a processing module.

[0218] The communication module is used to send a DHCP request to the network device.

[0219] The determination module is used to determine the IP address pool corresponding to the network device when the IP address required for accessing the network is not received.

[0220] The generating module is used to randomly generate a first IP address based on an IP address pool.

[0221] The processing module is used to access the network based on the first IP address.

[0222] The kernel layer is the layer between hardware and software. The kernel layer contains at least processing drivers, display drivers, camera drivers, audio drivers, sensor drivers, etc.

[0223] It should be understood that each step in the above method embodiment provided by the present application can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.

[0224] It should be noted that, for the above method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described order of actions. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention. The various embodiments of the present application can be arbitrarily combined to achieve different technical effects.

[0225] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk), etc.

[0226] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: read-only memory (ROM) or RAM, magnetic disk or optical disk and other media that can store program codes.

[0227] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.

Claims

1. A network connection method, characterized in that: The method comprises: Receive the Organizationally Unique Identifier (OUI) broadcast by network devices; After sending a Dynamic Host Configuration Protocol DHCP request to the network device, if an Internet Protocol IP address required for accessing the network is not received, determining brand information of the network device based on the OUI, and determining an IP address pool corresponding to the network device based on the brand information; the DHCP request is used to request the IP address required for accessing the network; Based on the IP address pool, randomly generate a first IP address; Access the network based on the first IP address.

2. The method according to claim 1, characterized in that The method further comprises: Determining whether the first IP address has been used; If it is not used, the step of accessing the network based on the first IP address is performed.

3. The method according to claim 2, characterized in that Determining whether the first IP address has been used includes: Broadcast Address Resolution Protocol (ARP) messages to other terminal devices; If no response message to the ARP message is received, determining that the first IP address is not in use; If a response message to the ARP message is received, it is determined that the first IP address has been used.

4. The method according to claim 3, characterized in that The method further comprises: If it is determined that the first IP address has been used, the step of randomly generating the first IP address based on the IP address pool is performed again.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Using the first IP address, testing whether the network between the network device and the network device is connected; If the network between the network device is connected, it is determined that the network has been successfully accessed.

6. The method according to any one of claims 1 to 4, characterized in that: Before sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: Determine the transmission key with the network device.

7. The method according to any one of claims 1 to 4, characterized in that: After sending a Dynamic Host Configuration Protocol DHCP request to the network device, the method further includes: Determining whether the IP address required for accessing the network is received within a preset time; If the IP address required for accessing the network is not received within a preset time, determining whether the number of repetitions of sending the DHCP request reaches a preset number; If the number of repetitions of sending the DHCP request reaches the preset number, the step of determining the Internet Protocol IP address pool corresponding to the network device is performed.

8. The method according to claim 7, characterized in that The method further comprises: If it is determined that the number of repetitions of sending the DHCP request does not reach the preset number, the step of sending the DHCP request to the network device is performed again.

9. A terminal device, characterized in that: include: Memory, processor and touch screen; wherein: The touch screen is used to display content; The memory is used to store a computer program, wherein the computer program includes program instructions; The processor is used to call the program instructions so that the terminal device executes the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method, system and device for allocating media access control address for access point

    CN101150597A

  • Data flow classification method and data flow classification server

    CN103297560A

  • Method and device for accessing wireless network

    CN105933465A

  • IP (Internet Protocol) address assignment method and device based on open network operating system

    CN106059888A

  • IP address acquisition method and related product

    CN111294416A