Network diagnosis method and electronic device

By sending ping request packets with IP addresses of different versions of the network protocol, the accurate positioning of network abnormalities of electronic devices is solved, and the network connection is restored in a timely manner.

WO2025180209A1PCT designated stage Publication Date: 2025-09-04HONOR DEVICE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/076807
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-27
Filing Date
2025-02-11
Publication Date
2025-09-04

AI Technical Summary

Technical Problem

The prior art cannot accurately determine whether electronic devices cannot connect to the network or network lag is caused by an IP address abnormality.

Method used

By sending ping request messages with IP addresses of different versions of the network protocol, receiving reply messages, determining the IP address of the electronic device, and then accurately locate network service abnormalities.

Benefits of technology

Accurately locate the causes of network service abnormalities, restore network connections in a timely manner, and avoid unnecessary repeated detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025076807_04092025_PF_FP_ABST
    Figure CN2025076807_04092025_PF_FP_ABST
Patent Text Reader

Abstract

A network diagnosis method and an electronic device. When the method is applied to the electronic device, the method comprises: sending a first ping request packet and a second ping request packet, wherein the first ping request packet and the second ping request packet are network protocol packets of different versions; and if one ping response packet among a first ping response packet and a second ping response packet is received within a preset time, determining that a network service anomaly of the electronic device is caused by an IP address anomaly of the electronic device, wherein the first ping response packet is a response packet for the first ping request packet, and the second ping response packet is a response packet for the second ping request packet. By using the present application, it is possible to accurately determine whether a network service anomaly of the electronic device is caused by an IP address anomaly of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Network detection method and electronic equipment

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 27, 2024, with application number 202410216949.9 and application name “Network Detection Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a network detection method and electronic equipment. Background Art

[0003] With the continuous development of electronic information technology, electronic devices such as mobile phones and tablets have become indispensable products in our daily life, work and entertainment. When users use electronic devices, they usually need to connect to the Internet for Internet access. For example, when a user watches a video through a video application installed on an electronic device, it is necessary to obtain the video through the Internet. For another example, when a user shops through a shopping application installed on an electronic device, it is necessary to obtain product information through the Internet, etc. When an electronic device is accessing the Internet, it is possible that the electronic device cannot connect to the Internet or the network is stuck. At present, it is impossible to determine whether the inability of the electronic device to access the Internet or the network is stuck is caused by an abnormality in the (Internet Protocol, IP) address of the electronic device. Summary of the Invention

[0004] The purpose of this application is to provide a network detection method and electronic device, which can accurately locate whether the network service anomaly of the electronic device is caused by an abnormal IP address of the electronic device.

[0005] The above-mentioned and other objects are achieved by the features of the independent claims. Further implementations are given in the dependent claims, the description and the drawings.

[0006] In a first aspect, a network detection method is provided, which is applied to an electronic device and includes:

[0007] Sending a first ping request message and a second ping request message, where the first ping request message and the second ping request message are messages of different versions of network protocols, and the first ping request message and the second ping request message respectively include different versions of network protocol IP addresses of the electronic device;

[0008] If one of the first ping reply message and the second ping reply message is received within the preset time, it is determined that the abnormal IP address of the electronic device causes the network service of the electronic device to be abnormal, and the first ping reply message is a reply message for the first ping request message, and the second ping reply message is a reply message for the second ping request message.

[0009] In implementing the method of the first aspect, the electronic device sends ping request messages of different versions of the network protocol. If only the first ping reply message or the second ping reply message is received within the preset time, that is, only the ping reply message of one version of the network protocol is returned within the preset time, and the ping reply message of the other version of the network protocol is not received, then it means that there is no problem with the network path, and the cause of the network service abnormality of the electronic device may be due to the abnormality of the IP address of the other version of the network protocol of the electronic device, thereby more accurately locating that the network service abnormality of the electronic device is caused by the abnormality of the IP address of the electronic device.

[0010] In combination with the first aspect, in a possible implementation, the first ping request message is an Internet Protocol version 4 (IPv4) message, and the source address of the first ping request message includes the IPv4 address of the electronic device;

[0011] The second ping request message is an IPv6 message, and the source address of the second ping request message includes the IPv6 address of the electronic device.

[0012] In this embodiment, the electronic device sends ping request messages to the IPv4 address and IPv6 address of the electronic device respectively, so that the network path problem can be eliminated by receiving a ping response message, thereby locating the network service anomaly to the IP address anomaly of the electronic device.

[0013] In conjunction with the first aspect, in one possible implementation, if one of the first ping response message and the second ping response message is received within a preset time, determining that the abnormal IP address of the electronic device causes abnormal network service of the electronic device includes:

[0014] If the first ping reply message is received within the preset time, but the second ping reply message is not received, it is determined that the abnormality of the IPv6 address of the electronic device causes abnormality in the network service of the electronic device; or

[0015] If the second ping response message is received within the preset time but the first ping response message is not received, it is determined that the abnormality of the IPv4 address of the electronic device causes the abnormality of the network service of the electronic device.

[0016] In this embodiment, it is possible to accurately locate which IP address of the electronic device is abnormal based on the received ping response messages and the unreceived ping response messages.

[0017] In combination with the first aspect, in a possible implementation manner, the method further includes:

[0018] Perform at least one of the following to restore the network service of the electronic device: reactivate the data network of the electronic device; control the electronic device to re-register with the network.

