Network connection method, electronic equipment and storage medium

By selecting different DHCP response messages to generate static network configuration information in multiple router environments within the LAN, the network connection failure caused by the mismatch between the IP address and the MAC address is solved, and the connection success rate is improved.

CN120342999APending Publication Date: 2025-07-18HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410042474.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-10
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the case where multiple routers exist in the same LAN, electronic devices may obtain mismatched IP addresses and MAC addresses, resulting in network connection failure.

Method used

By receiving the DHCP response messages sent by multiple routers, selecting the first DHCP response message for network connection failure, switching to different second DHCP response messages to generate static network configuration information for static network connection.

Benefits of technology

This improves the success rate of network connections and solves the problem of connection failure caused by mismatch of dynamic network configuration information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120342999A_ABST
    Figure CN120342999A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a network connection method, electronic equipment and a storage medium, and relates to the technical field of terminals, the electronic equipment establishes connection with one router in a target local area network, a plurality of routers exist in the target local area network, and the method comprises the following steps: receiving DHCP response messages sent by the plurality of routers in the target local area network; selecting a first DHCP response message from the DHCP response messages sent by the plurality of routers to perform network connection; if the network connection fails through the first DHCP response message, selecting a second DHCP response message from the DHCP response messages sent by the plurality of routers; obtaining dynamic network configuration information in the second DHCP response message; generating static network configuration information according to the dynamic network configuration information; and performing static network connection based on the static network configuration information. A scheme for changing dynamic network connection into static network connection is provided, and the success rate of network connection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminals, and in particular, to a network connection method, an electronic device, and a storage medium. Background Art

[0002] Network connection refers to establishing a communication link between an electronic device and a router in a computer network and ensuring that data can be exchanged between them.

[0003] Generally, during the network connection process, an electronic device needs to first obtain the Media Access Control (MAC) address of the router. After obtaining the MAC address, the electronic device obtains the Internet Protocol (IP) address assigned by the router and performs IP address settings. After the IP address settings are completed, the electronic device and the router can establish a communication connection.

[0004] However, during the network connection process, there are usually multiple routers with different network segments in the same local area network. This makes it easy for an electronic device to obtain the MAC address of one router, but the IP address set may be the IP address assigned by another router. In this case, the IP address and the MAC address do not match, resulting in the inability to perform network transmission after setting the IP address. Summary of the Invention

[0005] Embodiments of this application provide a network connection method, an electronic device, and a storage medium, which can improve the success rate of network connection.

[0006] To achieve the above objective, the embodiments of this application adopt the following technical solutions:

[0007] In a first aspect, a network connection method is provided, which is applied to an electronic device. The electronic device establishes a connection with one router in a target local area network, and there are multiple routers in the target local area network. The method includes: receiving Dynamic Host Configuration Protocol (DHCP) response messages sent by multiple routers in the target local area network; selecting a first DHCP response message from the DHCP response messages sent by the multiple routers for network connection; if the network connection fails through the first DHCP response message, selecting a second DHCP response message different from the first DHCP response message from the DHCP response messages sent by the multiple routers; obtaining dynamic network configuration information in the second DHCP response message; generating static network configuration information based on the dynamic network configuration information; and performing a static network connection based on the static network configuration information.

[0008] Based on the technical solution provided by the embodiments of the present application, when there are multiple routers in a local area network and an electronic device has already established a connection with one router, after broadcasting a DHCP request message, multiple DHCP response messages can be obtained. At this time, the electronic device selects one of the multiple DHCP response messages as the first DHCP response message, and uses the dynamic network configuration information in the first DHCP response message to establish a network connection. In the case where the network connection fails using the dynamic network configuration information in the first DHCP response message, a second DHCP response message different from the first DHCP response message can be selected from the multiple DHCP response messages, the dynamic network configuration information in the second DHCP response message is obtained, static network configuration information is generated based on the dynamic network configuration information in the second DHCP response message, and a network connection is made based on the static network configuration information. Thus, when there are multiple routers in a local area network, if the selected DHCP response message does not match the router, resulting in a failure to establish a network connection through DHCP, static network configuration information can be generated according to the dynamic network configuration information of the second DHCP response message received that is different from the first DHCP response message, and then a network connection can be achieved through the static network connection method. Therefore, for the situation where the dynamic network configuration information cannot be changed even if the network connection fails after using DHCP for network connection, and only the router can be disconnected and reconnected, a solution to change the dynamic network connection to a static network connection is provided, and the success rate of network connection is improved through this solution.

[0009] In a possible implementation manner of the first aspect, if there is no historical Internet access configuration information of dynamic network configuration information in the electronic device, generating static network configuration information according to the dynamic network configuration information includes: obtaining the dynamic Internet Protocol (IP) address and service information in the dynamic network configuration information; determining the static IP address based on the dynamic IP address, determining the primary Domain Name System (DNS) server address in the static network configuration information based on the primary DNS server address in the service information, and determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the service information; making a static network connection based on the static network configuration information includes: making a static network connection through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information.

[0010] Based on the above implementation method, in the case where there is no historical Internet access configuration information of dynamic network configuration information in the electronic device, the dynamic IP address in the dynamic network configuration information can be obtained, and the static IP address can be determined according to the dynamic IP address. The service information in the dynamic network configuration information is obtained, and the primary DNS server address in the static network configuration information is determined according to the primary DNS server address in the service information, and the secondary DNS server address in the static network configuration information is determined according to the secondary DNS server address in the service information. A static network connection is made through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information, so that information can be transmitted to the router using the correct IP address in the form of a static network connection.

[0011] In a possible implementation of the first aspect, if there is historical Internet access configuration information of dynamic network configuration information in the electronic device, generating static network configuration information according to the dynamic network configuration information includes: obtaining the dynamic Internet Protocol (IP) address in the dynamic network configuration information; determining the static IP address based on the dynamic IP address, determining the primary DNS server address in the static network configuration information based on the primary Domain Name System (DNS) server address in the historical Internet access configuration information, and determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the historical Internet access configuration information; making a static network connection based on the static network configuration information, including: making a static network connection through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information.

[0012] Based on the above implementation method, in the case where there is historical Internet access configuration information of dynamic network configuration information in the electronic device, the dynamic IP address in the dynamic network configuration information can be obtained, and the static IP address can be determined according to the dynamic IP address. The primary DNS server address in the static network configuration information is determined according to the primary DNS server address in the historical Internet access configuration information, and the secondary DNS server address in the static network configuration information is determined according to the secondary DNS server address in the historical Internet access configuration information. A static network connection is made through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information, so that information can be transmitted to the router using the correct IP address in the form of a static network connection.

