Data packet sending method and terminal equipment

By pausing and resuming data packet transmission when a network anomaly is detected on the terminal device, the problem of data packet loss caused by network anomalies on the terminal device is resolved, ensuring stable internet access for applications.

CN121418902APending Publication Date: 2026-01-27HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411012295.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2026-01-27

AI Technical Summary

Technical Problem

When the network connection of a terminal device is abnormal, data packets sent by installed applications may be lost, resulting in abnormal internet access for the applications.

Method used

When a terminal device detects a network anomaly, it suspends the transmission of data packets and resumes transmission after the network returns to normal. Alternatively, when switching network devices, it may pause and then resume the transmission of data packets to avoid data packet loss.

Benefits of technology

It effectively avoids the loss of data packets in poor or abnormal network conditions, ensuring that applications can access the internet normally.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121418902A_ABST
    Figure CN121418902A_ABST
Patent Text Reader

Abstract

The invention discloses a data packet sending method and terminal equipment, and relates to the technical field of terminals. The problem that when the network connection of the terminal equipment is abnormal, the data packet sent by the installed application is lost, so that the application surfs the internet abnormally can be solved. The method is applied to a first terminal device, and the first terminal device is provided with a first application for sending a data packet. A first event occurs in the first terminal device, and the first event comprises at least one of switching of an accessed network device and abnormality of an accessed network. In response to the first event, the first terminal device can control the first application to execute a first operation, and the first operation comprises pausing sending of the data packet and continuing sending of the data packet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to data packet transmission methods and terminal devices. Background Technology

[0002] Currently, various types of applications may be installed on terminal devices, such as social networking applications, video applications, conferencing applications, and browser applications. Terminal devices establish network connections by cooperating with other devices (such as other terminal devices and network devices), enabling installed applications to send data packets over the network and execute various business functions. However, when the terminal device's network connection becomes abnormal, the data packets sent by the installed applications may be lost, leading to internet access problems. Summary of the Invention

[0003] This application provides a data packet sending method and a terminal device, which can solve the problem that when the network connection of the terminal device is abnormal, the data packets sent by the installed application are lost, thus causing the application to have abnormal internet access.

[0004] To achieve the above objectives, this application adopts the following technical solution:

[0005] In a first aspect, a data packet sending method is provided, applied to a first terminal device, the first terminal device having a first application installed for sending data packets, the method comprising: the first terminal device experiencing a first event, the first event including at least one of switching access to a network device or an abnormality in the accessed network; in response to the first event, the first terminal device controlling the first application to perform a first operation, the first operation including pausing the sending of the data packet and continuing to send the data packet.

[0006] Based on the above technical solution, when a terminal device switches to a different network device, or when the connected network device malfunctions, the terminal device can control the installed application that is currently sending data packets to pause data packet transmission before resuming it. This avoids the application continuously sending data packets during the switching process when the connected network device malfunctions, preventing data packet loss in poor or abnormal network conditions and resolving the application's internet access issues.

[0007] In one possible design, the first event includes switching the accessed network device; in response to the first event, the first terminal device controls the first application to perform a first operation, including: before the first terminal device switches from the accessed first network device to the second network device, the first terminal device controls the first application to pause sending the data packets; and after the first terminal device switches from the accessed first network device to the second network device, the first terminal device controls the first application to resume sending the data packets. In this way, the terminal device first controls the application to pause sending data packets before switching from the first network device to the second network device, and then controls the first application to resume sending data packets after switching to the second network device. This avoids the application continuously sending data packets during the switching process, which could lead to data packet loss due to poor network conditions, thus resolving the problem of application internet access abnormalities.

[0008] In one possible design, the first event includes a network access anomaly; in response to the first event, the first terminal device controls the first application to perform a first operation, including: in response to the network access anomaly, the first terminal device controls the first application to suspend sending the data packets; in response to the network accessing the first terminal device returning to normal, the first terminal device controls the first application to resume sending the data packets. In this way, when the network access anomaly occurs, the terminal device first controls the application to suspend sending data packets, and then controls the application to resume sending data packets after the network returns to normal. This avoids the application continuously sending data packets under network anomalies, thus preventing data packet loss and resolving the problem of application internet access anomalies.

[0009] In one possible design, the network accessed by the first terminal device is the network of the second terminal device, and a communication connection is established between the first terminal device and the second terminal device. Based on this design, the first terminal device can access the networks of other terminal devices, allowing applications on the first terminal device to access the internet through these networks. Thus, in the event of an anomaly in the network of another connected terminal device, the terminal device can first control the application to pause data packet transmission. Once the network of that other connected terminal device returns to normal, the terminal device can control the application to resume data packet transmission. This avoids data packet loss caused by applications sending data when the network of another connected terminal device is abnormal, thus resolving the problem of application internet access issues.

[0010] In one possible design, before the first terminal device controls the first application to resume sending the data packet in response to the network accessed by the first terminal device returning to normal, the method further includes: the first terminal device instructing the second terminal device to perform a recovery operation, the recovery operation being used to restore the network of the second terminal device. Based on this design, when the first terminal device accesses the network of the second terminal device, if the network of the second terminal device is abnormal, the first terminal device can instruct the second terminal device to perform a network recovery operation, so that the network of the second terminal device can return to normal, thereby allowing the application in the first terminal device to continue accessing the internet.

[0011] In one possible design, before the first terminal device controls the first application to resume sending the data packet in response to the network access of the first terminal device returning to normal, the method further includes: the first terminal device receiving indication information from the second terminal device, the indication information indicating that the network of the second terminal device has returned to normal. Based on this design, when the first terminal device accesses the network of the second terminal device, if the network of the second terminal device returns to normal, the second terminal device can indicate to the first terminal device that its own network has returned to normal. This facilitates the first terminal device in controlling the application to resume sending data packets, allowing the application to continue accessing the internet and resolving the problem of application internet access abnormalities.