[0019] In this embodiment, when it is detected that the IP address of the electronic device is abnormal, resulting in abnormal network services of the electronic device, the network can be restored in time by reactivating the data network or re-registering the network.

[0020] In conjunction with the first aspect, in a possible implementation manner, before sending the first ping request message and the second ping request message, the method further includes:

[0021] determining a retransmission ratio of first-type messages during Internet access by the electronic device, where the first-type message and the first ping request message are messages of the same version of the network protocol, and the retransmission ratio of the first-type messages is a ratio between the number of first-type messages that need to be retransmitted by the electronic device and the total number of first-type messages initially sent by the electronic device;

[0022] determining a retransmission ratio of second-type messages during Internet access by the electronic device, where the second-type message and the second ping request message are messages of the same version of the network protocol, and the retransmission ratio of the second-type message is a ratio between the number of second-type messages that need to be retransmitted by the electronic device and the total number of second-type messages initially sent by the electronic device;

[0023] The sending of the first ping request message and the second ping request message includes:

[0024] When one of the retransmission ratio of the first type of message and the retransmission ratio of the second type of message is greater than or equal to a first threshold and the other retransmission ratio is less than or equal to a second threshold, a first ping request message and a second ping request message are sent.

[0025] In this embodiment, when the electronic device is surfing the Internet, the retransmission status of different versions of network protocol messages can be counted respectively, so as to determine the triggering of ping detection based on the retransmission status, which can not only detect network service anomalies in time, but also avoid continuous ping detection.

[0026] With reference to the first aspect, in a possible implementation manner, sending the first ping request message and the second ping request message includes:

[0027] When it is detected that the network accessed by the electronic device is switched, a first ping request message and a second ping request message are sent.

[0028] In this embodiment, when it is detected that the network to which the electronic device is connected is switched, ping detection is performed on the IPv4 message and the IPv6 message respectively, so that network abnormality caused by the network switch can be detected in time.

[0029] With reference to the first aspect, in a possible implementation, switching the network accessed by the electronic device includes: switching the network accessed by the electronic device from a WiFi network to a cellular network.

[0030] In this embodiment, when the electronic device switches from a WiFi network to a cellular network, network abnormality problems caused by the network switching can be detected in a timely manner.

[0031] In combination with the first aspect, in a possible implementation manner, the method further includes:

[0032] If the first ping response message and the second ping response message are received within the preset time, it is determined that the network service of the electronic device is normal, and the Internet service is performed through the switched network;

[0033] determining a retransmission ratio of first-type messages during Internet access by the electronic device, where the first-type message and the first ping request message are messages of the same version of the network protocol, and the retransmission ratio of the first-type messages is a ratio between the number of first-type messages that need to be retransmitted by the electronic device and the total number of first-type messages initially sent by the electronic device;

[0034] determining a retransmission ratio of second-type messages during Internet access by the electronic device, where the second-type message and the second ping request message are messages of the same version of the network protocol, and the retransmission ratio of the second-type message is a ratio between the number of second-type messages that need to be retransmitted by the electronic device and the total number of second-type messages initially sent by the electronic device;

[0035] When one of the retransmission ratio of the first type of message and the retransmission ratio of the second type of message is greater than or equal to a first threshold, and the other retransmission ratio is less than or equal to a second threshold, it is detected whether the network service abnormality of the electronic device is caused by the abnormal IP address of the electronic device.

[0036] In this embodiment, when the electronic device switches networks, ping detection is performed on different versions of network protocol messages respectively. If the detection is normal when switching the network, the network is continuously detected whether there is any abnormality during the Internet access process after the switch. When an abnormality is detected, the network protocol messages of different versions are continuously pinged respectively, so that the cause of the network abnormality can be detected in time.

[0037] With reference to the first aspect, in one possible implementation, detecting whether the network service abnormality of the electronic device is caused by an abnormal IP address of the electronic device includes:

[0038] Sending a third ping request message and a fourth ping request message, wherein the third ping request message is a network protocol message of the same version as the first type message, and the fourth ping request message is a network protocol message of the same version as the second type message;

[0039] If one of the third ping reply message and the fourth ping reply message is received within the preset time, it is determined that the abnormal IP address of the electronic device causes the network service of the electronic device to be abnormal, the third ping reply message is a reply message for the third ping request message, and the fourth ping reply message is a reply message for the fourth ping request message.

[0040] In this embodiment, it is possible to accurately determine whether the network anomaly is caused by an abnormal IP address of the electronic device by determining whether one response message is received within a preset time while another response message is not received.

[0041] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method in the first aspect or any possible implementation of the first aspect.

[0042] In a third aspect, a chip system is provided, which is applied to an electronic device, and the chip system includes one or more processors, and the processors are used to call computer instructions to enable the electronic device to execute the method in the first aspect or any possible implementation of the first aspect.

[0043] In a fourth aspect, a computer-readable storage medium is provided, comprising instructions. When the instructions are executed on an electronic device, the electronic device executes the method in the first aspect or any possible implementation of the first aspect.

[0044] The beneficial effects of the technical solutions provided in the second to fourth aspects of this application can refer to the beneficial effects of the technical solution provided in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] FIG1 is a diagram illustrating an electronic device according to an embodiment of the present invention;

[0046] FIG2 is a flow chart of a network detection method provided in an embodiment of the present application;