[0013] In a possible implementation of the first aspect, in the case where there is no historical Internet access configuration information of dynamic network configuration information in the electronic device, the network connection method further includes: setting the subnet mask in the static network configuration information according to the default subnet mask; the performing a static network connection through the static network configuration information includes: performing a static network connection through the static IP address, the primary DNS server address in the static network configuration information, the secondary DNS server address in the static network configuration information, and the subnet mask in the static network configuration information.

[0014] Based on the above implementation, in the case where there is no historical Internet access configuration information of dynamic network configuration information in the electronic device, a static network connection can be performed through the default subnet mask.

[0015] In a possible implementation of the first aspect, if there are multiple second DHCP response messages, the static network connection steps are performed one by one on the multiple second DHCP response messages until the static network connection is successful or the static network connection through the multiple second DHCP response messages fails. The static network connection steps include: obtaining the dynamic network configuration information in the second DHCP response message; generating static network configuration information according to the dynamic network configuration information; performing a static network connection through the static network configuration information.

[0016] Based on the above implementation, in the case where there are multiple second DHCP response messages, the dynamic network configuration information of one second DHCP response message can be selected first, and the dynamic network configuration information of this second DHCP response message is used to generate static network configuration information for performing a static network connection. If the static network connection is not successful, other second DHCP response messages are selected for static network connection until the static network connection is successful or the static network connection through the dynamic network configuration information of the multiple second DHCP response messages fails. In this way, in the case where there are multiple second DHCP response messages, connection attempts can be made one by one to find the second DHCP response message that can successfully perform a network connection using the method provided in this application.

[0017] In a possible implementation of the first aspect, if the multiple second DHCP response messages include a third DHCP response message, the static network connection steps are performed based on the third DHCP response message;

[0018] wherein, the electronic device includes the network connection history corresponding to the IP address in the third DHCP response message.

[0019] Based on the above implementation method, when the third DHCP response message is included in multiple second DHCP response messages, since the electronic device includes the network connection history corresponding to the IP address in the third DHCP response message, the probability that the IP address in the third DHCP response message is the correct IP address is relatively high. Therefore, in this case, the third DHCP response message is preferentially selected, and then the network connection is performed according to the static network connection steps, and the network connection can be established relatively quickly.

[0020] In a possible implementation manner of the first aspect, the following method is used to determine that the third DHCP response message is included in multiple second DHCP response messages: obtain the IP address in the second DHCP response message; if there is a network connection record corresponding to the IP address in the network connection history, determine that the third DHCP response message is included in multiple second DHCP response messages.

[0021] Based on the above implementation method, the network connection history saved in the electronic device can be used to determine that the third DHCP response message is included in the second DHCP response message, so as to determine the third DHCP response message relatively quickly and accurately.

[0022] In a possible implementation manner of the first aspect, after the network connection is performed based on the static network configuration information, the method further includes: determining that the current state is that the Address Resolution Protocol (ARP) is reachable but network communication cannot be performed; setting the network connection mode to the DHCP mode; disconnecting the network connection and reconnecting the network.

[0023] Based on the above implementation method, after the network connection is performed based on the static network configuration information, if the current state is that the Address Resolution Protocol (ARP) is reachable but network communication cannot be performed, it may be that the static IP address is repeated with the IP address of other electronic devices. In this case, disconnecting the network connection and reconnecting the network can quickly solve the network connection problem.

[0024] In a possible implementation manner of the first aspect, after the static network connection is performed based on the static network configuration information, the method further includes: if the network connection fails, setting the network connection mode to the DHCP mode; within a set duration, not setting the network connection mode to the static mode.

[0025] Based on the above implementation method, in the case of a failure of the static network connection, within a set duration, the network connection mode is not set to the static mode, which reduces the situation that the IP address used for the static network connection is an IP address that cannot perform network connection and affects the network connection.

[0026] In a second aspect, the present application provides an electronic device, which includes a display screen, a memory, and one or more processors; the display screen and the memory are coupled to the processor; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device is caused to execute the network connection method provided in the first aspect and any possible design thereof.

[0027] In a third aspect, the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions run on an electronic device, the electronic device is caused to execute the network connection method provided in the first aspect and any possible design thereof.

[0028] In a fourth aspect, the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device is caused to execute the network connection method provided in the first aspect and any possible design thereof.

[0029] It can be understood that for the beneficial effects that can be achieved by the technical solutions provided in the second to fourth aspects above, reference can be made to the beneficial effects in the first aspect and any possible design thereof, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 FIG. is a schematic diagram of a network connection environment provided by an embodiment of the present application;

[0031] Figure 2 FIG. is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;

[0032] Figure 3 FIG. is a schematic diagram of a hierarchical architecture of a software system of an electronic device provided by an embodiment of the present application;

[0033] Figure 4 FIG. is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;

[0034] Figure 5 FIG. is a flowchart of a network connection method provided by an embodiment of the present application;

[0035] Figure 6 FIG. is a flowchart of a network self-healing method provided by an embodiment of the present application;

[0036] Figure 7 FIG. is a flowchart of another network self-healing method provided by an embodiment of the present application;

[0037] Figure 8 FIG. is a flowchart of another network connection method provided by an embodiment of the present application;

[0038] Figure 9 Flow chart of another network connection method provided by an embodiment of the present application;

[0039] Figure 10 Structural schematic diagram of a multi-device collaboration device provided by an embodiment of the present application. Detailed implementation manners

[0040] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above-mentioned", "said", and "this" are also intended to include the plural forms, unless clearly indicated to the contrary in the context. It should also be understood that " / " means "or", for example, A / B may mean A or B; "and / or" in the text is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B may mean: A exists alone, A and B exist simultaneously, and B exists alone. These three situations.

[0041] Referring to "embodiment" in the present application means that the specific features, structures or characteristics described in combination with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.

[0042] The terms "first" and "second" in the following embodiments of the present application are only for descriptive purposes, and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.

[0043] For the convenience of explaining the technical solutions of the application, some concepts related to the present application will be described first below.

[0044] Router: A router is a network device used to connect multiple computers, mobile devices or other network devices and transfer data between them. It plays a role of connecting and forwarding data in the network, enabling different devices to communicate with each other and access the Internet.

[0045] Routers identify and locate different devices by using IP addresses and determine the best path and destination of data packets according to network rules (such as routing tables). It can send data packets from one network to another and perform functions such as Network Address Translation (NAT) to achieve network connection sharing and security.

[0046] In addition to providing network connection and data forwarding functions, routers can also provide other functions, such as wireless local area network (Wi-Fi) access points, firewalls, virtual private network (VPN) support, etc. Different types of routers have different functions and performance characteristics, and suitable routers can be selected according to specific needs.

[0047] All in all, routers are key devices that connect multiple devices and forward data in a network. They allow devices to communicate with each other and connect to the Internet, providing connectivity and functionality to the network.

[0048] IP address (Internet Protocol Address): An IP address is a digital address used to identify and locate a computer or other network device. It is the basis for Internet communication and allows data exchange and communication between different devices.