[0012] In one possible design, the network accessed by the first terminal device experiences an anomaly; in response to the network accessed by the first terminal device returning to normal, the first terminal device controls the first application to resume sending the data packets, including: in response to the first terminal device accessing the network of a second terminal device, the first terminal device controls the first application to resume sending the data packets. Thus, when the first terminal device's own network experiences an anomaly—that is, when the first terminal device is a terminal device capable of accessing the internet—it can access the internet by connecting to the network of other terminal devices, thereby quickly restoring internet access. Furthermore, controlling the application to resume sending data packets avoids the application continuously sending data packets during the period when the first terminal device's own network is abnormal, thus preventing data packet loss and resolving the problem of application internet access anomalies.

[0013] In one possible design, after the first terminal device controls the first application to resume sending the data packets in response to the first terminal device accessing the network of the second terminal device, the method further includes: when the network of the first terminal device returns to normal, the first terminal device reconnects to its own network; the first terminal device controls the first application to continue sending the data packets. In this way, the first terminal device reconnects to its own network when its own network returns to normal, that is, it disconnects from the network of the second terminal device. This avoids the problem that data packets of the applications installed on the first terminal device cannot be sent after the first terminal device disconnects from the second terminal device, or when the network of the second terminal device becomes abnormal.

[0014] In one possible design, the signal quality of the first network device does not meet a preset condition, while the signal quality of the second network device does. Based on this design, the first network device's signal quality is poor, while the second network device's signal quality is good. In this case, during the process of a terminal device switching from a network device with a poor signal to one with a good signal, if the application continues to send data packets before the switch is complete, the data packets will be transmitted through the network device with the poor signal, resulting in data packet loss. However, in this design, the application pauses data packet transmission before switching from the network device with a poor signal, and resumes transmission after the switch is complete. This avoids data packet loss caused by transmission through the network device with a poor signal, allowing the application to access the internet normally.

[0015] In one possible design, the method further includes: the first terminal device switching from a first wireless access point to a second wireless access point; the first terminal device receiving indication information from a gateway device from the second wireless access point, the indication information indicating a change in the socket of the gateway device; and the first terminal device controlling the first application to resend n data packets, where n is a positive integer. Thus, when the terminal device switches from one wireless access point to another, if the socket of the gateway device changes, the gateway device can inform the terminal device, allowing the terminal device to control the application to resend n data packets. This ensures continuous reception of application data packets by the data packet receiver, resolving the issue of abnormal application internet access.

[0016] In one possible design, the processor of the first terminal device includes a first core and a second core, the first application runs on the first core, and the modem runs on the second core. The method further includes: when the first application closes its socket and the modem receives a data packet from the receiving end, the modem sends an RST packet to the receiving end. Thus, when the terminal device's processor is a multi-core processor, and the application and modem are deployed on different cores, if the application has closed its socket but the modem is still receiving data packets from the receiving end, the modem no longer wakes up the application to send an RST packet. Instead, the modem directly proxies the application to send the RST packet to disconnect from the receiving end, saving power consumption associated with waking up the core running the first application.

[0017] In a second aspect, a terminal device is provided, which has the function of implementing the method as described in any of the designs in the first aspect above. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.

[0018] Thirdly, a terminal device is provided, comprising: a processor, a memory, and a communication interface, wherein the memory and the communication interface are coupled to the processor, the communication interface is used for communicating with other devices, the memory is used to store program code, the program code including instructions, and the processor reads the instructions from the memory to cause the terminal device to execute the method described in any of the designs in the first aspect above. Optionally, the memory may be coupled to the processor or may be independent of the memory. Exemplarily, the communication interface may be a transceiver, an input / output interface, an interface circuit, an output circuit, an input circuit, a pin, or related circuitry, etc.

[0019] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium including a computer program that, when run on a terminal device, causes the terminal device to perform the method as described in the first aspect and any of the designs therein.

[0020] Fifthly, a computer program product is provided, the computer program product comprising: a computer program or instructions that, when run on a computer, cause the computer to perform the method as described in the first aspect and any of the designs therein.

[0021] In a sixth aspect, a chip system is provided, including at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor, and when the at least one processor executes instructions, the at least one processor performs the method as described in any of the designs in the first aspect above.

[0022] In a seventh aspect, a communication system is provided, including a first terminal device and a second terminal device, wherein the first terminal device and the second terminal device cooperate to implement the method described in any of the designs in the first aspect.

[0023] Eighthly, a communication system is provided, including a first terminal device and at least one network device, wherein the first terminal device and the at least one network device cooperate to implement the method described in any of the designs in the first aspect.

[0024] In a ninth aspect, a communication system is provided, comprising a first terminal device, a second terminal device, and at least one network device, wherein the first terminal device, the second terminal device, and the at least one network device cooperate to implement the method described in any of the designs in the first aspect.

[0025] It should be noted that the technical effects of any of the designs in the second to ninth aspects mentioned above can be found in the technical effects of the corresponding designs in the first aspect, and will not be repeated here. Attached Figure Description

[0026] Figure 1 This application provides a schematic diagram of the architecture of a communication system.

[0027] Figure 2 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application;

[0028] Figure 3 A schematic diagram of a processor provided in an embodiment of this application;

[0029] Figure 4 A schematic diagram of an architecture for a mobile phone to access a WiFi network, provided as an embodiment of this application;

[0030] Figure 5 A schematic diagram of a mobile phone access network provided in an embodiment of this application;

[0031] Figure 6 This application provides a schematic diagram illustrating a process by which a mobile phone accesses the network by calling the internet access capabilities of other devices.

[0032] Figure 7 This is a schematic diagram illustrating another process by which a mobile phone accesses the network by calling the internet access capabilities of other devices, as provided in an embodiment of this application.

[0033] Figure 8 This application provides a schematic diagram illustrating the process of sending data packets in an embodiment of the present application.

[0034] Figure 9A flowchart illustrating a data packet sending method provided in an embodiment of this application;

[0035] Figure 10 This is a schematic diagram of the structure of another terminal device provided in an embodiment of this application;

[0036] Figure 11 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0037] In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. "And / or" in this application is merely a description of the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.

[0038] In the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, a and b and c, where a, b, and c can be single or multiple.

[0039] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.

[0040] Currently, applications installed on terminal devices can send data packets (or messages) through the network connected to the terminal device to perform various services. However, when the network connected to the terminal device experiences an anomaly, the applications installed on the terminal device cannot detect the anomaly and will continue to send data packets. As a result, during the period of network anomaly, the data packets sent by the application may be lost, leading to internet access problems for the application.