[0047] FIG3 is a flow chart of another network detection method provided in an embodiment of the present application;

[0048] FIG4 is a flow chart of another network detection method provided in an embodiment of the present application;

[0049] FIG5 is a flowchart of another network detection method provided in an embodiment of the present application;

[0050] FIG6 is a schematic diagram of a network detection method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The terms used in the following examples of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular expressions "a," "an," "said," "above," "the," and "this" are intended to include plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and encompasses any or all possible combinations of one or more of the listed items.

[0052] To facilitate understanding, the following first introduces relevant terms and other related concepts involved in the embodiments of this application.

[0053] (1) Network diagnostic tools (packet internet groper, ping)

[0054] Ping is a network diagnostic tool that can be used to determine whether the network between the local host and another host is connected. The local host sends a ping request message to the other host. If the local host receives a ping reply message from the other host within a preset time, the network between the two hosts is considered to be connected. Otherwise, a network failure is considered.

[0055] (2) Internet Protocol version 4 (IPv4) addresses and Internet Protocol version 6 (IPv6) addresses

[0056] The Internet Protocol (IP) is a digital address assigned to each device connected to the Internet. The embodiments of this application involve two types of IP addresses: IPv4 address and IPv6 address.

[0057] IPv4 addresses are the most widely used addresses on the Internet. They are 32-bit IP addresses and are typically expressed in dotted decimal notation. For example, the IPv4 address is 172.16.254.1.

[0058] IPv6 addresses use hexadecimal numbers separated by colons. They are divided into eight 16-bit blocks, forming a 128-bit address scheme. For example, an IPv6 address is 0123:4567:89ab:cdef:0123:4567:89ab:cdef.

[0059] (3) IPv4 and IPv6 packets

[0060] An IPv4 packet can be understood as consisting of an IPv4 header and a payload. The IPv4 header carries the source and destination addresses corresponding to the payload, both of which are IPv4 addresses. The source address corresponding to the payload can be understood as the address of the communication end that generated the data corresponding to the payload. The destination address corresponding to the payload can be understood as the address of the communication end to which the payload is to be sent.

[0061] An IPv6 packet can be understood as consisting of an IPv6 header and a payload. The IPv6 header carries the source and destination addresses corresponding to the payload, both of which are IPv6 addresses. The source address corresponding to the payload can be understood as the address of the communication end that generated the data corresponding to the payload. The destination address corresponding to the payload can be understood as the address of the communication end to which the payload is to be sent.

[0062] The electronic device provided by the embodiments of the present application is introduced below.

[0063] The electronic device may be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. This application does not impose any restrictions on the specific type of the electronic device.

[0064] FIG1 exemplarily shows the structure of the electronic device.

[0065] As shown in Figure 1, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0066] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[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 video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0068] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0069] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

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

[0071] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.

[0072] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.

[0073] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0074] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.

[0075] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0076] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0077] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.

[0078] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0079] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.

[0080] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0081] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor. If the electronic device 100 accesses the Internet through the mobile communication module 150, it can be understood that the electronic device 100 accesses the Internet through the cellular network. If the electronic device 100 accesses the Internet through the wireless local area network (WLAN) in the wireless communication module 160, it can be understood that the electronic device accesses the Internet through wireless fidelity (WiFi). The user can choose to access the Internet through the mobile communication module 150 or through the wireless communication module 160, and can specifically switch between the two communication modules. For example, the user can disconnect the WiFi and use the cellular network for communication, or the user can disconnect the cellular network and use WiFi for communication.

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

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

[0084] The modem processor may include a modulator and a demodulator. 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. The demodulator then 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 passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

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

[0086] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0087] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0088] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0089] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0090] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.

[0091] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0092] 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 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0093] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0094] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0095] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0096] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0097] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

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

[0099] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0100] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0101] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0102] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0103] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch location based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, a command to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, a command to create a new short message is executed.

[0104] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.

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

[0106] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.

[0107] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). It can also detect the magnitude and direction of gravity when electronic device 100 is stationary. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0108] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.

[0109] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user is holding the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0110] Ambient light sensor 180L is used to sense ambient light brightness. Electronic device 100 can adaptively adjust the brightness of display screen 194 based on the perceived ambient light. Ambient light sensor 180L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 180L can also work with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent accidental touches.

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

[0112] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.

[0113] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.

[0114] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals from the vibrating bones of the human body. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulse signals. In some embodiments, the bone conduction sensor 180M can also be set in headphones to form bone conduction headphones. The audio module 170 can parse out voice signals based on the vibration signals of the vibrating bones of the human body obtained by the bone conduction sensor 180M to implement voice functions. The application processor can parse heart rate information based on the blood pressure pulse signals obtained by the bone conduction sensor 180M to implement heart rate detection functions.

[0115] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0116] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0117] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0118] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting it into or removing it from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0119] In an embodiment of the present application, the processor 110 can perform ping operations based on IPv4 packets and IPv6 packets respectively. If one type of packet among the IPv4 packet and the IPv6 packet can be pinged successfully, and the other type of packet cannot be pinged successfully, it is determined that the abnormal Internet access of the electronic device is caused by an abnormal IP address of the electronic device. When it is determined that the abnormal Internet access is caused by an abnormal IP address of the electronic device, the Internet access can be restored by reactivating the data network, or by re-registering the network.