[0049] An IP address is represented by 32 bits (IPv4) or 128 bits (IPv6) of binary digits. For the convenience of people to use and remember, IP addresses are usually presented in the form of four decimal numbers (IPv4) or eight groups of hexadecimal numbers (IPv6), separated by dots (IPv4) or colons (IPv6) between groups. For example, the typical format of an IPv4 address is similar to the form of "192.168.0.1", while the typical format of an IPv6 address is similar to the form of "2001:0db8:85a3:0000:0000:8a2e:0370:7334".

[0050] IP addresses are divided into public IP addresses and private IP addresses. Public IP addresses are globally unique and are used for communication on the Internet. Private IP addresses are used in internal networks, such as home networks or enterprise internal networks, and they are not directly visible on the Internet.

[0051] IP addresses play a very important role in network communication. They are used for routing data packets, addressing, and locating devices, etc. By sending data packets to the target IP address, a computer or other network device can communicate on the Internet.

[0052] The MAC address (Media Access Control Address) of a router is a unique hardware address used to identify the network card on the router. The MAC address is a 48-bit binary number, usually represented as 6 groups of hexadecimal numbers separated by colons. For example, a typical MAC address might look like this: 00:11:22:33:44:55.

[0053] In a network, each device has its own MAC address, which is used for addressing and identifying other devices within the local area network. When a data packet is sent from one device to another, the MAC address of the destination device is usually used to deliver the data packet to the correct destination.

[0054] A router is a device that can connect multiple computers or other network devices and connect them to the Internet. A router usually has at least two network cards, one connected to the Internet and the other connected to the local area network. Each network card has its own MAC address to identify the device where the network card is located. Therefore, each network card on the router has its own unique MAC address for addressing and identifying other devices in the network.

[0055] Subnet mask: A subnet mask is a bit mask used to indicate which bits of an IP address identify the subnet where the host is located and which bits identify the host. The subnet mask cannot exist alone and must be used in combination with an IP address. The only function of the subnet mask is to divide a certain IP address into a network address and a host address.

[0056] Domain Name System (DNS), a distributed database on the Internet that maps domain names to IP addresses, enables users to access the Internet more conveniently without having to remember the IP strings that can be directly read by electronic devices. The process of finally obtaining the IP address corresponding to the host name through the host name is called domain name resolution (or host name resolution).

[0057] When a computer is configured with two DNSs, it means that it can use two different DNS servers to resolve domain names simultaneously. DNS is a system that converts domain names into IP addresses, allowing us to access websites through memorable domain names instead of remembering complex IP addresses.

[0058] Static Network Configuration: In static network configuration, network parameters (such as IP address, subnet mask, default gateway, DNS server, etc.) are configured for electronic devices.

[0059] The IP address of the electronic device is fixed and will not change automatically.

[0060] Dynamic Network Configuration: In dynamic network configuration, network parameters are dynamically assigned through the Dynamic Host Configuration Protocol (DHCP).

[0061] When an electronic device connects to a network, it sends a request to the router to obtain network configuration information. The router assigns an available IP address and other necessary network configuration information to the electronic device.

[0062] The following details the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.

[0063] In traditional network connections, for a situation where there are multiple routers in the same local area network as shown in Figure 1 When there are multiple routers in the same local area network as shown, the electronic device will first connect to the MAC address of one router. After connecting to the MAC address, the electronic device broadcasts a DHCP request. After the DHCP request is received by multiple routers within the local area network, the multiple routers send DHCP response messages to the electronic device. Then, the electronic device selects a DHCP response message to configure network information. However, the DHCP response message selected by the electronic device may not be the one sent by the router it is connected to, which results in the inability to correspond the IP address with the MAC address of the connected router when the electronic device configures network information based on the DHCP response message. Since the IP address and MAC address need to correspond for the router to receive the information data sent by the electronic device, this causes the information data sent by the electronic device not to be successfully sent to the router it is connected to, and the electronic device will experience a network connection failure. To solve this problem, the present application provides a network connection method to increase the probability of successful network connection of the electronic device in the case of multiple routers in the same local area network.

[0064] The technical solution provided by this application can be applied to an electronic device with an image display function. In some embodiments, the electronic device may be a mobile phone, a tablet computer, a handheld computer, a personal computer (PC), an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, and / or a smart city device, etc. The specific type of the electronic device is not particularly limited in the embodiments of this application.

[0065] Figure 2 FIG. shows a schematic structural diagram of an electronic device provided by an embodiment of this application.

[0066] Referring to Figure 2 As shown, the electronic 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, a headphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a display screen 193, a subscriber identification module (SIM) card interface 194, and a camera 195, etc. Among them, the sensor module 180 may include a pressure sensor, a gyroscope sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0067] 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 processing unit (GPU), 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.

[0068] The controller may be the nerve center and command center of the electronic device. The controller may generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0069] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0070] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.

[0071] The charging management module 140 is used to receive a charging input from a power supply device (such as a charger, laptop power supply, etc.). Among them, the charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 can receive the charging input of the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 can receive the wireless charging input through the wireless charging coil of the electronic device.

[0072] While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141. Among them, the battery 142 can specifically be composed of multiple batteries connected in series. The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110.

[0073] 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 the 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 193, the camera 195, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as the voltage, current, battery cycle count, and battery health status (leakage, impedance) of the battery. In some other embodiments, the power management module 141 can also be disposed in the processor 110.

[0074] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external non-volatile memory.

[0075] The internal memory 121 can include one or more random access memories (RAM) and one or more non-volatile memories (NVM). The random access memory can be directly read and written by the processor 110 and can be used to store the operating system or the executable programs of other running programs (such as machine instructions), and can also be used to store the data of users and application programs, etc. The non-volatile memory can also store executable programs and store the data of users and application programs, etc., and can be pre-loaded into the random access memory for the processor 110 to directly read and write. In the embodiments of the present application, a diffusion model can be stored in the internal memory 121. The internal memory 121 can also store a related model capable of converting an image into a noise image and a text identifier, or can also store the noise images and text identifiers corresponding to multiple images.

[0076] A touch sensor, also known as a "touch control device". The touch sensor can be disposed on the display screen 193, and the touch sensor and the display screen 193 form a touch screen, also known as a "touch control screen". The touch sensor is used to monitor touch operations acting thereon or nearby. The touch sensor can transmit the monitored 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 193. In some other embodiments, the touch sensor can also be disposed on the surface of the electronic device, at a different position from the display screen 193.

[0077] The pressure sensor is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor can be disposed on the display screen 193. There are many types of pressure sensors, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. When a touch operation acts on the display screen 193, the electronic device monitors the intensity of the touch operation according to the pressure sensor. The electronic device can also calculate the position of the touch according to the monitoring signal of the pressure sensor. In some embodiments, touch operations with the same touch position but different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, the instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.