[0041] Based on this, embodiments of this application provide a data packet sending method and a terminal device, which can solve the problem that when the network connection of the terminal device is abnormal, the data packets sent by the installed application are lost, thus causing the application to have abnormal internet access.

[0042] For example, Figure 1 This illustration shows a schematic diagram of the architecture of a communication system in which a data packet sending method provided in an embodiment of this application is applied. Figure 1 As shown in Figure (1), the communication system 100 includes a terminal device 101 and a network device 102.

[0043] The terminal device 101 can be used to connect to the network provided by the network device 102, thereby enabling communication with the Internet or other devices. In some embodiments, the terminal device 101 may have an application installed, which can send data packets to the Internet or other devices through the network connected to the terminal device 101, thereby enabling the execution of various services.

[0044] Network device 102 can be used to provide a network to terminal device 101. Exemplarily, this network may include, but is not limited to, wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), cellular networks (such as 3G, 4G, 5G, future public land mobile networks (PLMNs), or the Internet). Exemplarily, network device 102 may include, but is not limited to, wireless access points (APs) and base stations.

[0045] Figure 1 In example (1), terminal device 101 directly connects to the network provided by network device 102. In other embodiments, other terminal devices besides terminal device 101 can connect to the network provided by network device 102. Terminal device 101 can establish a connection with terminal device 103 and then use the network connected to terminal device 103 based on the established connection. That is, terminal device 103 can provide the network it is connected to to terminal device 101. In this embodiment, such as Figure 1As shown in (2), the communication system 110 may also include a terminal device 103. Optionally, the connection between the terminal device 101 and the terminal device 103 can be a network connection, such as a local area network connection, or other connections, such as Bluetooth connections and other communication connections. This application embodiment does not limit the communication method used for the communication connection between the terminal device 101 and the terminal device 103.

[0046] Optionally, an application can also be installed in the terminal device 103. This application can send data packets to the Internet or other devices through the network connected to the terminal device 103, thereby enabling the execution of various services.

[0047] It is understood that, in the embodiments of this application, Figure 1 In the architecture shown in (1), a network anomaly of terminal device 101 can refer to an anomaly in the network provided by network device 102 connected to the terminal device. Figure 1 In the architecture shown in (2), a network anomaly of terminal device 101 can refer to an anomaly in the network provided by network device 102 connected to terminal device 103. Due to the aforementioned network anomaly, data packets sent by applications installed on terminal device 101 may be lost.

[0048] Optionally, in this embodiment, the terminal device, such as terminal device 101 and terminal device 103 described above, may include, but is not limited to, mobile phones, tablets, desktop computers, laptops, handheld computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices, and / or smart city devices. This embodiment does not impose any special restrictions on the specific type of terminal device. Optionally, terminal device 101 and terminal device 103 may be the same type of terminal device or different types of terminal devices.

[0049] Optionally, the operating systems installed on terminal device 101 and terminal device 103 may include, but are not limited to, those shown below. Or other operating systems.

[0050] For example, Figure 2A schematic diagram of the structure of a terminal device provided in an embodiment of this application is shown. This terminal device can be either terminal device 101 or terminal device 103 as described above. Figure 2 As shown, the terminal device 200 may include a processor 110, a memory 120, 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, a button 170, a display screen 180, and a subscriber identification module (SIM) card interface 190, etc.

[0051] Processor 110 may include one or more processing units, such as: application processor (AP), modem (or wireless network card, modem, etc.), graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0052] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0053] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0054] In some embodiments, processor 110 may include one or more interfaces.

[0055] In some embodiments of this application, the processor 110 can be a multi-core processor. A multi-core processor can refer to a processor that integrates two or more processor cores (or computing engines, i.e., the aforementioned processing units). These cores can execute instructions simultaneously, enabling the processor 110 to perform multiple tasks concurrently, thereby improving the overall performance of the system. For example, Figure 3 A schematic diagram of the structure of a processor 110 provided in an embodiment of this application is shown. Figure 3 As shown, processor 110 has an A core and a C core. The A core is the application processor kernel, used for running the terminal device 200 system and applications installed on the terminal device 200. In other words, applications run (or are deployed) on the A core. The C core is the modem kernel, meaning a modem runs on the C core. The C core is responsible for sending various data from the application in the application processor to the outside world and receiving various data sent to the application processor from the outside world. Optionally, inter-process communication (IPC) technology can be used to achieve cross-core communication between different cores.

[0056] The charging management module 140 receives charging input from the charger. While charging the battery 142, the charging management module 140 can also supply power to the terminal device through the power management module 141.

[0057] 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 to power the processor 110, memory 120, display 180, and wireless communication module 160, etc.

[0058] The wireless communication function of the terminal device 200 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem, and baseband processor.

[0059] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 200 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0060] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the terminal device 200. In some embodiments, at least some functional modules of the mobile communication module 150 can be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be housed in the same device.

[0061] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal device 200, 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) technology, etc.

[0062] In some embodiments, antenna 1 of terminal device 200 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling terminal device 200 to communicate with networks and other devices via wireless communication technology. The wireless communication technology 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 technologies, etc.

[0063] In some embodiments of this application, taking terminal device 200 as an example of terminal device 101, the mobile communication module 150 can be used for terminal device 200 to connect to a cellular network. The wireless communication module 160 can be used for terminal device 200 to connect to a Wi-Fi network, or for terminal device 200 to connect to terminal device 103, etc. It can be understood that this embodiment is based on the example that terminal device 101 has the ability to connect to both cellular networks and Wi-Fi networks. In other embodiments, terminal device 101 may only have the ability to connect to a Wi-Fi network. In this embodiment, terminal device 101 may not include the mobile communication module 150 and antenna 1.

[0064] The terminal device 200 implements display functions through a GPU, a display screen 180, and an application processor.

[0065] The display screen 180 is used to display images, videos, etc. The display screen 180 includes a display panel. In some embodiments, the terminal device 200 may include one or N display screens 180, where N is a positive integer greater than 1.

[0066] The memory 120 can be used to store computer executable program code, which includes instructions. The memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc. The data storage area may store data created during the use of the terminal device 200, etc. Furthermore, the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the terminal device 200 by running instructions stored in the memory 120 and / or instructions stored in memory disposed within the processor.