[0120] Please refer to FIG2 , which is a flowchart of a network anomaly detection method provided in an embodiment of the present application. As shown in FIG2 , the network anomaly detection method flowchart may include, but is not limited to, the following steps. In some implementations, some steps in FIG2 may also be included, for example, steps 201 to 203 may be included, but step 204 may not be included:

[0121] 201. Send a first ping request message and a second ping request message. The first ping request message and the second ping request message may be messages of different versions of network protocols, and the first ping request message and the second ping request message respectively include different versions of network protocol IP addresses of electronic devices.

[0122] Exemplarily, the first ping request message is a first type message, and the second ping request message is a second type message. The first type message and the second type message are messages of different versions of network protocols. For example, the first type message may be an IPv4 message, and the second type message may be an IPv6 message. The IP addresses in the first type message and the second type message are IP addresses of different versions of network protocols, and the IP addresses may refer to source IP addresses and destination IP addresses. For ease of description, the IP address in the first type message is referred to as a first type IP address, and the IP address in the second type message is referred to as a second type IP address. Exemplarily, the formats of the first type message and the second type message may also be different.

[0123] Exemplarily, the first type of message may be an IPv4 message, the IP address in the first type of message is an IPv4 address, the second type of message may be an IPv6 message, and the IP address in the second type of message is an IPv6 address; or, the first type of message may be an IPv6 message, the IP address in the first type of message is an IPv6 address, the second type of message may be an IPv4 message, and the IP address in the second type of IP message is an IPv4 address.

[0124] Taking the example where the first type of message can be an IPv4 message and the second type of message can be an IPv6 message, illustratively, the source IP address in the first ping request message can be the IPv4 address of the electronic device, and the destination IP address in the first ping request message can be the IPv4 address of the first network node. The IPv4 address of the first network node can be an IPv4 address used for network testing.

[0125] The source IP address in the second ping request message may be the IPv6 address of the electronic device, and the destination IP address in the second ping request message may be the IPv6 address of the second network node. The IPv6 address of the second network node may be an IPv6 address used for network testing. The first network node and the second network node may be the same network node.

[0126] The electronic device can send the first ping request message and the second ping request message by calling the interface, and the user may not be aware of it.

[0127] 202 : If one of the first ping response message and the second ping response message is received within a preset time, it is determined that the network abnormality is caused by an abnormal IP address of the electronic device.

[0128] The first ping reply message is a reply message for the first ping request message, indicating that the first network node has received the first ping request message. The first ping reply message is a first type message, i.e., the first ping reply message and the first ping request message are messages of the same network protocol version. The second ping reply message is a reply message for the second ping request message, indicating that the second network node has received the second ping request message. The second ping reply message is a second type message, i.e., the second ping reply message and the second ping request message are messages of the same network protocol version.

[0129] When the electronic device only receives the first ping reply message within the preset time but does not receive the second ping reply message, or when the electronic device only receives the second ping reply message but does not receive the first ping reply message, it is determined that there is no problem with the network path, and the cause of the network abnormality is the abnormal IP address of the electronic device.

[0130] If the electronic device receives only the first ping reply message but not the second ping reply message, it is determined that the cause of the network anomaly is caused by an anomaly in the second type IP address (e.g., IPv6 address) of the electronic device. If the electronic device receives only the second ping reply message but not the first ping reply message, it is determined that the cause of the network anomaly is caused by an anomaly in the first type IP address (e.g., IPv4 address) of the electronic device.

[0131] In some embodiments, step 203 may be further included, ie, restoring the network after detecting the cause of the network anomaly. In some embodiments, step 203 may not be included, ie, the cause of the network anomaly is simply located.

[0132] 203. When it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device, perform at least one of the following to restore the network: reactivate the data network; control the electronic device to re-register with the network.

[0133] Exemplarily, when it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device, a new IP address can be reacquired to restore the network, wherein the reacquired IP address may include the IPv4 address and / or IPv6 address of the electronic device.

[0134] For example, an interface can be called to reactivate the data network to restore Internet access, or a reregistration interface can be called to reregister the network to restore Internet access. Reactivating the data network can be understood as first shutting down the data network and then reactivating it to reacquire the IP address of the electronic device. Reregistering the network can be understood as the interaction between the electronic device and the network, deregistering, and then re-registering with the network. By reregistering with the network, the electronic device can also reacquire the IP address of the electronic device.

[0135] In some embodiments, the two methods for restoring the network can be used in combination. For example, an interface can be called to reactivate the data network first. If network anomalies still exist after reactivating the data network, such as the inability of terminal device applications to access the Internet or network lag, the network can be re-registered. A specific method for detecting whether the network is abnormal can be to resend the first ping request message and the second ping request message, as described in steps 201 and 202. If the first ping reply message or the second ping reply message is still received, it is determined that the network has not been successfully restored.

[0136] In some embodiments, if the electronic device does not receive the first ping reply message and the second ping reply message, it determines that the cause of the network abnormality is a communication link abnormality, and triggers link recovery.

[0137] The following describes the scenarios for network anomaly detection:

[0138] Scenario 1: When an application of an electronic device is surfing the Internet, the operating system kernel detects a communication anomaly of the first type of message or the second type of message, triggering network anomaly detection and network recovery. The following is an example with reference to FIG3:

[0139] 301 , during the process of an application of an electronic device accessing the Internet, determining whether a first type of message and a second type of message have communication abnormalities.