[0078] In some embodiments, the electronic device can include one or N cameras 195, where N is a positive integer greater than 1. In the embodiments of the present application, the types of the cameras 195 can be distinguished according to the hardware configuration and the physical position. For example, the camera disposed on the side of the display screen 193 of the electronic device can be called a front camera, and the camera disposed on the back cover of the electronic device can be called a rear camera; for another example, a camera with a short focal length and a large viewing angle can be called a wide-angle camera, and a camera with a long focal length and a small viewing angle can be called a normal camera. Among them, the length of the focal length and the size of the viewing angle are relative concepts and there are no specific parameter limitations. Therefore, the wide-angle camera and the normal camera are also relative concepts, and can be specifically distinguished according to physical parameters such as the focal length and the viewing angle.

[0079] The electronic device realizes the display function through the GPU, the display screen 193, and the application processor, etc. The GPU is a microprocessor for image editing, connected to the display screen 193 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.

[0080] An electronic device can implement a shooting function through an ISP, a camera 195, a video codec, a GPU, a display screen 193, an application processor, etc. 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. In the embodiments of the present application, during the frame drawing process of each image frame, the functions of the GPU are used to make the finally displayed picture obtain better display effects and performance.

[0081] The ISP is used to process the data fed back by the camera 195. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element, where the optical signal is converted into an electrical signal. The camera's photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also optimize the noise and brightness of the image through algorithms. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 195. The camera 195 is used to capture static images or videos.

[0082] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0083] The display screen 193 is used to display images, videos, etc. The display screen 193 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a Microled, a Micro-oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N display screens 193, where N is a positive integer greater than 1.

[0084] In the embodiments of the present application, the display screen 193 can be used to display the interface of the electronic device (such as the desktop, the lock screen interface, etc.) and display images (such as wallpapers, photos, etc.) stored in the electronic device or images captured by any one or more cameras 195 in this interface.

[0085] The wireless communication function of the electronic device can be implemented by Antenna 1, Antenna 2, Mobile Communication Module 150, Wireless Communication Module 160, modem, baseband processor, etc.

[0086] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas.

[0087] Mobile Communication Module 150 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device. Mobile Communication Module 150 can receive electromagnetic waves through Antenna 1, and perform processing such as filtering and amplifying the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. Mobile Communication Module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through Antenna 1 and radiate it out. In some embodiments, at least some functional modules of Mobile Communication Module 150 can be disposed in Processor 110. In some embodiments, at least some functional modules of Mobile Communication Module 150 and at least some modules of Processor 110 can be disposed in the same device.

[0088] The modulation and demodulation processor can include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to Speaker 170A, Receiver 170B, etc.), or displays an image or video through Display Screen 193. In some embodiments, the modulation and demodulation processor can be an independent device. In other embodiments, the modulation and demodulation processor can be independent of Processor 110 and be disposed in the same device as Mobile Communication Module 150 or other functional modules.

[0089] The wireless communication module 160 may provide solutions for wireless communications applied to an electronic device, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.

[0090] The SIM card interface 194 is used to connect to a SIM card. The SIM card can be inserted into or removed from the SIM card interface 194 to achieve contact and separation from the electronic device. The electronic device may support one or more SIM card interfaces. The SIM card interface 194 may support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 194 simultaneously. The SIM card interface 194 may also be compatible with external memory cards. The electronic device interacts with the network through the SIM card to implement functions such as calls and data communication. One SIM card corresponds to one user number.

[0091] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are only illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods or combinations of multiple interface connection methods in the above embodiments.

[0092] Of course, it can be understood that the above Figure 2 is only an exemplary illustration when the form of the electronic device is a mobile phone. When the electronic device is in other form factors such as a tablet computer, a handheld computer, a PC, a PDA, a wearable device (such as a smart watch, a smart bracelet), etc., the structure of the electronic device may include fewer structures than those Figure 1 shown, or may include more structures than those Figure 1 shown, which is not limited herein.

[0093] It can be understood that, generally speaking, the implementation of the functions of an electronic device requires not only the support of hardware but also the cooperation of software. The software system of an electronic device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of this application, taking the system as an example, the software structure of the electronic device is exemplarily described.

[0094] Figure 3 This is a schematic diagram of the layered architecture of the software system of the electronic device provided by the embodiments of this application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The communication between layers is through software interfaces (such as APIs).

[0095] In some examples, as shown in Figure 3 In the embodiments of this application, the software of the electronic device is divided into five layers, from top to bottom are the application layer, the framework layer (or called the application framework layer), the system library and Android runtime, the HAL layer (hardware abstraction layer), and the driver layer (or called the kernel layer). Among them, the system library and Android runtime can also be called the native framework layer or the native layer.

[0096] Among them, the application layer can include a series of applications. As shown in Figure 3 The application layer can include applications such as cameras, galleries, calendars, maps, WLAN, Bluetooth, music, videos, text messages, calls, navigation, instant messaging, wallpapers, etc. (application, APP).

[0097] The framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions or services. For example, the application framework layer can include an activity manager, a window manager, a content provider, an audio service, a view system, a phone manager, a resource manager, a notification manager, a package manager, a data analysis module, a self-healing module, etc., and the embodiments of this application do not make any restrictions on this.

[0098] Among them, the data analysis module is used to confirm whether self-healing needs to be performed through the self-healing module currently according to the network connection status and the number of received DHCP response messages.

[0099] The self-healing module is used to execute the self-healing process and perform self-healing operations on the network connection when receiving the self-healing trigger instruction from the data analysis module.

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

[0101] The content provider is used to store and obtain data, and make this data accessible to application programs. This data can include videos, images, audio, dialed and received calls, browsing history and bookmarks, phone books, etc.

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

[0103] The phone manager is used to provide the communication function of the electronic device. For example, the phone manager can manage the call status of the call application (including initiation, connection, hang-up, etc.).

[0104] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, etc.

[0105] The notification manager enables application programs to display notification information in the status bar. It can be used to convey notification-type messages, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, 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 the notification of a background-running application program, and can also be a notification that appears on the screen in the form of a dialogue window. For example, it can prompt text information in the status bar, emit a prompt sound, vibrate the electronic device, blink the indicator light, etc.

[0106] The package manager is used in the system to manage application program packages. It allows application programs to obtain detailed information about installed applications and their services, permissions, etc. The package manager is also used to manage events such as the installation, uninstallation, and upgrade of application programs.