[0067] Button 170 can be a mechanical button or a touch button. Terminal device 200 can receive button input and generate key signal inputs related to user settings and function control of terminal device 200.

[0068] SIM card interface 190 is used to connect a SIM card. Terminal device 200 can support one or N SIM card interfaces, where N is a positive integer greater than 1. Terminal device 200 interacts with the network through the SIM card to realize functions such as making calls and data communication.

[0069] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on terminal device 101 or terminal device 103. In other embodiments of this application, terminal device 101 or terminal device 103 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0070] The technical solutions involved in the following embodiments can all be applied to applications with, for example, Figure 2 The device with the structure shown, and as Figure 1 The system is implemented using the architecture shown. The following describes the technical solutions provided in this application embodiment, taking terminal device 101 as the first terminal device, terminal device 103 as the second terminal device, and network device 102 as the network device, in conjunction with different application scenarios.

[0071] In some scenarios, the first terminal device can directly connect to the network provided by the network device, such as a cellular network or Wi-Fi network. Then, the application installed on the first terminal device (hereinafter referred to as the first application) can use this network to send data packets. For example, taking mobile phone 400 as the first terminal device, and mobile phone 400 connecting to a Wi-Fi network as an example... Figure 4 This diagram illustrates an architecture for a mobile phone accessing a WiFi network according to an embodiment of this application. Figure 4 As shown in the architecture, mobile phone 400 can access the Wi-Fi network provided by wireless access points (such as wireless access point 1, wireless access point 2, etc.). Then, the wireless access points can access the Internet through gateway devices (such as, but not limited to, routers, switches, etc.). In this way, mobile phone 400 can communicate with the Internet. That is to say, the first application installed on mobile phone 400 can send data packets to the Internet.

[0072] Understandable. Figure 4 The architecture shown is based on the example of a first terminal device accessing a Wi-Fi network and the network device being a wireless access point. In other embodiments, the first terminal device can also access other networks, such as cellular networks, and the network device can also be other network devices, such as base stations.

[0073] In this scenario, the first terminal device may perform a path switching operation (such as roaming, handover, etc.), switching from accessing the network provided by one network device to accessing the network provided by another network device. For example... Figure 4 As shown, mobile phone 400 may switch from accessing the network provided by wireless access point 1 to accessing the network provided by wireless access point 2.

[0074] In this scenario, combined Figure 4In the architecture shown, in some embodiments, when mobile phone 400 performs a path switching operation, the network quality of wireless access point 1 is poor, while the network quality of wireless access point 2 is good. That is, mobile phone 400 may perform the path switching operation because the network quality provided by wireless access point 1 is poor. In this embodiment, mobile phone 400 can instruct the first application to pause data packet transmission before starting the path switching operation, i.e., before disconnecting from wireless access point 1 and connecting to wireless access point 2. Then, after the path switching is completed, i.e., after disconnecting from wireless access point 1 and connecting to wireless access point 2, mobile phone 400 instructs the first application to continue sending data packets. Because the network quality of the original network device (such as wireless access point 1) is poor, if the first application continues to send data packets during the path switching process of the first terminal device, the data packets will be transmitted through the network provided by the original network device (such as wireless access point 1), which will lead to data packet loss. Based on the solution in this embodiment, the first terminal device instructs the first application to pause the transmission of data packets before performing path switching, and then instructs the first application to continue transmitting data packets after the switching is completed. This can prevent the first application from transmitting data packets when the network is poor, reduce the probability of data packet loss, and avoid problems such as application network abnormalities (such as lag, data loss, etc.).

[0075] In other embodiments, when mobile phone 400 performs a path switching operation, the network quality of wireless access point 1 is better, and the network quality of wireless access point 2 is also better, but the network quality of wireless access point 2 is higher than that of wireless access point 1. That is, in this embodiment, mobile phone 400 performs the path switching to obtain better network quality. In this embodiment, as a possible implementation, after mobile phone 400 completes the path switching operation, the port used by the gateway device to access the Internet may change compared to the port used by the gateway device before the path switching operation. For example, in this embodiment, taking Transmission Control Protocol / Internet Protocol (TCP / IP) as an example, the port used by the gateway device to access the Internet may include a socket. For an introduction to sockets, please refer to the relevant technical descriptions. Of course, when using other transmission protocols, the port used by the gateway device to access the Internet may also be other ports.

[0076] For example, if the gateway device's internet access port changes from socket 1 (i.e., socket1) to socket 2 (i.e., socket2), the gateway device can indicate this port change to the mobile phone 400. Specifically, after the mobile phone 400 completes the path switching operation, it disconnects from wireless access point 1 and establishes a connection with wireless access point 2. Then, wireless access point 2 connects to the gateway device, and the gateway device no longer accesses the internet through socket1 but through socket2. At this time, since the gateway device only has a connection with wireless access point 2, it can send an indication message to the mobile phone 400 through wireless access point 2 to indicate that the internet access port used by the gateway device has changed. Optionally, this embodiment does not limit the message format for the gateway device to send the indication message to the mobile phone 400.

[0077] When mobile phone 400 receives an instruction from gateway device 400, it can instruct the first installed application to perform a data packet retransmission operation. Correspondingly, the first application responds to the instruction from mobile phone 400 by retransmitting data packets. For example, the first application can retransmit the first n data packets with the sequence number to be sent. The value of n can be determined based on the duration of the path switching operation performed by the first terminal device, the duration and frequency of data packet transmission by the first application, etc., and n can be a positive integer. During the path switching process, the first application installed on the first terminal device will continue to transmit data packets throughout the process. This may result in the gateway device disconnecting the original port from the internet before the first terminal device disconnects from the original network device, but some data packets sent by the first application are still destined for that original port, causing data packet loss. If the application does not support connection on different ports at the receiving end, meaning the receiving end cannot determine whether application data packets from different ports are continuous or if packet loss has occurred, the receiving end may directly aggregate discontinuous application data packets, leading to application internet access problems. Based on the solution in this embodiment, when the port through which the gateway device accesses the Internet changes, it notifies the first terminal device that its own port has changed. The first terminal device can then instruct the first application to resend some data packets, which can ensure that the application data packets received by the data packet receiver are continuous, thus solving the problem of abnormal Internet access for the application.