[0140] For example, the first type of message may be an IPv4 message, and the second type of message may be an IPv6 message; or the first type of message may be an IPv6 message, and the second type of message may be an IPv4 message. During the process of an application accessing the Internet, the electronic device may send messages, which may be data messages and / or control messages exchanged between the electronic device's applications during the Internet access process.

[0141] The operating system kernel of the electronic device can respectively count the retransmission status of the first type of message and the second type of message during the application program accessing the Internet, thereby determining whether the communication of the first type of message and the second type of message is abnormal based on the retransmission status.

[0142] Exemplarily, the operating system kernel of the electronic device may count the retransmission ratio of the first type of messages. Specifically, the retransmission ratio of the first type of messages within the most recent preset time period may be counted. The retransmission ratio of the first type of messages may be the ratio between the number of first type of messages that the electronic device needs to retransmit within the most recent preset time period and the total number of first type of messages that the electronic device first sends within the most recent preset time period. Take the first type of messages as IPv4 messages as an example. For example, the total number of IPv4 messages sent by the electronic device for the first time within the most recent preset time period is 10, and all of the 10 IPv4 messages need to be retransmitted, and the retransmission ratio of the IPv4 messages is 100%.

[0143] Exemplarily, the operating system kernel of the electronic device may count the retransmission ratio of the second type of messages. Specifically, the retransmission ratio of the second type of messages within the most recent preset time period may be counted. The retransmission ratio of the second type of messages may be the ratio between the number of first type of messages that the electronic device needs to retransmit within the most recent preset time period and the total number of first type of messages that the electronic device first sends within the most recent preset time period. Take the first type of message as an IPv6 message as an example. For example, the total number of IPv6 messages sent by the electronic device for the first time within the most recent preset time period is 100, and only one IPv6 message among the 100 IPv6 messages needs to be retransmitted, and the retransmission ratio of the IPv6 message is 1%.

[0144] In the embodiments of the present application, the retransmission ratio can be used to determine whether a message communication anomaly exists. If the retransmission ratio is greater than or equal to a first threshold, the message communication anomaly is determined. If the retransmission ratio is less than or equal to a second threshold, the message communication is determined to be normal. For example, the first threshold can be 100% and the second threshold can be 2%. It is understood that the first and second thresholds are merely examples and other ratios are also possible.

[0145] In some embodiments, the method for detecting whether there is communication abnormality between the first type of message and the second type of message can also be that if it is detected within a recent preset time period that all of one type of message is retransmitted, that is, the message of this type is sent out without a response, and there is no retransmission of the other type of message, that is, there is a response to the other type of message, then it is determined that one type of message of the first type and the second type of message has communication abnormality, and the other type of message has communication normally.

[0146] 302. If communication of one type of message between the first type of message and the second type of message is abnormal, send a first ping request message and a second ping request message.

[0147] If there is an anomaly in the communication of either the first or second type of messages, the electronic device triggers the IP address anomaly detection method, i.e., calls the interface to send a first ping request message, which is a message of the first type, and a second ping request message, which is a message of the second type. It is understood that if both the first and second type of messages are anomalies, network link recovery is triggered.

[0148] Exemplarily, if the retransmission ratio of the first type of message sent by the electronic device is greater than the first threshold, for example, all the first type of messages need to be retransmitted, while the retransmission ratio of the second type of message sent by the electronic device is relatively small, for example, less than the second threshold, then it is determined that the communication of the first type of message is abnormal and the communication of the second type of message is normal. Exemplarily, if the retransmission ratio of the second type of message sent by the electronic device is greater than the first threshold, for example, all the second type of messages need to be retransmitted, while the retransmission ratio of the first type of message sent by the electronic device is relatively small, then it is determined that the communication of the second type of message is abnormal and the communication of the first type of message is normal.

[0149] 303. If one of the first ping response message and the second ping response message is received within a preset time, it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device.

[0150] If the electronic device receives only the first ping reply message or the second ping reply message within the preset time, it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device. Specific reference can be made to the description of steps 201-202 in the embodiment of Figure 2, which will not be repeated here.

[0151] In some embodiments, step 304 may be further included, ie, restoring the network after detecting the cause of the network anomaly. In some embodiments, step 304 may not be included, ie, the cause of the network anomaly may be located.

[0152] 304. When it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device, perform at least one of the following to restore the network: reactivate the data network; control the electronic device to re-register with the network.

[0153] For the related introduction of network recovery, please refer to the description of step 203 in the embodiment of FIG2 , which will not be repeated here.

[0154] Scenario 2: When a network switch to which an electronic device is connected is detected, network anomaly detection and network recovery are triggered. The following example is illustrated with reference to FIG4 :

[0155] 401. Detect whether the network to which the electronic device is connected has been switched.

[0156] As an example, the network switching of the electronic device may refer to a change in the type of network accessed by the electronic device, for example, the electronic device switches from a WiFi network to a cellular network. For another example, the electronic device switches from a cellular network to a WiFi network.

[0157] As another example, the network switching accessed by the electronic device may refer to the electronic device switching between different networks of the same type, for example, the electronic device switching from accessing a first WiFi network to a second WiFi network.

[0158] Due to the network switching to which the electronic device is connected, the IP address of the electronic device before the switching may not be applicable to the network after the switching. In the embodiment of the present application, when the network switching to which the electronic device is connected is detected, network anomaly detection will be triggered, that is, step 402 will be executed.