[0107] The system library can include multiple functional modules. For example: the surface manager, Media Libraries, OpenGL ES, SGL, etc. The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The Media Libraries support the playback and recording of multiple common audio and video formats, as well as static image files, etc. The Media Libraries can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES is used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc. SGL is a drawing engine for 2D drawing. The android runtime includes a core library and the ART virtual machine. The android runtime is responsible for the scheduling and management of the Android system. The core library consists of two parts: one part is the functional functions that the Java language needs to call, and the other part is the core library of Android. The application layer and the application framework layer run in the ART virtual machine. The ART virtual machine executes the Java files of the application layer and the application framework layer as binary files. The ART virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0108] The HAL layer is an interface layer located between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable across multiple platforms. The HAL layer provides a standard interface to display the device hardware functions to a higher-level Java API framework (i.e., the framework layer). The HAL layer contains multiple library modules, and each module implements an interface for a specific type of hardware component, such as: the audio HAL audio module, the bluetooth HAL bluetooth module, the camera HAL camera module (which can also be called the camera HAL or the camera hardware abstraction module), the sensors HAL sensor module (or called the Isensor service, the sensor service).

[0109] The kernel layer is the layer between the hardware and the software. The kernel layer includes at least a display driver, a camera driver, an audio driver, a sensor driver, a battery driver, a WiFi driver, etc., which are not limited in this application. Among them, the sensor driver can specifically include the drivers for each sensor included in the electronic device, such as an ambient light sensor driver, etc. Exemplarily, the ambient light sensor driver can send the detection data of the ambient light sensor to the sensing module in a timely manner in response to an indication or instruction from the sensor module to obtain detection data. The WiFi driver includes a monitoring module and a network connection module.

[0110] The monitoring module is used to monitor DHCP response messages.

[0111] The network connection module is used to perform dynamic network connection or static network connection.

[0112] The technical solutions provided in the embodiments of the present application can all be implemented in an electronic device having the above hardware architecture or software architecture.

[0113] In the embodiments of the present application, the WiFi driver and the framework layer in the electronic device are mainly used. For example, Figure 4 As shown, the WiFi driver includes a monitoring module and a network connection module. The framework layer includes a data analysis module and a self-healing module. The monitoring module sends data to the network connection module and the data analysis module. The data analysis module sends data to the self-healing module. The self-healing module sends data to the network connection module.

[0114] For the case where there are two routers in the target local area network. The method flow of the embodiments of the present application is as Figure 5 shown, and the method flow mainly includes the following steps:

[0115] S501. The monitoring module monitors DHCP response messages.

[0116] DHCP network connection is also called dynamic network connection. During the DHCP network connection process, the following operations need to be performed:

[0117] DHCP discovery: When an electronic device wants to connect to a network, it sends a DHCP discovery broadcast message to find available routers in the target local area network.

[0118] DHCP offer: Among multiple available routers in the target local area network, after receiving the DHCP discovery message, they will send a DHCP offer message to the electronic device. The DHCP offer message includes the MAC address of the router.

[0119] DHCP request: After receiving the DHCP offer message, the electronic device will select one of the routers to connect, record the MAC address of this router, and broadcast a DHCP request message.

[0120] DHCP response: After receiving the DHCP request message of the device, the router in the target local area network will send a DHCP response message to the electronic device, which includes the dynamic IP address and service information assigned to the electronic device. The service information includes the primary DNS server address and the secondary DNS server address.

[0121] IP address allocation: After the electronic device receives the DHCP response message, it will select a DHCP response message, apply the dynamic IP address and service information in the selected DHCP response message to its own network settings, and start using these configurations for dynamic network connection.

[0122] In the embodiment of the present application, the monitoring module is used to monitor the DHCP response message.

[0123] S502. The monitoring module sends the DHCP response message to the network connection module.

[0124] S503. The monitoring module sends the DHCP response message to the data analysis module.

[0125] S504. The network connection module makes a network connection according to the DHCP response message.

[0126] The network connection module makes a network connection according to the DHCP response message, needs to obtain the dynamic IP address and service information in the DHCP response message, performs network connection configuration according to the dynamic IP address and service information, and uses the dynamic IP address to communicate with the connected router.

[0127] S505. The network connection module sends the network connection status information to the data analysis module.

[0128] The network connection status information can be network connection success information or network connection failure information.

[0129] The network connection module can judge whether the network connection is successful by whether the data can be successfully sent to the router.

[0130] S506. The data analysis module judges whether there are multiple DHCP response messages and the network connection fails currently. If there are multiple DHCP response messages and the network connection fails currently, execute S507, otherwise the process ends.

[0131] S507. The data analysis module sends a self-healing start instruction to the self-healing module.

[0132] S508. The self-healing module generates static network configuration information.

[0133] Among them, the static network configuration information includes a static IP address, a subnet mask, a primary DNS server address, and a secondary DNS service address.

[0134] In some embodiments, the self-healing module generates static network configuration information, which can be executed according to the Figure 6 shown process.

[0135] S601. The self-healing module obtains a second DHCP response message different from the first DHCP response message currently used for network connection.

[0136] S602. The self-healing module obtains the dynamic network configuration information in the second DHCP response message.

[0137] The dynamic network configuration information in the second DHCP response message includes a dynamic IP address, a primary DNS server address, and a secondary DNS server address. The dynamic IP is the IP address assigned by the router to the electronic device, and the dynamic IP address corresponds to the MAC address of the router.

[0138] S603. The self-healing module sets the static IP address in the static network configuration information to the dynamic IP address in the dynamic network configuration information.

[0139] Exemplarily, if the dynamic IP address in the dynamic network configuration information of the second DHCP response message is 192.168.0.1, the static IP address in the static network configuration information is set to 192.168.0.1.

[0140] S604. The self-healing module determines whether there is historical Internet access configuration information of the second DHCP response message.

[0141] In some embodiments, the self-healing module can determine whether there is historical Internet access configuration information of the second DHCP response message based on the dynamic IP address in the second DHCP response message. If the Internet access connection history of the electronic device includes the Internet access configuration information corresponding to the dynamic IP address in the second DHCP response message, it is determined that there is historical Internet access configuration information of the second DHCP response message, and step S608 is executed. If the Internet access connection history of the electronic device does not include the Internet access configuration information corresponding to the dynamic IP address in the second DHCP response message, it is determined that there is no historical Internet access configuration information of the second DHCP response message, and step S605 is executed.

[0142] S605. When the self-healing module determines that there is no historical Internet access configuration information of the second DHCP response message. The subnet mask in the static network configuration information is set to the default subnet mask. Step S606 is executed.

[0143] Exemplarily, if the default subnet mask is 255.255.255.0 ( / 24), the subnet mask in the static network configuration information is set to 255.255.255.0 ( / 24).

[0144] S606. The self-healing module sets the primary DNS server address in the static network configuration information to the primary DNS server address in the dynamic network configuration information. Step S607 is executed.

[0145] For example, if the primary DNS server address in the dynamic network configuration information is 8.8.8.8, then set the primary DNS server address in the static network configuration information to 8.8.8.8.

[0146] S607. The self-healing module sets the secondary DNS server address in the static network configuration information to the secondary DNS server address in the dynamic network configuration information. Execute step S509.