[0078] In this embodiment, as another possible implementation, after the mobile phone 400 completes the path switching operation, if the port used by the gateway device to access the Internet remains unchanged compared to the port used by the gateway device before the path switching operation, for example, if the port used by the gateway device to access the Internet is socket1 both before and after the path switching operation, then the gateway device does not need to send the aforementioned instruction to the mobile phone 400. Correspondingly, the mobile phone 400 also does not need to send the aforementioned instruction to retransmit the data packets to the first application. Thus, when the port used by the gateway device to access the Internet remains unchanged, the data packets continuously sent by the first application installed on the first terminal device will not be lost, and therefore, no Internet access abnormalities will occur. Therefore, by not sending the aforementioned instruction to the first terminal device, and the first terminal device not needing to instruct the first application to retransmit data packets, the power consumption of the terminal device can be saved while ensuring normal Internet access for the application.

[0079] Of course, in other embodiments, regardless of the reason for the path switching performed by the first terminal device or whether the gateway device's internet access port has changed, once the first terminal device performs the path switching operation, it can instruct the installed first application to pause data packet transmission before performing the path switching operation. Then, after the path switching operation is completed, the first terminal device can instruct the installed first application to resume data packet transmission. In this way, there is no need to determine the network quality provided by the wireless access point, nor does the gateway device need to determine whether the internet access port has changed or send instructions to the first terminal device. This not only reduces the probability of application data packet loss and solves the problem of application internet access abnormalities, but also simplifies the implementation.

[0080] In other scenarios, the first terminal device can indirectly connect to the network provided by the network device. For example, the first terminal device can establish a connection with the second terminal device, and the second terminal device connects to the network provided by the network device, such as a cellular network or a Wi-Fi network, thereby enabling the first terminal device to access the network provided by the network device.

[0081] In this scenario, in some embodiments, the second terminal device has a hotspot function. This hotspot function allows the second terminal device to share its connected network (such as a cellular network, Wi-Fi network, etc.) with the first terminal device, enabling the first terminal device to use this network to send data packets. For example, let's again consider the first terminal device as mobile phone 400 and the second terminal device as mobile phone 500. Figure 5 This illustration shows a schematic diagram of an architecture for mobile phone accessing a network according to an embodiment of this application. Figure 5The architecture shown allows mobile phone 400 to connect to the hotspot function of mobile phone 500, which in turn connects to network 510. Taking a cellular network connection as an example, network 510 could be a core network; taking a Wi-Fi network connection as an example, network 510 could be the internet. It's understandable that network 510, to which mobile phone 500 connects, can be provided by network devices (such as wireless access points or base stations). Therefore, mobile phone 400 can communicate with network 510, meaning the first application installed on mobile phone 400 can send data packets through network 510.

[0082] In this embodiment, the network connected to the second terminal device may experience anomalies, such as due to the second terminal device performing a path switching operation, or a temporary failure between the second terminal device and the connected network (e.g., air interface switching, physical layer failure, etc.). Combined with... Figure 4 In the architecture shown, when the network 510 connected to mobile phone 500 malfunctions, mobile phone 400 can instruct the first installed application to suspend data packet transmission. Simultaneously, mobile phone 500 will perform various network recovery operations, including but not limited to protocol data unit (PDU) reconstruction, radio resource control (RRC) reconstruction, and path switching operations, to restore the connection with network 510. Then, after mobile phone 500 restores the connection with network 510, mobile phone 400 instructs the first application to resume data packet transmission.

[0083] Optionally, the network connected to by mobile phone 500 after performing the network recovery operation can be the same network as the network connected before the network anomaly occurred, or it can be a different network. For example, mobile phone 500 may have connected to a cellular network before the network anomaly occurred, and then connected to a Wi-Fi network after the network recovery. Alternatively, mobile phone 500 may have connected to a cellular network before the network anomaly occurred, and then connected to a cellular network after the network recovery, etc. Optionally, the network recovery operation performed by mobile phone 500 can be triggered by user operation or executed automatically; this embodiment of the application does not impose any limitations on this.

[0084] In this embodiment, after the mobile phone 400 instructs the first application to pause the transmission of data packets, the mobile phone 400 can also pause the data packets already sent by the first application stored in the scheduling kernel. After the mobile phone instructs the first application to resume the transmission of data packets, the mobile phone 400 can also resume the data packets sent by the first application stored in the scheduling kernel to ensure normal internet access.

[0085] Thus, when the first application installed on the first terminal device sends data packets through the network connected to the second terminal device, if the network connected to the second terminal device becomes abnormal, the first application will continue sending data packets, resulting in data packet loss and thus causing application internet access problems. Based on this embodiment, when the network connected to the second terminal device becomes abnormal, the first terminal device notifies the installed first application to pause data packet sending. Then, when the network connected to the second terminal device recovers, the first terminal device notifies the installed first application to resume data packet sending, thus avoiding application data packet loss and resolving the application internet access problems.

[0086] In other embodiments, the first terminal device has the function of accessing the internet (or internet access function, network function, etc.) of the second terminal device. This function enables the first terminal device to access the network by utilizing the internet access capabilities of the second terminal device in the event of a network anomaly. It is understood that the internet access capability of the second terminal device refers to the second terminal device having network access. For example, after the first terminal device connects to a local area network (LAN), it can discover terminal devices connected to the same LAN or logged into the same account. If this terminal device is the second terminal device, the first terminal device can then access the internet access capabilities of the second terminal device to establish a network connection.

[0087] It is understood that, in this embodiment of the application, the second terminal device can be any device with Internet access capability.