[0159] 402. When the network accessed by the electronic device is switched, a first ping request message and a second ping request message are sent.

[0160] 403. If one of the first ping response message and the second ping response message is received within a preset time, it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device.

[0161] When it is determined that the network accessed by the electronic device has switched, the electronic device triggers IP address anomaly detection, i.e., calling an interface to send a first ping request message, which is a first type message, and a second ping request message, which is a second type message. If only the first ping reply message or the second ping reply message is received within a preset time, it is determined that the IP address of the electronic device is abnormal, causing the network anomaly. For details, please refer to the description of steps 201-202 in the embodiment of Figure 2, which will not be repeated here.

[0162] In some embodiments, step 404 may be further included, ie, restoring the network after detecting the cause of the network anomaly. In some embodiments, step 404 may not be included, ie, the cause of the network anomaly is only needed to be located.

[0163] 404. When it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device, perform at least one of the following to restore the network: reactivate the data network; control the electronic device to re-register with the network.

[0164] For the related introduction of network recovery, please refer to the description of step 203 in the embodiment of FIG2 , which will not be repeated here.

[0165] Scenario 3: When a network switch to which the electronic device is connected is detected, a first IP address anomaly detection is triggered. If the network is determined to be normal during the first IP address anomaly detection process, the first type of message and the second type of message will continue to be detected during the process of the electronic device's application surfing the Internet. If the communication of the first type of message or the second type of message is abnormal, a second IP address anomaly detection is triggered. The following is an example with reference to FIG5:

[0166] 501, detecting whether the network to which the electronic device is connected has been switched.

[0167] The description of step 501 in the embodiment of the present application can refer to step 401 in the embodiment of FIG. 4 , and will not be repeated here.

[0168] 502. When the network accessed by the electronic device is switched, a first ping request message and a second ping request message are sent.

[0169] When it is determined that the network to which the electronic device is connected has been switched, the electronic device will trigger IP address anomaly detection, that is, sending a first ping request message, which is a first type of message, and sending a second ping request message, which is a second type of message. For the relevant introduction to the first ping request message and the second ping request message, please refer to the description of step 201 of the embodiment of Figure 2, which will not be repeated here.

[0170] 503. If the first ping response message and the second ping response message are received within the preset time, it is determined that the network is normal.

[0171] The first ping reply message is a reply message for the first ping request message, indicating that the first network node has received the first ping request message. The second ping reply message is a reply message for the second ping request message, indicating that the second network node has received the second ping request message.

[0172] If the electronic device receives the first ping response message and the second ping response message within the preset time, it is determined that the network is normal, and the application of the electronic device can normally access the Internet through the switched network, and step 504 can be continued.

[0173] If the electronic device receives the first ping response message or the second ping response message within the preset time, that is, only one type of response message is received, it is determined that the IP address abnormality of the electronic device causes the network abnormality of the electronic device, and network recovery is performed. For details, please refer to the description of steps 403 and 404 of the embodiment of Figure 4.

[0174] 504 , during the process of the application of the electronic device accessing the Internet through the switched network, determining whether the first type of message and the second type of message have communication abnormalities.

[0175] For example, if the network after switching is a cellular network, the electronic device accesses the Internet through the cellular network. The electronic device sends a first type of message and a second type of message.

[0176] 505 , if communication of one type of message between the first type message and the second type message is abnormal, send a third ping request message and a fourth ping request message.

[0177] The third ping request message is a first type message, and a fourth ping request message is sent, which is a second type message. The first type message and the second type message are messages of different versions of network protocols. For example, the first type message may be an IPv4 message, and the second type message may be an IPv6 message. For the description of the third and fourth ping request messages, refer to the description of the first and second ping request messages in the aforementioned embodiment.

[0178] 506. If one of the third ping response message and the fourth ping response message is received within the preset time, it is determined that the cause of the network abnormality is caused by an abnormal IP address of the electronic device.

[0179] The third ping reply message is a reply message for the third ping request message, and is a first type message. The first type message may be, for example, an IPv4 message, i.e., the third ping reply message and the third ping request message are messages of the same network protocol version. The fourth ping reply message is a reply message for the fourth ping request message, and is a second type message. The second type message may be, for example, an IPv6 message, i.e., the fourth ping reply message and the fourth ping request message are messages of the same network protocol version. For the description of the third and fourth ping reply messages, reference may be made to the description of the first reply request message and the second ping reply message in the aforementioned embodiment.

[0180] If the electronic device receives only one type of response message (eg, the third ping response message or the fourth ping response message) within the preset time, it is determined that the IP address of the electronic device is abnormal, resulting in a network abnormality of the electronic device.

[0181] Steps 504 to 506 of the embodiment of the present application can refer to steps 301 to 303 of the embodiment of FIG. 3 , and are not described again here.

[0182] In some embodiments, step 507 may be further included, ie, the network is restored after the cause of the network abnormality is detected. In some embodiments, step 507 may not be included, ie, the cause of the network abnormality is simply located.

[0183] 507. When it is determined that the cause of the network abnormality is an abnormal IP address of the electronic device, perform at least one of the following to restore the network: reactivate the data network; control the electronic device to re-register with the network.