[0147] For example, if the secondary DNS server address in the dynamic network configuration information is 8.8.4.4, then set the secondary DNS server address in the static network configuration information to 8.8.4.4.

[0148] Those skilled in the art can set the execution order of S605 to S607 according to actual needs, and this application does not limit this.

[0149] S608. When the self-healing module determines that there is historical Internet access configuration information with a second DHCP response message, set the subnet mask in the static network configuration information to the subnet mask in the historical Internet access configuration information. Execute step S609.

[0150] For example, if the subnet mask in the historical Internet access configuration information is 255.255.255.0 ( / 24), then set the subnet mask in the static network configuration information to 255.255.255.0 ( / 24).

[0151] S609. The self-healing module sets the primary DNS server in the static network configuration information to the primary DNS server in the historical Internet access configuration information. Execute step S610.

[0152] For example, if the primary DNS server address in the historical Internet access configuration information is 8.8.8.8, then set the primary DNS server address in the static network configuration information to 8.8.8.8.

[0153] In some embodiments, S609 can also be that the self-healing module sets the primary DNS server in the static network configuration information to the primary DNS server in the dynamic network configuration information.

[0154] S610. The self-healing module sets the secondary DNS server in the static network configuration information to the secondary DNS server in the historical Internet access configuration information. Execute step S509.

[0155] For example, if the secondary DNS server address in the historical Internet access configuration information is 8.8.4.4, then set the secondary DNS server address in the static network configuration information to 8.8.4.4.

[0156] In some embodiments, S610 may also be that the self-healing module sets the standby DNS server address in the static network configuration information as the standby DNS server address in the dynamic network configuration information.

[0157] S509. The self-healing module sends the static network configuration information to the network connection module.

[0158] S510. The network connection module makes a static network connection according to the static network configuration information.

[0159] The process of the static network connection includes:

[0160] Sending a connection request: The electronic device sends a connection request to the connected router. The connection request usually contains the static network configuration information.

[0161] Confirming the connection request: When the connected router receives the connection request, it will send an acknowledgment signal to the electronic device, indicating that it is ready to establish a connection.

[0162] Establishing a connection: After receiving the acknowledgment signal, a connection will be established between the electronic device and the router. At this time, data can be transmitted between them.

[0163] Data transmission: Through the established connection, the electronic device can send data to the router, and the router can also send data to the electronic device.

[0164] S511. The network connection module determines whether the static network connection is successful. If the static network connection is successful, the process ends; if the static network connection fails, S512 is executed.

[0165] The network connection module can determine whether the static network connection is successful by whether data can be successfully sent to the router.

[0166] S512. The network connection module does not make a network connection through the static mode within the set duration.

[0167] The set duration can be from half an hour to 1.5 hours. In some embodiments, the set duration can be one hour.

[0168] Based on the above implementation, in the case of a failed static network connection, within the set duration, the network connection mode is not set to the static mode, reducing the situation where the IP address used for the static network connection is an IP address that cannot make a network connection, which affects the network connection.

[0169] For the case where there are more than two routers in the target local area network. In the case of a failed network connection. The network connection module sends the network connection failure information to the self-healing module through step S505, such as Figure 7As shown, the self-healing module performs the following steps:

[0170] S701. The self-healing module determines whether there is a second DHCP response message for which the self-healing process has not been executed. If there is a second DHCP response message for which the self-healing process has not been executed, step S702 is executed. If there is no second DHCP response message for which the self-healing process has not been executed, step S512 is executed.

[0171] S702. When there is a second DHCP response message for which the self-healing process has not been executed, the self-healing module determines whether there is a third DHCP response message in the second DHCP response message for which the self-healing process has not been executed. When there is a third DHCP response message in the second DHCP response message for which the self-healing process has not been executed, step S703 is executed. When there is no third DHCP response message in the second DHCP response message for which the self-healing process has not been executed, step S704 is executed.

[0172] Among them, the electronic device includes the network connection history corresponding to the IP address in the third DHCP response message. The self-healing module can determine that the third DHCP response message is included in multiple second DHCP response messages in the following way: obtain the IP address in the second DHCP response message; if there is a network connection record corresponding to the IP address in the second DHCP response message in the network connection history record, it is determined that the third DHCP response message is included in multiple second DHCP response messages.

[0173] S703. When there is a third DHCP response message in the second DHCP response message for which the self-healing process has not been executed, the self-healing module selects a third DHCP response message to execute the self-healing process.

[0174] S704. When there is no third DHCP response message in the second DHCP response message for which the self-healing process has not been executed, the self-healing module selects a second DHCP response message for which the self-healing process has not been executed to execute the self-healing process.

[0175] Among them, the self-healing process includes steps S602 to S610, and steps S509 and S510.

[0176] After S510 is executed, step S705 is executed.

[0177] S705. The network connection module determines whether the static network connection is successful. When the static network connection is successful, the process ends. When the static network connection fails, step S701 is executed.

[0178] As Figure 8 shown, if the network connection module detects that the current state is ARP reachable but unable to access the Internet, step S801 is executed.

[0179] S801. The network connection module determines whether the current network connection is made through a static IP address. If the network connection is made through a static IP address, proceed to step S802; if the network connection is not made through a static IP address, the process ends.

[0180] S802. If the current network connection is made through a static IP, the network connection module determines whether the network connection is made using the static IP address sent by the self-healing module.

[0181] If the network connection is made using the static IP address sent by the self-healing module, execute step S803.

[0182] If the network connection is not made using the static IP address sent by the self-healing module, the process ends.

[0183] S803. The network connection module disconnects the network connection and does not perform network connection through the static mode within a set duration.

[0184] The set duration can be from half an hour to one and a half hours. In some embodiments, the set duration can be one hour.

[0185] As Figure 9 shown, the present application also provides a network connection method. The method is applied to an electronic device. The electronic device establishes a connection with a router in a target local area network. There are multiple routers in the target local area network. The method includes:

[0186] S901. The electronic device receives DHCP response messages sent by multiple routers in the target local area network.

[0187] Among them, receiving the DHCP response messages sent by multiple routers in the target local area network may mean receiving the DHCP response messages sent by all routers in the target local area network, or receiving the DHCP response messages sent by some routers in the target local area network.

[0188] S901 can be executed with reference to step 501.

[0189] S902. The electronic device selects a first DHCP response message from the DHCP response messages sent by multiple routers for network connection.

[0190] S902 can be executed with reference to step S504.

[0191] S903. If the network connection fails through the first DHCP response message, the electronic device selects a second DHCP response message different from the first DHCP response message from the DHCP response messages sent by multiple routers.

[0192] S903 can be executed with reference to step S601.

[0193] S904. The electronic device obtains the dynamic network configuration information in the second DHCP response message, and generates static network configuration information based on the dynamic network configuration information.