[0088] In this embodiment, as one possible implementation, the first terminal device is a device that originally had internet access capability but experienced network anomalies. It can be understood that the first terminal device having internet access capability means that the network accessed by the first terminal device is normal. In this implementation, taking the first terminal device as mobile phone 400 and the second terminal device as mobile phone 600 as an example... Figure 6 This illustration shows a process by which a mobile phone accesses the network by calling the internet access capabilities of other devices, according to an embodiment of this application. Figure 6 As shown, mobile phone 400 first uses its own internet access capabilities to connect to network 610 (such as cellular network, Wi-Fi network, etc.). Correspondingly, the first application installed on mobile phone 400 can send data packets through network 610 that mobile phone 400 has connected to. Then, if network 610 connected to mobile phone 400 malfunctions, mobile phone 400 instructs the first application to pause data packet transmission. Simultaneously, mobile phone 400 begins to utilize the internet access capabilities of mobile phone 600 to connect to network 620. After successful connection, mobile phone 400 instructs the first application to resume data packet transmission. Optionally, network 610 and network 620 can be the same network or different networks. Both network 610 and network 620 can send the first application's data packets to the receiving end (such as an application server).

[0089] Optionally, before accessing the internet capabilities of phone 600, phone 400 can perform a network recovery operation. If the recovery fails, then phone 600's internet capabilities can be accessed. For details on the network recovery operation, please refer to the description above. In this way, when the first terminal device has its own internet capabilities but the network it's connected to is abnormal, it can access the network by accessing the second terminal device. Furthermore, when the first terminal device determines that the network it's accessing is abnormal, it first notifies the installed applications to pause data packet transmission. Then, after successfully accessing the network by accessing the second terminal device's internet capabilities, it notifies the installed applications to resume data packet transmission. This avoids data packet loss caused by continuous transmission during the process of the first terminal device accessing the second terminal device's internet capabilities, thus resolving the application's internet access abnormality problem.

[0090] It is understandable that the network connected to mobile phone 600 can also be provided by network devices (such as wireless access points, base stations, etc.). Optionally, the type of network accessed by mobile phone 600 can be the same as or different from the type of network accessed by mobile phone 400 itself.

[0091] Optionally, in this implementation, after accessing the internet capabilities of mobile phone 600, mobile phone 400 can also monitor whether its own network connection has been restored. If restored, mobile phone 400 can switch to the network it connects to based on its own internet capabilities, such as network 610. Furthermore, the first application installed on mobile phone 400 can continue to send data packets through the network accessed by mobile phone 400 using its own internet capabilities. In this way, once the network accessed by the first terminal device based on its own internet capabilities is restored, it switches back to the network accessed based on its own internet capabilities, avoiding the problem of data packets being unable to be sent by the application installed on the first terminal device after the first terminal device loses connection with the second terminal device, or after the second terminal device's network malfunctions.

[0092] Optionally, the number of the aforementioned second terminal devices can be one or more. When multiple second terminal devices exist, the first terminal device can choose to access the network using the internet access capabilities of any one of the second terminal devices. Optionally, if the network accessed by the accessed second terminal device becomes abnormal, or if an abnormality occurs and the second terminal device performs a network recovery operation but fails, the first terminal device can continue to access the network using the internet access capabilities of any of the remaining second terminal devices, and so on. Optionally, the first terminal device can also continue to access the network using the internet access capabilities of any of the remaining second terminal devices before the network accessed based on its own internet access capabilities is restored. After the network accessed based on its own internet access capabilities is restored, it can directly access the network based on its own internet access capabilities and no longer need to access the network using the internet access capabilities of any of the remaining second terminal devices.

[0093] As another possible implementation, the first terminal device may be a device without internet access. In this embodiment, we will still take mobile phone 400 as the first terminal device and mobile phone 700 as the second terminal device. Figure 7 This illustration shows a process by which a mobile phone accesses the network by calling the internet access capabilities of other devices, according to an embodiment of this application. Figure 7As shown, mobile phone 400 accesses network 710 (such as cellular network, Wi-Fi network, etc.) by utilizing the internet access capability of mobile phone 700. Correspondingly, the first application installed on mobile phone 400 can send data packets through network 710 accessed by mobile phone 700. Then, mobile phone 400 detects that the data packet transmission of the installed first application has failed, i.e., it detects an anomaly in network 710 accessed by mobile phone 700. Mobile phone 400 then sends an instruction message to mobile phone 700, instructing mobile phone 700 to perform a network recovery operation to restore the accessed network. In this embodiment, the method by which mobile phone 400 monitors whether the network accessed by mobile phone 700 is abnormal is not limited. Simultaneously, mobile phone 400 instructs the first application to pause data packet transmission. Correspondingly, after receiving the instruction message, mobile phone 700 performs a network recovery operation, the details of which can be found above. Subsequently, after successful network recovery, mobile phone 700 sends an instruction message to mobile phone 400, indicating that network 710 accessed by mobile phone 400 has been restored. Next, the mobile phone 400 receives an instruction message, instructing the first application to continue sending data packets. In this way, when the first terminal device itself lacks internet access but connects to the network by utilizing the internet access capability of a second terminal device, it can monitor whether any anomalies occur in the network accessed by the second terminal device. If an anomaly occurs, the installed application is instructed to pause data packet transmission; upon restoration, the application is instructed to resume data packet transmission. This avoids the loss of application data packets during periods when the network accessed by the second terminal device is abnormal, thus resolving the issue of application internet access anomalies.

[0094] It is understood that the above example uses mobile phone 400 instructing mobile phone 700 to perform a network recovery operation. In other embodiments, mobile phone 700 can also monitor whether the accessed network is abnormal, and then determine whether to perform a network recovery operation. For example, a second application can also be installed on mobile phone 700, and the second application can also use the network 710 accessed by mobile phone 700 to send data packets. Mobile phone 700 can monitor the data packet sending status of the second application to determine whether the network it is accessing is abnormal, and then determine whether to perform a network recovery operation. This application embodiment does not limit the method by which mobile phone 700 monitors whether the network it is accessing is abnormal. In this embodiment, mobile phone 400 can listen to whether the network accessed by mobile phone 700 is abnormal, and then determine whether to instruct the first application to pause or continue sending data packets.