[0184] For the related introduction of network recovery, please refer to the description of step 203 in the embodiment of FIG2 , which will not be repeated here.

[0185] Please refer to Figure 6, which is a schematic diagram of a network detection method provided in an embodiment of the present application. Figure 6 illustrates the structure of an electronic device. The electronic device includes an operating system kernel layer (Kernel) and a framework layer (Framework). The operating system kernel layer includes a parameter acquisition module, and the framework layer includes a detection and analysis module and a recovery module. The network detection method is described below in conjunction with each module:

[0186] 601 , when a foreground application is surfing the Internet, the detection and analysis module instructs the parameter collection module to collect parameters.

[0187] When a foreground application is online, the detection and analysis module of the framework layer can instruct the parameter collection module to collect parameters. The specific parameters to be collected can be determined according to the scenario of network anomaly detection. The following example illustrates:

[0188] As an example, if it is necessary to determine whether there is a communication anomaly between the first type of message and the second type of message during Internet access, such as shown in Scenario 1 and Scenario 3 in the aforementioned embodiments, the parameters collected by the detection and analysis module instructing the parameter collection module may include, but are not limited to, at least one of the following: the number of retransmitted messages corresponding to the first type of message and the second type of message within a preset time period, the number of first-sent messages corresponding to the first type of message and the second type of message within a preset time period, etc. For example, the first type of message may be an IPv4 message, and the second type of message may be an IPv6 message. The preset time period may be, for example, 1 second, that is, the number of first-sent IPv4 messages and IPv6 messages within 1 second, as well as the number of messages that need to be retransmitted in the IPv4 message and IPv6 message, respectively, are detected. For a specific description, please refer to the relevant description of the embodiments of Figures 3 and 5 in the aforementioned embodiments.

[0189] As another example, if it is necessary to determine whether the network accessed by the electronic device has switched during Internet access, such as in scenarios 2 and 3 in the aforementioned embodiments, the parameters collected by the detection and analysis module instructing the parameter collection module may include, but are not limited to, at least one of the following: the type of network accessed by the electronic device, the identifier of the network accessed by the electronic device, etc. For a detailed description, please refer to the relevant description of the embodiments of Figures 4 and 5 in the aforementioned embodiments.

[0190] 602. The parameter collection module sends the collected parameters to the detection and analysis module.

[0191] 603 , the detection and analysis module analyzes the collected parameters and sends an IPv4 ping request message and an IPv6 ping request message respectively.

[0192] 604 : When one of the IPv4 ping response message and the IPv6 ping response message is received within a preset time, instruct the recovery module to perform network recovery.

[0193] As an example, if the parameters collected by the parameter collection module include the number of retransmitted messages corresponding to IPv4 and IPv6 messages, respectively, within a preset time period, the number of first-sent messages corresponding to IPv4 and IPv6 messages, respectively, within a preset time period, etc., the detection and analysis module can calculate the retransmission ratio of IPv4 and IPv6 messages, respectively, within the preset time period based on these parameters. If the retransmission ratio of one type of message among the IPv4 and IPv6 messages is greater than a first threshold, and the retransmission ratio of the other type of message is less than a second threshold, an IPv4 ping request message and an IPv6 ping request message can be sent, respectively. If a response message of either the IPv4 ping reply message or the IPv6 ping reply message is received within the preset time period, it is determined that the network anomaly is caused by an abnormal IP address of the electronic device, and the recovery module is instructed to perform network recovery. The recovery module can restore the network by performing at least one of the following: reactivating the data network or reregistering the network. For a detailed description, please refer to the relevant descriptions of Scenario 1 and Scenario 3 in the aforementioned embodiments, i.e., the relevant descriptions of the embodiments of Figures 3 and 5 in the aforementioned embodiments.

[0194] As another example, if the parameters collected by the parameter collection module include the type of network accessed by the electronic device, the network identifier accessed by the electronic device, etc., the detection and analysis module can determine whether the network accessed by the electronic device has switched based on the collected parameters. If it is detected that the network accessed by the electronic device has switched, an IPv4 ping request message and an IPv6 ping request message can be sent respectively. If one of the IPv4 ping reply message and the IPv6 ping reply message is received within a preset time, it is determined that the network abnormality is caused by an abnormal IP address of the electronic device, and the recovery module is instructed to perform network recovery. The recovery module can restore the network by performing at least one of the following: reactivating the data network, re-registering the network. For a specific description, see the relevant descriptions of scenario 2 and scenario 3 in the aforementioned embodiments, that is, the relevant descriptions of the embodiments of Figures 4 and 5.

[0195] If an IPv4 ping reply message and an IPv6 ping reply message are received within a preset time, the parameter collection module may be instructed to collect the number of retransmitted messages and the number of first-sent messages for the IPv4 and IPv6 messages, respectively, to determine whether there is a communication anomaly of one type of message. If one type of message communication is abnormal, while the other type of message communication is normal, an IPv4 ping request message and an IPv6 ping request message may be sent, respectively. If one of the IPv4 ping reply message and the IPv6 ping reply message is received within a preset time, it is determined that the network anomaly is caused by an abnormal IP address of the electronic device, and the recovery module is instructed to perform network recovery. For details, please refer to the relevant description of the embodiment of Figure 5 in the aforementioned embodiment.

[0196] An embodiment of the present application also provides an electronic device, which includes: one or more processors and a memory; wherein the memory is coupled to the one or more processors, and the memory is used to store computer program code, and the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method shown in the aforementioned embodiment.