[0194] S904 can be executed with reference to steps S602 to S610.

[0195] If there is no historical Internet access configuration information of the dynamic network configuration information in the electronic device, generating static network configuration information based on the dynamic network configuration information includes: obtaining the IP address and service information in the dynamic network configuration information; determining the static IP address based on the dynamic IP address, determining the primary DNS server address in the static network configuration information based on the primary DNS server address in the service information, and determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the service information. In some embodiments, when there is no historical Internet access configuration information of the dynamic network configuration information in the electronic device, the network connection method further includes: setting the subnet mask in the static network configuration information according to the default subnet mask.

[0196] Based on the above implementation, a static network connection can be made through the default subnet mask when there is no historical Internet access configuration information of the dynamic network configuration information in the electronic device. When there is no historical Internet access configuration information of the dynamic network configuration information in the electronic device, the dynamic IP address in the dynamic network configuration information can be obtained, and the static IP address can be determined according to the dynamic IP address. Obtain the service information in the dynamic network configuration information, determine the primary DNS server address in the static network configuration information according to the primary DNS server address in the service information, and determine the secondary DNS server address in the static network configuration information according to the secondary DNS server address in the service information. A static network connection is made through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information, so that information can be transmitted to the router using the correct IP address in the form of a static network connection.

[0197] If there is historical Internet access configuration information of dynamic network configuration information in the electronic device, generate static network configuration information according to the dynamic network configuration information, including: obtaining the dynamic Internet Protocol (IP) address in the dynamic network configuration information, determining the static IP address based on the dynamic IP address, determining the primary Domain Name System (DNS) server address in the static network configuration information based on the primary DNS server address in the historical Internet access configuration information, determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the historical Internet access configuration information, and determining the subnet mask in the static network configuration information based on the subnet mask in the historical Internet access configuration information.

[0198] Based on the above implementation, when there is historical Internet access configuration information of dynamic network configuration information in the electronic device, the dynamic IP address in the dynamic network configuration information can be obtained, and the static IP address can be determined according to the dynamic IP address. Determine the primary DNS server address in the static network configuration information according to the primary DNS server address in the historical Internet access configuration information, and determine the secondary DNS server address in the static network configuration information according to the secondary DNS server address in the historical Internet access configuration information. Perform a static network connection through the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information, so that information can be transmitted with the router using the correct IP address in the way of static network connection.

[0199] In some embodiments, if there are multiple second DHCP response messages, perform the static network connection steps for each of the multiple second DHCP response messages one by one until the static network connection is successful or the static network connection fails for all the multiple second DHCP response messages. The static network connection steps include: obtaining the dynamic network configuration information in the second DHCP response message; generating static network configuration information according to the dynamic network configuration information; and performing a static network connection through the static network configuration information. In some embodiments, this part can be executed with reference to steps S701 to S705.

[0200] Based on the above implementation manner, in the case of multiple second DHCP response messages, a dynamic network configuration information of a second DHCP response message can be selected first, and the dynamic network configuration information of this second DHCP response message can be used to generate static network configuration information for static network connection. If the static network connection fails, other second DHCP response messages can be selected for static network connection until the static network connection is successful or the static network connection fails through the dynamic network configuration information of multiple second DHCP response messages. In this way, in the case of multiple second DHCP response messages, connection attempts can be made one by one to find the second DHCP response message that can successfully establish a network connection using the method provided in this application.

[0201] In a possible implementation manner, if a third DHCP response message is included in multiple second DHCP response messages, the static network connection step is performed based on the third DHCP response message;

[0202] Among them, the electronic device includes a network connection history corresponding to the IP address in the third DHCP response message.

[0203] Based on the above implementation manner, in the case where a third DHCP response message is included in multiple second DHCP response messages, since the electronic device includes a network connection history corresponding to the IP address in the third DHCP response message, the probability that the IP address in the third DHCP response message is the correct IP address is relatively high. Therefore, in this case, the third DHCP response message is preferentially selected, and then the network connection is made according to the static network connection step, and the network connection can be established relatively quickly.

[0204] In a possible implementation manner of the first aspect, the following method is used to determine that a third DHCP response message is included in multiple second DHCP response messages: obtain the IP address in the second DHCP response message; if there is a network connection record corresponding to the IP address in the network connection history record, it is determined that a third DHCP response message is included in multiple second DHCP response messages.

[0205] Based on the above implementation manner, the network connection history saved in the electronic device can be used to determine that a third DHCP response message is included in the second DHCP response message, so as to determine the third DHCP response message more quickly and accurately.

[0206] S905. The electronic device performs a static network connection based on the static network configuration information.

[0207] S905 can be executed with reference to step S510.

[0208] Perform a static network connection based on static network configuration information, including: performing a static network connection through a static IP address, the primary DNS server address in the static network configuration information, the secondary DNS server address in the static network configuration information, and the subnet mask in the static network configuration information.

[0209] Based on the technical solution provided in the embodiments of the present application, when there are multiple routers in a local area network and the electronic device has already established a network connection with one router, after broadcasting and sending a DHCP request message, multiple DHCP response messages can be obtained. At this time, the electronic device selects one of the multiple DHCP response messages as the first DHCP response message, and uses the dynamic network configuration information in the first DHCP response message to perform a network connection. In the case where the network connection fails using the dynamic network configuration information in the first DHCP response message, a second DHCP response message different from the first DHCP response message can be selected from the multiple DHCP response messages, the dynamic network configuration information in the second DHCP response message can be obtained, and static network configuration information can be generated based on the dynamic network configuration information in the second DHCP response message, and a network connection can be performed based on the static network configuration information. Thus, when there are multiple routers in a local area network, in the case where the network connection fails through DHCP because the selected DHCP response message does not match the router, static network configuration information can be generated according to the dynamic network configuration information of the second DHCP response message different from the first DHCP response message received, and then the network connection can be achieved through the static network connection method. Thus, for the situation where the dynamic network configuration information cannot be changed even if the network connection fails after using DHCP for network connection, and only the router can be disconnected and reconnected, a solution for changing the dynamic network connection to a static network connection is provided, and the success rate of the network connection is improved through this solution.

[0210] In some embodiments, after performing a network connection based on static network configuration information, it further includes: determining that the current state is that the Address Resolution Protocol (ARP) is reachable but network communication cannot be performed; setting the network connection mode to the DHCP mode; disconnecting the network connection and reconnecting the network. In some embodiments, steps S801 to S803 can be referred to for execution.

[0211] Based on the above implementation, after performing a network connection based on static network configuration information, if the current state is that the Address Resolution Protocol (ARP) is reachable but network communication cannot be performed, it may be that the static IP address is repeated with the IP address of other electronic devices. In this case, disconnecting the network connection and reconnecting the network can quickly solve the network connection problem.