[0095] In some other scenarios, the primary terminal device uses a multi-core processor, with the primary application and modem running on different cores. Combined with... Figure 3 The processor architecture shown is illustrated using an example of this architecture deployed in a mobile phone 400. Figure 8This diagram illustrates a process of an application sending data packets according to an embodiment of this application. When the first application running in core A finishes sending data packets, it closes the Transmission Control Protocol (TCP) socket used to transmit data packets to the receiving end 800. Then, the first application in core A can send a FIN packet to the receiving end 800 via the modem in core B to close the established TCP connection with the receiving end 800. If the receiving end 800 still has data packets in its buffer that have not yet been sent to the first application, it will continue to send these data packets to the first application. Then, when the modem in core C receives these data packets, it no longer wakes up the first application in core A to send an RST packet; instead, the modem directly sends an RST packet, causing the receiving end 800 to close the TCP connection. In this way, the modem and the first application can be deployed on different cores of the processor. When the first application needs to terminate the TCP connection with the data packet, if the receiving end continues to send the buffered data packet, after the modem receives the data packet, it will not wake up the first application running on other cores to send the RST data packet. Instead, it will act as a proxy for the first application to reply to the data packet receiving end with the RST packet, which can save the power consumption of waking up the core running the first application.

[0096] For example, Figure 9 A flowchart illustrating a data packet sending method provided in an embodiment of this application is shown. Figure 9 As shown, the method includes the following steps:

[0097] S901, The first event occurs in the first terminal device.

[0098] The first terminal device has a first application installed that is transmitting data packets. Optionally, there can be one or more first applications, and the first applications can be of various types. The first event includes at least one of the following: switching access to a network device (or switching access to a network, such as the path switching operation described above), or an anomaly occurring in the accessed network.

[0099] S902, In response to the first event, the first terminal device controls the first application to execute the first operation.

[0100] The first operation includes pausing the transmission of data packets and resuming the transmission of data packets. The first terminal device controlling the first application to perform the first operation can also be described as the first terminal device instructing the first application to perform the first operation, etc.

[0101] In some embodiments, the first event includes switching the accessed network device. Step S902 can be specifically implemented as follows: in response to the first terminal device switching from the accessed first network device to the second network device, the first terminal device controls the first application to pause sending data packets; in response to the first terminal device switching from the accessed first network device to the second network device, the first terminal device controls the first application to resume sending data packets. For example, the first network device and the second network device can be a wireless access point, a base station, etc. For instance, the first network device can be such as... Figure 4 The wireless access point 1 shown, the second network device can be as follows: Figure 4 Wireless access point 2 is shown.

[0102] Optionally, in some implementations, the signal quality of the first network device does not meet the preset conditions, that is, the signal quality of the first network device is poor, while the signal quality of the second network device meets the preset conditions, that is, the signal quality of the second network device is good.

[0103] In other implementations, the signal quality of both the first network device and the second network device may meet preset conditions, but the signal quality of the second network device is better than that of the first network device. For example, the preset conditions may include signal quality greater than or equal to a preset quality threshold.

[0104] In other embodiments, the first event includes a network access failure. Step S902 can be specifically implemented as follows: in response to a network access failure of the first terminal device, the first terminal device controls the first application to suspend sending data packets; in response to the network access of the first terminal device returning to normal, the first terminal device controls the first application to resume sending data packets.

[0105] In this embodiment, in some implementations, the network accessed by the first terminal device is the network of the second terminal device (e.g., Figure 5 Network 510 shown, such as Figure 7 As shown in the network 710, a communication connection is established between the first terminal device and the second terminal device. For example, this communication connection can be established using a hotspot as described above, such as... Figure 5 The application scenario shown can also be achieved by utilizing the internet access capabilities of a second terminal device, as described above. Figure 7 The application scenarios shown.

[0106] Optionally, in this implementation, before the first terminal device controls the first application to resume sending data packets in response to the network access of the first terminal device returning to normal, the first terminal device may instruct the second terminal device to perform a recovery operation (such as the network recovery operation described above). This recovery operation is used to restore the network of the second terminal device, such as... Figure 7 The application scenarios shown.

[0107] Optionally, in this implementation, before the first terminal device controls the first application to resume sending data packets in response to the network access of the first terminal device returning to normal, the second terminal device may indicate to the first terminal device that the network access of the second terminal device has returned to normal, such as... Figure 7 The application scenarios shown.

[0108] In this embodiment, in some implementations, the network accessed by the first terminal device experiences an anomaly; in response to the network accessed by the first terminal device returning to normal, the first terminal device controls the first application to resume sending data packets, specifically implemented as follows: in response to the first terminal device accessing the network of the second terminal device (e.g., Figure 6 As shown in network 620), the first terminal device controls the first application to resume sending data packets, such as... Figure 6 The application scenarios shown.

[0109] Optionally, in this implementation, after the first terminal device controls the first application to resume sending data packets in response to the first terminal device accessing the network of the second terminal device, the first terminal device re-accesses the network of the first terminal device when the network of the first terminal device returns to normal (e.g., ...). Figure 6 (Network 610 shown); The first terminal device controls the first application to continue sending data packets, such as... Figure 6 The application scenarios shown.

[0110] In some embodiments, Figure 9 The method shown may further include: the first terminal device being connected by a first wireless access point (such as...) Figure 4 The wireless access point 1 shown is switched to the second wireless access point (e.g., wireless access point 1). Figure 4 The wireless access point 2 is shown. The first terminal device receives indication information from the gateway device from the second wireless access point. The indication information is used to indicate that the socket of the gateway device has changed. The first terminal device controls the first application to resend n data packets, where n is a positive integer, such as... Figure 4 The application scenarios shown.

[0111] In some embodiments, Figure 9 The method shown may also include: the processor of the first terminal device includes a first core (such as...) Figure 8 The A core shown) and the second core (as shown) Figure 8 The C core shown is used to run the first application and the modem on the second core. When the first application closes the socket and the modem receives a data packet from the receiving end, the modem sends an RST packet to the receiving end, such as... Figure 8 The application scenarios shown.

[0112] The above primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that, in order to achieve the above functions, the terminal device includes hardware structures and / or software modules corresponding to the execution of each function. Based on the units and algorithm steps of the various examples described in the embodiments disclosed in this application, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by a computer driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solutions of the embodiments of this application.

[0113] This application provides embodiments that can divide a terminal device into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the unit division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.

[0114] like Figure 10 The diagram shown is a structural schematic of a terminal device provided in an embodiment of this application. The terminal device 1000 can be used to implement the methods executed by the terminal device described in the above method embodiments. For example, the terminal device 1000 may include a processing unit 1001 and a communication unit 1002.