[0197] As used in the above embodiments, the term “when…” may be interpreted to mean “if…” or “after…” or “in response to determining…” or “in response to detecting…”, depending on the context. Similarly, the phrases “upon determining…” or “if (stated condition or event) is detected” may be interpreted to mean “if determining…” or “in response to determining…” or “upon detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.

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

[0199] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A network detection method, applied to electronic equipment, characterized in that: include: Sending a first ping request message and a second ping request message, where the first ping request message and the second ping request message are network protocol messages of different versions; If one of the first ping reply message and the second ping reply message is received within the preset time, it is determined that the abnormal IP address of the electronic device causes the network service of the electronic device to be abnormal, and the first ping reply message is a reply message for the first ping request message, and the second ping reply message is a reply message for the second ping request message.

2. The method according to claim 1, wherein The first ping request message is an Internet Protocol version 4 (IPv4) message, and the source address of the first ping request message includes the IPv4 address of the electronic device; The second ping request message is an IPv6 message, and the source address of the second ping request message includes the IPv6 address of the electronic device.

3. The method according to claim 2, wherein If one of the first ping response message and the second ping response message is received within a preset time, determining that the abnormal IP address of the electronic device causes abnormal network service of the electronic device includes: If the first ping reply message is received within the preset time, but the second ping reply message is not received, it is determined that the abnormality of the IPv6 address of the electronic device causes abnormality in the network service of the electronic device; or If the second ping response message is received within the preset time but the first ping response message is not received, it is determined that the abnormality of the IPv4 address of the electronic device causes the abnormality of the network service of the electronic device.

4. The method according to any one of claims 1 to 3, wherein The method further comprises: Perform at least one of the following to restore the network service of the electronic device: reactivate the data network of the electronic device; control the electronic device to re-register with the network.

5. The method according to any one of claims 1 to 4, characterized in that Before sending the first ping request message and the second ping request message, the method further includes: determining a retransmission ratio of first-type messages during Internet access by the electronic device, where the first-type message and the first ping request message are messages of the same version of the network protocol, and the retransmission ratio of the first-type messages is a ratio between the number of first-type messages that need to be retransmitted by the electronic device and the total number of first-type messages initially sent by the electronic device; determining a retransmission ratio of second-type messages during Internet access by the electronic device, where the second-type message and the second ping request message are messages of the same version of the network protocol, and the retransmission ratio of the second-type message is a ratio between the number of second-type messages that need to be retransmitted by the electronic device and the total number of second-type messages initially sent by the electronic device; The sending of the first ping request message and the second ping request message includes: When one of the retransmission ratio of the first type of message and the retransmission ratio of the second type of message is greater than or equal to a first threshold and the other retransmission ratio is less than or equal to a second threshold, a first ping request message and a second ping request message are sent.

6. The method according to any one of claims 1 to 4, characterized in that The sending of the first ping request message and the second ping request message includes: When it is detected that the network accessed by the electronic device is switched, a first ping request message and a second ping request message are sent.

7. The method according to claim 6, wherein The switching of the network accessed by the electronic device includes: the network accessed by the electronic device is switched from a WiFi network to a cellular network.

8. The method according to claim 6 or 7, wherein: The method further comprises: If the first ping response message and the second ping response message are received within the preset time, it is determined that the network service of the electronic device is normal, and the Internet service is performed through the switched network; determining a retransmission ratio of first-type messages during Internet access by the electronic device, where the first-type message and the first ping request message are messages of the same version of the network protocol, and the retransmission ratio of the first-type messages is a ratio between the number of first-type messages that need to be retransmitted by the electronic device and the total number of first-type messages initially sent by the electronic device; determining a retransmission ratio of second-type messages during Internet access by the electronic device, where the second-type message and the second ping request message are messages of the same version of the network protocol, and the retransmission ratio of the second-type message is a ratio between the number of second-type messages that need to be retransmitted by the electronic device and the total number of second-type messages initially sent by the electronic device; When one of the retransmission ratio of the first type of message and the retransmission ratio of the second type of message is greater than or equal to a first threshold, and the other retransmission ratio is less than or equal to a second threshold, it is detected whether the network service abnormality of the electronic device is caused by the abnormal IP address of the electronic device.

9. The method according to claim 8, wherein The detecting whether the abnormality of the network service of the electronic device is caused by an abnormality of the IP address of the electronic device includes: Sending a third ping request message and a fourth ping request message, wherein the third ping request message is a network protocol message of the same version as the first type message, and the fourth ping request message is a network protocol message of the same version as the second type message; If one of the third ping reply message and the fourth ping reply message is received within the preset time, it is determined that the abnormal IP address of the electronic device causes the network service of the electronic device to be abnormal, the third ping reply message is a reply message for the third ping request message, and the fourth ping reply message is a reply message for the fourth ping request message.

10. An electronic device, characterized in that: The electronic device includes: one or more processors, a memory and a display screen; The memory is coupled to the one or more processors, and is configured to store computer program codes, where the computer program codes include computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 9.

11. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions to enable the electronic device to execute the method as described in any one of claims 1-9.

12. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for user to select network layer protocol, household gateway and Internet network

    CN103856436A

  • Relay device

    JP2013192156A

  • Data transmission method and routing device

    WO2020132982A1