[0212] In some embodiments, after establishing a static network connection based on static network configuration information, the method further includes: if the network connection fails, setting the network connection mode to the DHCP mode; and within a set duration, not setting the network connection mode to the static mode.

[0213] Based on the above implementation, in the case of a failed static network connection, within a set duration, not setting the network connection mode to the static mode reduces the situation where the IP address used for the static network connection is an IP address that cannot establish a network connection, thus affecting the network connection.

[0214] It can be understood that, in order to implement the above functions, the above electronic device includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0215] Figure 10 This is a schematic structural diagram of a multi-device collaboration device provided by the embodiments of the present application. In one embodiment, an electronic device can achieve the corresponding functions through Figure 10 the hardware device shown. As Figure 10 shown, the multi-device collaboration device may include: a display screen 1001, a memory 1002, a processor 1003, and a communication module 1004. The above components can be connected through one or more communication buses 1005.

[0216] In one embodiment, the display screen 1001 may include a display panel 10011 and a touch sensor 10012. The display panel 10011 is used to display images. The touch sensor 10012 can transmit the detected touch operation to the application processor 1003 to determine the type of touch event and provide a visual output related to the touch operation through the display panel 10011. The processor 1003 may include one or more processing units. For example, the processor 1003 may include an application processor, a modem processor, a graphics processor, an image signal processor, a controller, a video codec, a digital signal processor, a baseband processor, and / or a neural network processor, etc. Among them, different processing units may be independent devices or integrated in one or more processors. The memory 1002 is coupled to the processor 1003 and is used to store various software programs and / or multiple sets of instructions. The memory 1002 may include volatile memory and / or non-volatile memory.

[0217] When the software programs and / or multiple sets of instructions in the memory 1002 are executed by the processor 1003, the method steps in the embodiments of the present application are executed.

[0218] The embodiments of the present application further provide an electronic device, which includes a display screen, a memory, and one or more processors; the display screen, the memory are coupled to the processor; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the network connection method provided in the first aspect and any possible design thereof.

[0219] The embodiments of the present application further provide a computer-readable storage medium, which includes computer instructions. When the computer instructions run on an electronic device, the electronic device executes the network connection method provided in the foregoing embodiments.

[0220] The embodiments of the present application further provide a computer program product, which includes executable instructions. When the computer program product runs on an electronic device, the electronic device executes the network connection method provided in the foregoing embodiments.

[0221] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and conciseness of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0222] In several embodiments provided by the present application, it should be understood that the disclosed apparatus / devices and methods can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling, direct coupling, or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the devices or units can be in electrical, mechanical, or other forms.

[0223] The units described as separate components may or may not be physically separated. The components displayed as units can be one physical unit or multiple physical units, that is, they can be located in one place, or they can be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0224] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0225] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, etc., which can store program codes.

[0226] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A network connection method, characterized in that, The method is applied to an electronic device, which establishes a connection with a router within a target local area network (LAN). There are multiple routers within the target LAN. The method includes: Receiving Dynamic Host Configuration Protocol (DHCP) response messages sent by multiple routers within the target LAN; Selecting a first DHCP response message from the DHCP response messages sent by the multiple routers for network connection; If the network connection fails through the first DHCP response message, selecting a second DHCP response message different from the first DHCP response message from the DHCP response messages sent by the multiple routers; Obtaining dynamic network configuration information in the second DHCP response message; Generating static network configuration information based on the dynamic network configuration information; Performing a static network connection based on the static network configuration information.

2. The network connection method according to claim 1, wherein If there is no historical Internet access configuration information for the dynamic network configuration information in the electronic device, the generating of the static network configuration information based on the dynamic network configuration information includes: Obtaining the dynamic Internet Protocol (IP) address and service information in the dynamic network configuration information; Determining a static IP address based on the dynamic IP address, determining the primary Domain Name System (DNS) server address in the static network configuration information based on the primary DNS server address in the service information, and determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the service information; The performing of the static network connection based on the static network configuration information includes: Performing a static network connection based on the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information.

3. The network connection method according to claim 1, wherein If there is historical Internet access configuration information for the dynamic network configuration information in the electronic device, the generating of the static network configuration information based on the dynamic network configuration information includes: Obtaining the dynamic IP address in the dynamic network configuration information; Determining a static IP address based on the dynamic IP address, determining the primary DNS server address in the static network configuration information based on the primary DNS server address in the historical Internet access configuration information, and determining the secondary DNS server address in the static network configuration information based on the secondary DNS server address in the historical Internet access configuration information; The performing of the static network connection based on the static network configuration information includes: Performing a static network connection based on the static IP address, the primary DNS server address in the static network configuration information, and the secondary DNS server address in the static network configuration information.

4. The network connection method according to claim 2, wherein It further includes: Setting the subnet mask in the static network configuration information according to the default subnet mask; The performing of the static network connection through the static network configuration information includes: Performing a static network connection through the static IP address, the primary DNS server address in the static network configuration information, the secondary DNS server address in the static network configuration information, and the subnet mask in the static network configuration information.

5. The network connection method according to claim 1, wherein If there are multiple second DHCP response messages, perform the static network connection steps one by one on the multiple second DHCP response messages until the static network connection is successful or the static network connection fails through the multiple second DHCP response messages. The static network connection steps include: Obtain the dynamic network configuration information in the second DHCP response message; Generate static network configuration information according to the dynamic network configuration information; Perform a static network connection through the static network configuration information.

6. The network connection method according to claim 5, wherein If the third DHCP response message is included in the multiple second DHCP response messages, perform the static network connection steps based on the third DHCP response message; Wherein, the electronic device includes the network connection history corresponding to the IP address in the third DHCP response message.

7. The network connection method according to claim 6, wherein Determine that the third DHCP response message is included in the multiple second DHCP response messages in the following manner: Obtain the IP address in the second DHCP response message; If there is a network connection record corresponding to the IP address in the network connection history record, it is determined that the third DHCP response message is included in the multiple second DHCP response messages.

8. The network connection method according to any one of claims 1 to 7, characterized in that, After performing the network connection based on the static network configuration information, it further includes: Determine that the current state is that the Address Resolution Protocol (ARP) is reachable but network communication cannot be performed; Set the network connection mode to the DHCP mode; Disconnect the network connection and reconnect to the network.

9. The network connection method according to any one of claims 1 to 7, characterized in that, After performing the static network connection based on the static network configuration information, the method further includes: If the network connection fails, set the network connection mode to the DHCP mode; Within a set duration, do not set the network connection mode to the static mode.

10. An electronic device, characterized in that, It includes: A display screen, a memory, and one or more processors; the display screen and the memory are coupled to the processor; wherein, computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the network connection method according to any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, It includes computer instructions. When the computer instructions run on the electronic device, the electronic device executes the network connection method according to any one of claims 1-9.