[0115] As a possible example, taking terminal device 1000 as the first terminal device, the processing unit 1001 is used to support the terminal device 1000 in performing... Figures 1 to 9 The processing function of the first terminal device described in any one of the above, the communication unit 1002, is used to support the terminal device 1000 in performing the following operations. Figures 1 to 9 The communication function of the first terminal device as described in any one of the following.

[0116] As another possible example, taking terminal device 1000 as the second terminal device, the processing unit 1001 is used to support terminal device 1000 in performing... Figures 1 to 9 The second terminal device processing function, communication unit 1002, as described in any one of the above, is used to support the terminal device 1000 in performing the following operations. Figures 1 to 9 The communication function of the second terminal device as described in any one of the above.

[0117] Optional, Figure 10The terminal device 1000 shown may further include a storage unit 1003, which stores programs or instructions. When the processing unit 1001 executes the program or instructions, it causes... Figure 10 The terminal device 1000 shown can execute the method described in the above method embodiments.

[0118] Figure 10 The technical effects of the terminal device 1000 shown can be referred to the technical effects described in the above method embodiments, and will not be repeated here. Figure 10 The processing unit 1001 involved in the terminal device 1000 shown can be implemented by a processor or processor-related circuit components, and can be a processor or a processing module. The communication unit 1002 can be implemented by a transceiver or transceiver-related circuit components, and can be a transceiver or a transceiver module.

[0119] This application also provides a chip system, such as... Figure 11 As shown, the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 are interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices. As another example, the interface circuit 1102 can be used to send signals to other devices (e.g., the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in memory and send those instructions to the processor 1101. When the instructions are executed by the processor 1101, the terminal device can perform the various steps executed by the terminal device in the above embodiments. Of course, the chip system may also include other discrete components, and this application embodiment does not specifically limit this.

[0120] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0121] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0122] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0123] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0124] This application also provides a computer storage medium storing computer instructions, which, when executed on a terminal device, cause the terminal device to perform the methods described in the above-described method embodiments.

[0125] This application provides a computer program product, which includes a computer program or instructions that, when run on a computer, cause the computer to perform the methods described in the above-described method embodiments.

[0126] In addition, this application also provides an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the apparatus to perform the methods in the above-described method embodiments.

[0127] In this embodiment, the terminal device, computer storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0128] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0129] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The embodiments can be combined with or referenced to each other without conflict. The apparatus embodiments described above are merely illustrative; for example, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0130] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0131] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0132] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0133] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data packet sending method, characterized in that, Applied to a first terminal device, the first terminal device having a first application installed for sending data packets, the method includes: The first terminal device experiences a first event, which includes at least one of switching to the accessed network device or an abnormality in the accessed network. In response to the first event, the first terminal device controls the first application to perform a first operation, the first operation including pausing the transmission of the data packet and resuming the transmission of the data packet.

2. The method according to claim 1, characterized in that, The first event includes switching the network device access; In response to the first event, the first terminal device controls the first application to perform a first operation, including: Before the first terminal device switches from the first network device to the second network device, the first terminal device controls the first application to pause sending the data packets; In response to the first terminal device switching from the first network device to the second network device, the first terminal device controls the first application to resume sending the data packets.

3. The method according to claim 1, characterized in that, The first event includes an anomaly occurring in the accessed network; In response to the first event, the first terminal device controls the first application to perform a first operation, including: In response to an anomaly in the network accessed by the first terminal device, the first terminal device controls the first application to suspend sending the data packets; In response to the network accessed by the first terminal device returning to normal, the first terminal device controls the first application to resume sending the data packets.

4. The method according to claim 3, characterized in that, The network accessed by the first terminal device is the network of the second terminal device, and a communication connection is established between the first terminal device and the second terminal device.

5. The method according to claim 4, characterized in that, Before the first terminal device controls the first application to resume sending the data packet in response to the network access of the first terminal device returning to normal, the method further includes: The first terminal device instructs the second terminal device to perform a recovery operation, which is used to restore the network of the second terminal device.

6. The method according to claim 4 or 5, characterized in that, Before the first terminal device controls the first application to resume sending the data packet in response to the network access of the first terminal device returning to normal, the method further includes: The first terminal device receives indication information from the second terminal device, the indication information being used to indicate that the network of the second terminal device has returned to normal.

7. The method according to claim 3, characterized in that, The network accessed by the first terminal device is abnormal; In response to the network accessed by the first terminal device returning to normal, the first terminal device controls the first application to resume sending the data packets, including: In response to the first terminal device accessing the network of the second terminal device, the first terminal device controls the first application to resume sending the data packets.

8. The method according to claim 7, characterized in that, After the first terminal device controls the first application to resume sending the data packet in response to the first terminal device accessing the network of the second terminal device, the method further includes: When the network of the first terminal device returns to normal, the first terminal device reconnects to the network of the first terminal device. The first terminal device controls the first application to continue sending the data packets.

9. The method according to claim 2, characterized in that, The signal quality of the first network device does not meet the preset conditions, while the signal quality of the second network device meets the preset conditions.

10. The method according to claim 1, characterized in that, The method further includes: The first terminal device switches from the first wireless access point to the second wireless access point; The first terminal device receives indication information from the gateway device from the second wireless access point, the indication information being used to indicate that the socket of the gateway device has changed; The first terminal device controls the first application to resend n data packets, where n is a positive integer.

11. The method according to any one of claims 1-10, characterized in that, The processor of the first terminal device includes a first core and a second core, the first application runs on the first core, and the modem runs on the second core; the method further includes: When the first application closes the socket and the modem receives a data packet from the receiving end, the modem sends an RST packet to the receiving end.

12. A terminal device, characterized in that, include: The device includes a processor, a memory, and a communication interface, wherein the memory and the communication interface are coupled to the processor, the communication interface is used to communicate with other devices, the memory is used to store program code including instructions, and the processor reads the instructions from the memory to cause the terminal device to perform the method as described in any one of claims 1-11.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a computer program that, when run on a terminal device, causes the terminal device to perform the method as described in any one of claims 1-11.

14. A computer program product, characterized in that, The computer program product includes: a computer program or instructions that, when run on a computer, cause the computer to perform the method as described in any one of claims 1-11.