Network switching method and related device

Through the system-level network switching method, concurrent connections are established in advance and notification messages are sent, which solves the problem of service lag of electronic devices during network switching, and achieves smooth data transmission and improved user experience.

CN120640360APending Publication Date: 2025-09-12HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410284542.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing electronic devices have problems with service jams and poor user experience during network switching, especially when applications are unable to perceive and cooperate with the switch in a timely manner, resulting in data transmission interruptions and abnormal prompts.

Method used

By detecting network switching requirements at the system level, establishing concurrent connections in advance, and sending notification messages to applications during the switching process, soft switching is achieved, avoiding application-perceived delays and ensuring a smooth transition of data transmission.

Benefits of technology

It achieves a fast and smooth network switching process, improves user experience, avoids business freezes and data transmission interruptions, and ensures the stability and reliability of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120640360A_ABST
    Figure CN120640360A_ABST
Patent Text Reader

Abstract

The invention provides a network switching method and a related device, the method is applied to a first device, and the method comprises the following steps: when a first application program of the first device manages a first session (including a first connection), sending a first message (namely a switching start message) to the first application program, and establishing a second connection of the first session, the first session is used for the first application program to communicate with the second equipment through the first equipment; when the second connection is established, sending a second message (namely a switching completion message) to the first application program; and after receiving the second message, the first application program performs data transmission through the first connection and the second connection (such as concurrent transmission, at the moment, network concurrency is realized), or performs data transmission through the second connection (such as the first connection is closed, at the moment, network switching is realized). According to the invention, fast and smooth network switching can be realized, so that a user cannot perceive the network switching, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Mobile phones and other electronic devices face a variety of network switching scenarios, including switching between different networks, such as wireless fidelity (Wi-Fi) and cellular networks, and switching within the same network, such as recovering after a brief cellular network outage. However, current network switching processes for electronic devices are not smooth. For example, during a network switch, applications on the electronic device may experience service lag and display network anomaly prompts, resulting in a poor user experience. Summary of the Invention

[0003] The present application discloses a network switching method and related devices, which can achieve fast and smooth network switching, making the user unaware of the network switching and improving the user experience.

[0004] In a first aspect, the present application provides a network switching method, which is applied to a first device, and the method includes: when a first application of the first device manages a first session, and the first session includes a first connection (for example, data is transmitted through the first connection at this time), (the system of the first device) sends a first message to the first application (that is, a notification message of the start of switching) and establishes a second connection of the first session, and the first session is used for the first application to communicate through the first device and the second device; when the second connection is established, (the system of the first device) sends a second message to the first application (that is, a notification message of the completion of switching); after the first application receives the second message, it transmits data through the first connection and the second connection (for example, concurrent transmission of copying or shunting, at this time network concurrency of the first connection and the second connection is achieved), or transmits data through the second connection (for example, the first connection is closed, at this time network switching from the first connection to the second connection is achieved).

[0005] In some examples, the first message includes information about the data transmission speed (such as a specific value, level, or adjustment strategy). The first application can control the speed of data transmission through the first connection according to the data transmission speed information in the first message after receiving the first message and before receiving the second message. For example, the data transmission speed information in the first message is an adjustment strategy. In a network switching scenario, the adjustment strategy is to reduce the data transmission rate or data transmission volume. In a network concurrency scenario, the adjustment strategy is not to change the data transmission rate or data transmission volume.

[0006] In some examples, the second message is used by the first application to obtain the resumption of the first session so that the first application can continue to use the first session for data transmission. For example, the first message includes an adjustment strategy for the data transmission speed, and the adjustment strategy is to reduce the data transmission rate or data transmission volume. Therefore, after the first application receives the first message, the data transmission rate or data transmission volume is reduced. After the first application receives the second message, the data transmission rate or data transmission volume can be restored to: the data transmission rate or data transmission volume before receiving the first message.

[0007] In the above method, when the application of the first device manages the first session (including the first connection), the system of the first device can concurrently establish a new second connection, and subsequently choose whether to close the old first connection according to needs. It can be understood that the system of the first device performs soft switching on its own, and the application only needs to manage the valid first session, instead of the application sensing the disconnection of the old connection and then choosing whether to re-establish a new connection (that is, the application cooperates in hard switching). Therefore, there will be no problems such as the application not cooperating to re-establish a new connection, the application not being able to perceive the network switch or perceiving it late, resulting in application service jams, prompts that the network is unavailable, etc., and the system of the first device sends corresponding notification messages to the application before and when the second connection is established, so as to avoid the problem that the application does not perceive the network switching / concurrent process, resulting in the inability to perform normal data transmission after the process. The present application realizes a fast and smooth network switching / concurrent process, thereby improving the user experience.

[0008] In one possible implementation, if the first device detects that the network link of the first session needs to be switched (for example, it detects that the current quality of experience QoE (such as the QoE of the first application) is poor), or the first session needs to achieve concurrent transmission (for example, it detects that the first application has concurrent requirements, and the first application has concurrent requirements in a high-bandwidth download scenario or a stable-latency gaming scenario), (the system of the first device) sends a first message to the first application and establishes a second connection for the first session.

[0009] In the above method, the system of the first device can detect whether the first session requires network switching or network concurrency. When it is detected that the first session requires network switching or network concurrency, a second connection is established in advance before the first connection is closed, thereby avoiding problems such as business freezes and network unavailability prompts caused by the application being unable to perform network switching / concurrency in a timely manner under the required scenario, thereby further improving the user experience.

[0010] In a possible implementation, the method also includes: the first device determines whether the second device meets a preset concurrency condition, wherein the concurrency condition includes at least one of the following: supporting two-way communication address access, supporting fast re-entry of the communication address, supporting data diversion, supporting data replication, supporting data aggregation, supporting two-way connection shared key, supporting Multi-channel Transmission Control Protocol MPTCP, supporting Multi-channel User Datagram Protocol MPUDP, supporting Stream Control Transmission Protocol SCTP, and supporting Hypertext Transfer Protocol HTTP request header Range; when the second device does not meet the concurrency condition, (the system of the first device) closes the first connection. In this case, the first application transmits data through the second connection after receiving the second message (network switching is realized at this time); when the second device meets the concurrency condition, (the system of the first device) does not close the first connection. In this case, the first application can transmit data through the first connection and the second connection after receiving the second message (network concurrency is realized at this time).

[0011] In the above method, the system of the first device can determine whether the second device meets the concurrency condition, thereby determining whether to close the first connection. The application can directly use the connection of the first session for data transmission without the need for the application to cooperate in choosing whether to close the first connection. The implementation of the application is simpler, and it also avoids the scenario where some applications do not cooperate and the network switching cannot be implemented normally, thereby improving the stability of the network switching process.

[0012] In one possible implementation, within a first time period after the first application receives the second message, the first application chooses to use the first connection and / or the second connection for data transmission; when the time period after the first application receives the second message exceeds the first time period, the first device determines whether the second device meets the preset concurrency conditions, and thus determines whether to close the first connection. Therefore, the first time period can be understood as the preset retention time period of the first connection; when the first connection is closed, the first application transmits data through the second connection, and when the first connection is not closed, the first application transmits data through the first connection and the second connection.

[0013] In the above method, the first device can set the first retention time of the first connection instead of directly closing the first connection after the second connection is established. This can avoid the situation where the second connection cannot be used normally in time, resulting in business anomalies of the application, network concurrency cannot be implemented normally, etc., thereby improving the stability of the network switching / concurrency process.

[0014] In one possible implementation, the method also includes: within a first time period after the first application receives the second message, the first application performs at least one of the following: login authentication (for example, obtaining a new token), sending a link change notification to the second device (for example, including information about the second connection), or sending an I frame request to the second device (for example, a video scene).

[0015] In the above method, after the second connection is established, the first application can perform some actions within the first time period during which the first connection is retained, such as notifying the communication counterpart (i.e., the second device) of the second connection, so that the second connection can be used normally for data transmission between the first application and the second device, thereby improving the stability of the network switching / concurrency process.

[0016] In one possible implementation, the method further includes: when first data is stored in the buffer of the first device, (the system of the first device) determines whether the first connection and the second connection support aggregation, wherein the first data is data that the first application failed to successfully send to the second device through the first connection before the second connection is established, such as data that the function write / send / sendto indicates is sent successfully but is not actually sent to the second device successfully; when the first connection and the second connection support aggregation (for example, the first device and the second device can correctly distinguish between data and decoded data at this time), after the second connection is established, (the system of the first device) sends the first data to the second device through the second connection; when the first connection and the second connection do not support aggregation (for example, the first device and the second device cannot correctly distinguish between data and decoded data at this time), (the system of the first device) sends a third message to the first application, and the third message indicates data loss (for example, indicates data loss of the first session).

[0017] In the above method, for the first data that was not successfully sent before the network switching process, the first device can send the first data through a new second connection after the network switching process is completed, or send a data loss notification message to the first application to avoid aggravation of packet loss and improve the reliability of the communication process.

[0018] In one possible implementation, the first application manages the first session by calling the network service system of the first device through the first application, and the connection included in the first session is a transmission protocol or socket encapsulated by the network service system, and the transmission protocol is, for example, the Transmission Control Protocol TCP, the User Datagram Protocol UDP, the Internet Protocol IP, the Hypertext Transfer Protocol HTTP, the Hypertext Transfer Security Protocol HTTPS, the Quick UDP Network Connection QUIC, the Transport Layer Security Protocol TLS, the Datagram Transport Layer Security Protocol DTLS, the File Transfer Protocol FTP, the Stream Control Transmission Protocol SCTP, and the Network Socket WebSocket; or, the first application manages the first session by calling the transmission protocol or socket group of the first device through the first application, and the connection included in the first session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the first session by calling the socket (service) of the first device through the first application, and the connection included in the first session is a socket.

[0019] In the above method, the first session and the connection included in the first session can be deployed in different locations, and the application scenarios are more extensive.

[0020] In one possible implementation, the first connection before sending the second message to the first application may have been established and used to transmit data between the first application and the second device; or, the first connection before sending the second message to the first application is in the process of being established.

[0021] In the above method, the first device can concurrently establish a new second connection while the first connection is being established or after the first connection has been established, without having to worry about whether the network card and the network are normal, and the application scenarios are more extensive.

[0022] In one possible implementation, after the first message is sent to the first application, the first connection undergoes a first change process, wherein the first change process includes: the network link of the first connection is restored after being disconnected at the bottom layer (the IP address of the first connection remains unchanged before and after the first change process), or the first change process includes: after the network link of the first connection is disconnected, the first device re-establishes the network link of the first connection (the IP address of the first connection changes before and after the first change process). Optionally, when the first connection undergoes the first change process, the second connection is established, and the first application performs data transmission through the second connection. For example, the network link corresponding to the first connection is different from the network link corresponding to the second connection.

[0023] In the above method, before the first connection undergoes the first change process, the first device can concurrently establish a second connection to avoid the situation where the first application cannot transmit data normally when the first connection undergoes the first change process, so that the network switching / concurrent process can be faster and smoother, thereby improving the user experience.

[0024] In one possible implementation, the network link corresponding to the first connection and the network link corresponding to the second connection are the same or different. For example, the first connection and the second connection both correspond to the same network link (e.g., a cellular link), but the first connection and the second connection use different IP addresses and / or ports. For example, the first connection and the second connection each correspond to a different network link (e.g., a cellular link and a Bluetooth link).

[0025] In the above method, the network link corresponding to the first connection and the network link corresponding to the second connection can be the same, that is, network switching / concurrency on the same path can be achieved, or they can be different, that is, network switching / concurrency across paths can be achieved, which has a wide range of application scenarios.

[0026] In a second aspect, the present application provides another network switching method, which is applied to a first device, and the method includes: when a first application of the first device manages a first connection (for example, data is transmitted through the first connection at this time), (the system of the first device) sends a first message to the first application, and the first message includes the life cycle of the first connection, and the first connection is used for the first application to communicate with the second device through the first device; the first application establishes a second connection before the end of the life cycle of the first connection according to the first message, and the second connection is used for the first application to communicate with the second device through the first device; after the second connection is established, the first application transmits data through the first connection and the second connection (for example, concurrent transmission of copying or diversion, at this time network concurrency of the first connection and the second connection is achieved), or transmits data through the second connection (for example, the first connection is closed, and network switching from the first connection to the second connection is achieved at this time).

[0027] In some examples, the first message also includes information about the network link corresponding to the old first connection and information about the network link corresponding to the new second connection. The first application can perceive the network switching / concurrency based on the first message.

[0028] In some examples, the above-mentioned first application establishes the second connection according to the first message before the life cycle of the first connection ends, which can also be replaced by: the first application establishes the second connection according to the first message after the life cycle of the first connection ends.

[0029] In the above method, the system of the first device can send a first message to the first application, so that the first application can perceive the network switching / concurrency and the life cycle of the first connection in advance, so that the first application can establish a new second connection in time, for example, concurrently establish a second connection when the first connection exists to achieve soft switching, instead of the application perceiving that the old connection is disconnected and then choosing whether to re-establish a new connection. Therefore, there will be no problems such as the application's inability to perceive the network switching or late perception, which will cause the application's business to be stuck or prompt that the network is unavailable. This application realizes a fast and smooth network switching / concurrency process, thereby improving the user experience.

[0030] In one possible implementation, the method also includes: before (the system of the first device) sends the first message to the first application, when the first application manages the first connection, if the first device detects that the network link of the first connection needs to be switched (for example, it is detected that the current quality of experience QoE (such as the QoE of the first application) is poor), or the first connection needs to achieve concurrent transmission (for example, it is detected that the first application has concurrent requirements), (the system of the first device) sends a second message to the first application (i.e., a notification message of the start of switching), the second message includes information about the data transmission speed (such as a specific value, level or adjustment strategy); the first application controls the data transmission speed of the first connection according to the second message (for example, reduces the data transmission rate or data transmission amount).

[0031] In the above method, the system of the first device can detect whether the first connection requires network switching or network concurrency. When it is detected that the first connection requires network switching or network concurrency, a second message can be sent to the first application, so that the first application can prepare for network switching or network concurrency in advance, thereby making the network switching / concurrency process faster and smoother.

[0032] In a possible implementation, the method further includes: the first application closing the first connection before the lifecycle of the first connection ends according to the first message.

[0033] In the above method, the first application can close the first connection in advance without waiting until the life cycle of the first connection ends. The first application can independently speed up the progress of the network switching process, thereby making the network switching / concurrency process faster and smoother while ensuring the business of the first application.

[0034] In one possible implementation, when the life cycle of the first connection in the first message is greater than a preset length, the first application transmits data through the first connection and the second connection (network concurrency is achieved at this time); when the life cycle of the first connection in the first message is less than or equal to the preset length, the first application transmits data through the second connection (network switching is achieved at this time).

[0035] In the above method, the first application can choose to perform network switching or network concurrency according to the length of the life cycle of the first connection, avoiding the situation where the effect of network concurrency is poor when the life cycle is short, and the communication process is more stable and reliable.

[0036] In a possible implementation, when the first network card is established, a first message is sent to the first application, and the first network card corresponds to the second connection.

[0037] In the above method, the system of the first device can send a first message when the first network card corresponding to the new second connection is established, so that the first application can establish a new second connection based on the first network card without the need for the first application to re-establish the network card corresponding to the second connection, making the application implementation simpler.

[0038] In one possible implementation, the first message also includes behavior information, and the method also includes: before the first application establishes the second connection, performing at least one of the following according to the behavior information: changing the communication address of the first device, changing the version of the communication address of the first device, changing the communication port of the first device, changing the communication address of the second device, changing the communication port of the second device, or triggering system self-healing of the first device, the self-healing of the first device is any one of the following: turning on and off the flight mode of the first device, turning on and off the network switch of the first device, or resetting the communication chip of the first device, for example, in a same-path switching scenario (the network links corresponding to the first connection and the second connection are the same).

[0039] In one possible implementation, the connection managed by the first application (such as the first connection and the second connection) is a socket or a transmission protocol. The transmission protocol is, for example, TCP, UDP, HTTP, HTTPS, QUIC, TLS, DTLS, FTP, SCTP, etc., which has a wide range of application scenarios.

[0040] In one possible implementation, the network link corresponding to the first connection and the network link corresponding to the second connection are the same or different. For example, the first connection and the second connection both correspond to the same network link (e.g., a cellular link), but the first connection and the second connection use different IP addresses and / or ports. For example, the first connection and the second connection each correspond to a different network link (e.g., a cellular link and a Bluetooth link).

[0041] In the above method, the network link corresponding to the first connection and the network link corresponding to the second connection can be the same, that is, network switching / concurrency on the same path can be achieved, or they can be different, that is, network switching / concurrency across paths can be achieved, which has a wide range of application scenarios.

[0042] In a third aspect, the present application provides another network switching method, which is applied to a first device, and the method includes: when a first application of the first device manages a first session, and the first session includes a first connection, the first application transmits data through the first connection, and the first session is used for the first application to communicate with the second device through the first device; when it is detected that a first event is about to begin (for example, at the moment when the first event starts or before the moment when the first event starts), (the system of the first device) sends a first message (i.e., a notification message of the start of switching) to the first application, and the first message is used for the first application not to send data through the first connection; when it is detected that the first event ends (at this time, the network link of the first connection is restored and the IP address of the first connection is restored), (the system of the first device) sends a second message (i.e., a notification message of the completion of switching) to the first application, wherein the first event includes that the network link of the first connection is restored after being disconnected at the bottom layer, and the communication address (i.e., IP address) corresponding to the first connection before the start of the first event is the same as the communication address corresponding to the first connection after the end of the first event, and the first event can be called a same-path switching event with unchanged IP; after receiving the second message, the first application transmits data through the first connection.

[0043] In some examples, the first message includes information about the data transmission speed (such as a specific value, level, or adjustment strategy), and the data transmission speed indicated by the information is 0. Therefore, the first application can set the speed of sending data through the first connection to 0 after receiving the first message and before receiving the second message, that is, not sending data through the first connection, and optionally not receiving data through the first connection.

[0044] In some examples, the second message is used by the first application to obtain the first session resumption, so that the first application continues to use the first session for data transmission.

[0045] In some examples, the network link of the first connection is a cellular communication link, and the first event is any one of the following: cell replacement, loss of synchronization resulting in release of radio resource control (RRC), switching of mobile standards (such as switching from the fifth generation mobile communication technology 5G to the fourth generation mobile communication technology 4G), and communication process of the secondary card of the first device (such as in a dual-card time division multiplexing scenario where the current card cannot send or receive due to preemption of another card). The first event can be understood as a same-path switching event in which packet sending is temporarily unavailable or packet sending is temporarily limited.

[0046] In the above method, when the application of the first device manages the first session (including the first connection), the first connection may have a situation where the IP remains unchanged but packets cannot be sent or packet sending is restricted for a short period of time, that is, a first event occurs. The system of the first device can send corresponding notification messages to the application when the first event is about to begin and when the first event ends, so that the application does not send data when the first event occurs, avoiding buffer data overflow, packet loss, etc. caused by continuous data sending when the first event occurs, and avoiding application service freezes and prompts that the network is unavailable due to failure to successfully send data when the first event occurs. The user is unaware of the first event, thereby achieving a fast and smooth network switching process.

[0047] In one possible implementation, the first application manages the first session by calling the network service system of the first device through the first application, and the connection included in the first session is a transmission protocol or socket encapsulated by the network service system, and the transmission protocol is, for example, TCP, UDP, IP, HTTP, HTTPS, QUIC, TLS, DTLS, FTP, SCTP, WebSocket; or, the first application manages the first session by calling the transmission protocol or socket group of the first device through the first application, and the connection included in the first session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the first session by calling the socket (service) of the first device through the first application, and the connection included in the first session is a socket.

[0048] In the above method, the first session and the connection included in the first session can be deployed in different locations, and the application scenarios are more extensive.

[0049] In a possible implementation, the first message indicates that the same network link in the first session is suspended, and the second message indicates that the same network link in the first session is restored.

[0050] In the above method, the system of the first device can notify the first application program of the switching of the same network link through the first message and the second message, so that the first application program can obtain more detailed information about the network switching.

[0051] In one possible implementation, the method further includes: before the first event starts or when the first event starts, (the system of the first device) establishes a second connection for the first session, the network link corresponding to the second connection is different from the network link corresponding to the first connection, and the second connection is used for data transmission by the first application.

[0052] In the above method, before the first event occurs in the first connection, the first device can concurrently establish a second connection to avoid the situation where the first application cannot transmit data normally during the first event, so that the network switching / concurrency process can be faster and smoother, thereby improving the user experience.

[0053] In one possible implementation, before the first event starts, (the system of the first device) sends a first message to the first application; the method also includes: the first application caches the first data after receiving the first message and before the first event starts; the first application outputs the first data (for example, plays the first data) after the first event starts.

[0054] In the above method, when the system of the first device predicts that the first event is about to begin, it sends a first message to the first application so that the first application caches data in advance. The cached data can be used to implement the business of the first application during the occurrence of the first event, ensuring the normal use of the first application, making the network switching / concurrency process faster and smoother, and improving the user experience.

[0055] In a fourth aspect, the present application provides another network switching method, which is applied to a first device, and the method includes: when a first application of the first device manages a first session, and the first session includes a first connection, the first application transmits data through the first connection, the first session is used for the first application to communicate with the second device through the first device, and the first connection corresponds to a first communication address (such as an IP address); when it is detected that a first event is about to begin (for example, at the moment when the first event starts or before the moment when the first event starts), (the system of the first device) sends a first message (i.e., a notification message of the start of the switching) to the first application; closes the first connection; uses the second communication address to establish a second connection of the first session, wherein the first event includes the release of the network link of the first connection, the second communication address is different from the first communication address, the communication mode of the first connection and the second connection is the same, and the first event can be called a same-path switching event of IP change; when the second connection is established, a second message (i.e., a notification message of the completion of the switching) is sent to the first application; after the first application receives the second message, it transmits data through the second connection.

[0056] In some examples, the first message is used by the first application to obtain that the first session is suspended. In some examples, the second message is used by the first application to obtain that the first session is resumed, so that the first application continues to use the first session for data transmission.

[0057] In some examples, the first event is any one of the following: temporary network disconnection, self-healing, change of the communication address of the first device, change of the communication address of the second device, link failure of the second device (such as link disconnection, IP address and port unavailable, or the link is detected as a dead link, or low priority scheduling, etc.), abnormality of the communication chip of the first device resulting in uplink data but no downlink data or restricted transmission, base station / core network or other intermediate transmission nodes resulting in uplink data but no downlink data or restricted transmission, transmission protocol failure, etc.

[0058] In the above method, when the application of the first device manages the first session (including the first connection), the first connection may experience a network switching situation with an IP change, that is, a first event occurs. The system of the first device can then actively establish a new second connection. This can be understood as the system of the first device realizing network self-healing by itself. The application only needs to manage the valid first session, rather than the application sensing the disconnection of the old connection and then choosing whether to re-establish a new connection (that is, the application cooperates in a hard switch). Therefore, there will be no problems such as the application not cooperating to re-establish a new connection, the application not being able to perceive the network switch or perceiving it late, resulting in application service jams, prompts that the network is unavailable, etc., and the system of the first device sends a corresponding notification message to the application when the first event is about to begin and when the second connection is established, thereby avoiding the problem that the application does not perceive the network switching / concurrency process, resulting in the inability to perform data transmission normally after the process. The present application realizes a fast and smooth network switching / concurrency process, thereby improving the user experience.

[0059] In one possible implementation, the first event includes the communication address of the first session being restored to the second communication address. At this time, the first event can be understood as a same-path switching event in which the IP will automatically recover, such as a temporary network disconnection, self-healing, a change in the communication address of the first device, an abnormality in the communication chip of the first device resulting in uplink data but no downlink data or restricted transmission, etc.; when it is detected that the communication address of the first session is restored to the second communication address, (the system of the first device) uses the second communication address to establish a second connection.

[0060] In the above method, the first event may be a same-path switching event in which the IP is automatically restored. The system of the first device may then establish a second connection based on the automatically restored second communication address, which is more in line with the actual network environment.

[0061] In one possible implementation, the first event does not include restoring the communication address of the first session. In this case, the first event can be understood as a same-path switching event in which the IP will not automatically recover. The first event may be caused by an abnormality in the second device (for example, a change in the communication address of the second device, a link failure of the second device, etc.), or the first event is caused by an abnormality in the node between the first device and the second device (for example, the base station / core network or other intermediate transmission node causes uplink data but no downlink data or restricts transmission), or the first event is caused by an abnormality in the transmission protocol (for example, no downlink water, TCP zero window, the transport layer does not perceive the air interface, and other TCP abnormalities); in this case, the system of the first device can determine to execute at least one of the following: changing the communication address of the first device, changing the version of the communication address of the first device, changing the communication port of the first device, changing the communication address of the second device, changing the communication port of the second device, or triggering the system self-healing of the first device. The self-healing of the first device is any one of the following: turning on and off the flight mode of the first device, turning on and off the network switch of the first device, or resetting the communication chip of the first device; and then using the second communication address to establish a second connection.

[0062] In the above method, the first event can be a same-path switching event in which the IP will not automatically recover. The system of the first device can then change the IP, change the port, etc., and then establish a second connection based on the second communication address. In this way, the system can "manually" restore the network in the scenario where the IP will not automatically recover, so that the network switching process can be implemented normally, thereby allowing the first application to communicate normally with the second device through the second connection.

[0063] In a possible implementation, the first message indicates that the same network link in the first session is suspended, the second message indicates that the same network link in the first session is restored, and the second message indicates that the first session is re-entered or the communication address is changed.

[0064] In the above method, the system of the first device can notify the first application of the switching of the same network link, reentry or change of the communication address through the first message and the second message, so that the first application can obtain more detailed information about the network switching.

[0065] In one possible implementation, after the first application receives the second message, the first application performs at least one of the following: login authentication (for example, obtaining a new token), sending a link change notification to the second device (for example, including information about the second connection), or sending an I frame request (for example, a video scene) to the second device; then, the first application transmits data through the second connection.

[0066] In the above method, after the second connection is established, the first application can perform some actions, such as notifying the communication counterpart (i.e., the second device) of the second connection, so that the second connection can be used normally for data transmission between the first application and the second device, and then the first application uses the second connection again, thereby improving the stability of the network switching / concurrency process.

[0067] In one possible implementation, the method further includes: when first data is stored in the buffer of the first device, (the system of the first device) determines whether the first connection and the second connection support aggregation, wherein the first data is data that the first application failed to successfully send to the second device through the first connection before the start of the first event, such as data that the function write / send / sendto indicates is sent successfully but is not actually sent to the second device successfully; when the first connection and the second connection support aggregation (for example, the first device and the second device can correctly distinguish between data and decoded data at this time), after the second connection is established, (the system of the first device) sends the first data to the second device through the second connection; when the first connection and the second connection do not support aggregation (for example, the first device and the second device cannot correctly distinguish between data and decoded data at this time), (the system of the first device) sends a third message to the first application, and the third message indicates data loss (for example, indicates data loss of the first session).

[0068] In the above method, for the first data that was not successfully sent before the network switching process, the first device can send the first data through a new second connection after the network switching process is completed, or send a data loss notification message to the first application to avoid aggravation of packet loss and improve the reliability of the communication process.

[0069] In one possible implementation, the first application manages the first session by calling the network service system of the first device through the first application, and the connection included in the first session is a transmission protocol or socket encapsulated by the network service system, and the transmission protocol is, for example, TCP, UDP, IP, HTTP, HTTPS, QUIC, TLS, DTLS, FTP, SCTP, WebSocket; or, the first application manages the first session by calling the transmission protocol or socket group of the first device through the first application, and the connection included in the first session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the first session by calling the socket (service) of the first device through the first application, and the connection included in the first session is a socket.

[0070] In the above method, the first session and the connection included in the first session can be deployed in different locations, and the application scenarios are more extensive.

[0071] In one possible implementation, the method also includes: before the first event starts or when the first event starts, (the system of the first device) establishes a third connection for the first session, the network link corresponding to the third connection is different from the network link corresponding to the first connection, and the network link corresponding to the third connection is also different from the network link corresponding to the second connection, and the third connection is used for data transmission by the first application.

[0072] In the above method, before the first event occurs in the first connection, the first device can concurrently establish a third connection to avoid the situation where the first application cannot transmit data normally during the first event, so that the network switching / concurrency process can be faster and smoother, thereby improving the user experience.

[0073] In one possible implementation, before the first event starts, (the system of the first device) sends a first message to the first application; the method also includes: after receiving the first message and before the first event starts, the first application caches the second data; after the first event starts, the first application outputs the second data (for example, plays the second data).

[0074] In the above method, when the system of the first device predicts that the first event is about to begin, it sends a first message to the first application so that the first application caches data in advance. The cached data can be used to implement the business of the first application during the occurrence of the first event, ensuring the normal use of the first application, making the network switching / concurrency process faster and smoother, and improving the user experience.

[0075] In one possible implementation, the method also includes: when it is detected that the first event is about to begin, (the system of the first device) sends a fourth message (i.e., a notification message of the start of switching) to the first module of the first device, and the first module is used to control the display status of the network indicator in the signal bar of the first device, where the network indicator is, for example, an indicator of a cellular network and a corresponding data service arrow, or an indicator of a Wireless Fidelity Wi-Fi network and a corresponding data service arrow; the first module controls the network indicator in the signal bar of the first device to be displayed in a normal state (e.g., indicating that the network state is normal), or the first module controls the time interval of the change of the network indicator in the signal bar to increase; when the second connection is established, a fifth message (i.e., a notification message of the completion of switching) is sent to the first module.

[0076] In some examples, the fourth message includes the duration of the network switching process (such as the duration between the start time of the first event and the time of sending the fifth message), and the first module can control the display status of the network indicator in the signal bar according to the duration.

[0077] In some examples, the fifth message is used by the first module to obtain the end of the network switching process so that the first module can resume control of the display status of the network indicator in the signal bar, that is, normally control the display status of the network indicator in the signal bar.

[0078] In the above method, the system of the first device sends corresponding notification messages to the first module when the first event is about to begin and when the second connection is established, so that the first module can control the display status of the network indicator in the signal bar, for example, always keeping the network in a normal state, and the user is unaware of the network switching process or the perception is not obvious, so that the network switching / concurrency process can be smoother and the user experience is improved.

[0079] The first application in the above-mentioned first aspect, second aspect, third aspect and fourth aspect, and any implementation of the first aspect, second aspect, third aspect and fourth aspect can also be replaced by: a third-party library or a transmission protocol, wherein the third-party library is, for example, a third-party library of the application layer, and the transmission protocol is, for example, TCP, UDP, HTTP, HTTPS, QUIC, TLS, DTLS, FTP, SCTP, etc.

[0080] In a fifth aspect, the present application provides an electronic device comprising a transceiver, a processor, and a memory; the memory is used to store a computer program, and the processor calls the computer program, so that the electronic device executes the first aspect, the second aspect, the third aspect, and the fourth aspect, as well as the network switching method provided by any one of the implementation methods of the first aspect, the second aspect, the third aspect, and the fourth aspect.

[0081] In a sixth aspect, the present application provides a computer storage medium storing a computer program, which, when executed by a processor, is used to execute the network switching method provided by the first aspect, the second aspect, the third aspect and the fourth aspect, as well as any one of the implementations of the first aspect, the second aspect, the third aspect and the fourth aspect.

[0082] In the seventh aspect, the present application provides a computer program product, which, when running on a device, enables the device to execute the network switching method provided by the first aspect, the second aspect, the third aspect and the fourth aspect, as well as any one of the implementation methods of the first aspect, the second aspect, the third aspect and the fourth aspect.

[0083] In an eighth aspect, the present application provides an electronic device, the electronic device including a method or apparatus for executing any aspect or implementation of the present application. The electronic device is, for example, a chip.

[0084] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single implementation. On the contrary, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution or beneficial effect is included in at least one implementation. Therefore, the description of a technical feature, technical solution or beneficial effect in this application does not necessarily refer to the same implementation. Furthermore, the technical features, technical solutions and beneficial effects described in this application can also be combined in any appropriate manner. Those skilled in the art will understand that this application can be implemented without one or more specific technical features, technical solutions or beneficial effects of a specific implementation. In other implementations, additional technical features and beneficial effects can also be identified in specific implementations that do not embody all implementations. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] The following is an introduction to the drawings used in this application.

[0086] Figure 1A and Figure 1B Schematic diagrams showing some cross-path switching;

[0087] Figure 1C-1E Schematic diagrams showing some same-path switching;

[0088] Figure 2A-2C Schematic diagrams of user interfaces in some network switching / concurrency scenarios are exemplified;

[0089] Figure 3 This is a schematic diagram of the architecture of a communication system provided by this application;

[0090] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided by this application;

[0091] Figure 5 This is a schematic diagram of the software architecture of an electronic device provided by this application;

[0092] Figure 6-Figure 8 It is a schematic diagram of the architecture of some electronic devices provided by this application;

[0093] Figure 9 This is a schematic diagram of a network switching / concurrency process provided by this application;

[0094] Figure 10 and Figure 11 This is a flowchart of some network switching methods provided by this application;

[0095] Figure 12 This is a schematic diagram of another network switching / concurrency process provided by this application;

[0096] Figure 13 This is a flowchart of another network switching method provided by the present application;

[0097] Figure 14 This is a schematic diagram of another network switching / concurrency process provided by this application;

[0098] Figure 15 This is a flowchart of another network switching method provided by the present application;

[0099] Figure 16 This is a schematic diagram of another network switching / concurrency process provided by this application;

[0100] Figure 17 and Figure 18 is a flowchart of some other network switching methods provided by this application;

[0101] Figures 19-23 This is a schematic diagram of some network switching / concurrency processes provided by this application;

[0102] Figure 24 This is a schematic diagram of a service avoidance process provided by this application;

[0103] Figures 25-28 This is a schematic diagram of some network switching / concurrency processes provided by this application;

[0104] Figure 29 This is a schematic diagram of a cache retransmission process provided by this application;

[0105] Figure 30 This is a schematic diagram of a discard notification process provided by this application;

[0106] Figure 31 This is a schematic diagram of the architecture of another electronic device provided by this application;

[0107] Figure 32-Figure 34 This is a schematic diagram of some network switching / concurrency processes provided by this application;

[0108] Figures 35-38 This is a flowchart of some other network switching methods provided by this application. DETAILED DESCRIPTION

[0109] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings. The terms used in the implementation methods of the embodiments of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.

[0110] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0111] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0112] The network link (path) of an electronic device can undergo migration / handover, i.e., network (NW) handover. Network handover scenarios vary, and can be mainly divided into cross-path handover scenarios and same-path handover scenarios. The following examples illustrate these two scenarios.

[0113] Cross-path switching refers to migrating / switching from one network link to another. For example, switching between a wireless fidelity (Wi-Fi) network and a cellular network, or switching between a primary card and a secondary card of an electronic device, or switching between a single card and a dual card of an electronic device, or performing Wi-Fi roaming (switching of wireless access points (APs)). The card of the electronic device (i.e., the phone card) may be, but is not limited to, a subscriber identity module (SIM) card or a universal subscriber identity module (USI) card. Cross-path switching can be manually triggered by the user. For example, when the mobile phone turns on both the Wi-Fi network and the cellular network at the same time, the mobile phone will use the Wi-Fi link to access the Internet. When the user manually turns off the Wi-Fi network of the mobile phone, the mobile phone will switch from the Wi-Fi link to the cellular link to use the cellular link to access the Internet. Not limited to this, cross-path switching can also be self-detected and switched by the electronic device based on mobility, network quality, user experience requirements, etc., such as performing cross-path switching when the network experience is poor.

[0114] Cross-path switching can be switching / migration between two near-field network links, such as switching between a Wi-Fi network and Bluetooth (BT). Cross-path switching can also be switching between two far-field network links, such as switching between a cellular network and a satellite network. Cross-path switching can also be switching between a near-field network link and a far-field network link. For example, when you are at home, your mobile phone is connected to smart devices (such as printers, sweeping robots, speakers, smart homes, large screens, watches, etc.) through near-field communication (such as Wi-Fi, Bluetooth). After going out, the connection between the above mobile phone and the smart device will be automatically disconnected, and the mobile phone will be reconnected to the smart device at home through far-field communication (such as cellular). For example, users can switch between near-field network links and far-field network links while moving.

[0115] Intra-path handover refers to switching / migration on a network link, such as reconnecting a network link after a disconnection. Intra-path handover scenarios can include, but are not limited to, temporary network loss, Internet Protocol (IP) changes, self-healing (including data service self-healing or chip resets), temporary packet transmission failure, temporary packet transmission restriction, server errors, and bad links. These scenarios are likely to result in a temporary loss of network and IP, making it impossible to use the network link to transmit data packets. Exemplarily, the same-path handover scenario of a cellular network is as follows: a temporary network disconnection may occur in an elevator, basement, or no-signal area, an IP change may occur in scenarios such as packet data network (PDN) being modified by the network (PDNmodifybyNW), session and service continuity (SSC) mode 2, SSCmode 3, etc., self-healing may be performing recovery (such as getting a data status list (getdatacalllist), PDN deactivation and reactivation (PDNdeactivereactive, PDR) reactivation (reactive, react), re-attachment, restarting the cellular system (restartradio)), application processor (application processor, AP) self-healing, modem processor (modem) self-healing, modem reset (reset), temporary packet transmission failure / temporary packet transmission restriction may be radio resource control (RRC) release and reconstruction (such as elevator background search, loss of synchronization, etc.), changing cells, changing radio access technology (radio access technology) technology, RAT) standard (such as redirection, reselection, same-frequency and different-frequency switching, etc.), operator speed limit (for example, traffic package is used up, etc.), low-speed data transmission (referred to as low-data transmission) (for example, weak network, low power consumption, star network, low scheduling based on system performance, etc.), dual-card concurrency cannot be used (for example, time-division multiplexing technology (TDM)), prohibition of sending and receiving certain flows based on performance or power consumption, and switching of mobile standards.Exemplarily, the scenarios for same-path switching of a Wi-Fi network are as follows: a brief network disconnection may occur during sudden interference or a critical disconnection of a weak signal, an IP change may be an inter-router switch, self-healing may be a dynamic host configuration protocol (DHCP) update (renew), Wi-Fi reassoc (Wi-Fi reassoc), or a Wi-Fi chip reset (reset), and a brief inability to send packets / briefly limited packet sending may be enterprise AP roaming.

[0116] The network switching scenario is not limited to the above example. There can also be network concurrency scenarios (i.e., using multiple network links for transmission and reception at the same time). Network concurrency scenarios can also include cross-path concurrency and same-path concurrency. The specific description is similar to that of the above network switching scenario. The difference is that in the network concurrency scenario, multiple network links will be used for transmission and reception at the same time after the network changes. This will not be repeated here. In the following embodiments, network switching and network concurrency may be collectively referred to as network switching / concurrency.

[0117] Currently, an application (APP) on an electronic device can establish at least one communication flow (hereinafter referred to as an APP flow) with a communication peer through the electronic device to achieve communication with the communication peer. In this case, the APP flow is a Berkeley socket (BSD socket) (hereinafter referred to as a socket). A socket can be understood as an abstract endpoint for bidirectional communication between APP processes on different hosts in a network. A socket can be an interface for encapsulating protocols in the transport layer. Sockets can be divided into three types: stream sockets (sock_stream), datagram sockets (sock_dgram), and raw sockets (sock_raw). Stream sockets are used to provide connection-oriented, reliable data transmission services, primarily for the Transmission Control Protocol (TCP) services in the transport layer. Datagram sockets are used to provide connectionless data transmission services, primarily for the User Datagram Protocol (UDP) services in the transport layer. Raw sockets allow direct access to lower-layer protocols (such as IP and Internet Control Message Protocol (ICMP) at the network layer, protocols at the data link layer, etc.), for example, receiving ICMP packets through raw sockets, receiving IP packets that the TCP / IP protocol stack cannot process, or sending IP packets with custom headers or custom protocols. In the aforementioned network switching / concurrency scenario, a network link can correspond to a socket of an electronic device. It is understandable that a communication requires a pair of sockets, so the aforementioned network link also corresponds to a socket at the communication peer of the electronic device. The above network / concurrent behaviors all need to be initiated by the APP.

[0118] Figure 1A A schematic diagram illustrating a cross-path switching is shown as an example.

[0119] like Figure 1AAs shown, APP1 first manages socket1. Before time t1, APP1 can transmit data through socket1. From time t1 to time t2, the network link (path) corresponding to socket1 releases the link, and socket1 is closed (closed) (for example, TCP reset (reset) etc.). In the embodiment of the present application, the execution order of the link release of the path corresponding to the socket and the socket closing is not limited. The link release in the embodiment of the present application can be the release of the underlying physical link. At this time, there is no corresponding IP. For example, the link release can include the network card down. For example, the link release of the cellular communication mode can include the bearer release and the RRC release. At the time t2 of the link release, the system of the electronic device can report the network card change notification / link status change notification to APP1. The network card change notification / link status change notification can include the information of the path before the change (that is, the path corresponding to socket1) and the information of the path after the change (for example, the path corresponding to socket2 described below). After APP1 senses that socket1 is closed or receives a network card change notification / link status change notification, it can determine whether to re-establish the network link. If the judgment result is yes, then from time t3 to time t4 after time t2, APP1 re-establishes the network link (for example, including turning on a new network card). The new network link established at this time corresponds to the new socket2. After time t4 when the new network link is established, APP1 can transmit data through the new socket2. Among them, time t1 to time t4 is the time when data transmission is unavailable.

[0120] For example, Figure 1A An example of cross-path switching is a full network switch of the electronic device 100, i.e., the network link for communication of the electronic device is switched from one network link to another. For example, in this case, the old network card can be shut down first, and the new network card can be turned up. Accordingly, the old path can first release the link, and the new path can then re-establish the link. The new path and the old path do not support concurrency. Among them, the full network switch is, for example, a default route switch, such as switching the default route from a Wi-Fi network to a cellular network or from a cellular network to a Wi-Fi network.

[0121] Figure 1B A schematic diagram exemplarily shows another cross-path switching.

[0122] Figure 1B and Figure 1ASimilar, the difference is that during the link release process of the network link corresponding to socket1, that is, between time t1 and time t2 (assuming time t5, t5 can be greater than or equal to t1), the system of the electronic device reports a cross-network notification to APP1. The cross-network notification may include information about the path before the cross-network (that is, the path corresponding to socket1) and the path after the cross-network (for example, the path corresponding to socket2 described below). After receiving the cross-network notification, APP1 can determine whether to re-establish the network link. If the judgment result is yes, then at time t3 (t3 is greater than t5) during the above-mentioned link release process, APP1 re-establishes the network link (for example, including turning on a new network card). The new network link established at this time corresponds to the new socket2. The time t3 for starting the link establishment can be before the time t2 when the link release is completed, but is not limited to this. It can also be the same as t2 or after t2, that is, the size of t3 and t2 is not limited. Among them, time t1 to time t4 is the time when data transmission is unavailable. In Figure 1B In the cross-path switching scenario shown, t3 can occur before t2. Therefore, the old network card (corresponding to socket 1) and the new network card (corresponding to socket 2) can coexist. App 1 can close socket 1 and establish socket 2 at the same time to restore communication.

[0123] The above cross-path handover is a hard handover (i.e., disconnection before reconnection), which cannot be implemented as a soft handover or concurrently. The app detects the link handover when the link is released, or during the link release process, and then determines whether to reestablish the link. Late detection results in delayed link reestablishment, resulting in a longer link handover process and strong reliance on app cooperation (e.g., requiring the app to reestablish the network link, rebind a new network interface card, retry the service, and redo the domain name system (DNS) query).

[0124] Figure 1C A schematic diagram exemplarily shows a same-path switching (eg, a temporary network disconnection).

[0125] like Figure 1CAs shown, APP1 first manages socket1. Before time t6, APP1 can transmit data through socket1. At time t6, the network card is turned off (down), and the packet data protocol (PDP) is deactivated (PDPde-act). At this time, there is no IP, and APP1 can sense that the network card is turned off and there is no IP. From time t6 to time t7, the network link corresponding to socket1 releases the link. At time t8 after time t7, PDP is activated successfully (PDP acts successfully). At this time, there is an IP, and the network card is turned on (up). After APP1 senses that the network card is turned on and there is an IP, it can determine whether to re-establish the network link. If the judgment result is yes, then from time t8 to time t9, APP1 re-establishes the network link. The new network link established at this time corresponds to the new socket2. After time t9, APP1 can transmit data through the new socket2. Among them, time t6 to time t9 is the time when data transmission is unavailable.

[0126] Figure 1D A schematic diagram exemplarily shows another same-path switching (eg, self-healing).

[0127] like Figure 1D As shown, APP1 first manages socket1. Before time t6, APP1 can transmit data through socket1. At time t6, the wireless communication function of the electronic device is turned off (CFUN=0), and the network will be disconnected at this time. APP1 can sense the network disconnection. From time t6 to time t7, the network link corresponding to socket1 is released. After time t7 when the release is completed, you can first stay on the network (for example, in a cellular scenario, it is to stay in a cell, and in a Wi-Fi scenario, it is to connect to a Wi-Fi access point). The time when the network is successfully settled is time t8. At time t8, PDP acts successfully. At this time, there is an IP and the network card is turned on. APP1 can sense that the network is successfully settled, the network card is turned on, and there is an IP. It can then determine whether to re-establish the network link. If the judgment result is yes, then from time t8 to time t9, APP1 re-establishes the network link. The new network link established at this time corresponds to the new socket2. After time t9 when the new network link is established, APP1 can transmit data through the new socket2. Among them, time t6 to time t9 is the time when data transmission is unavailable.

[0128] Figure 1E A schematic diagram exemplarily shows another same-path switching.

[0129] like Figure 1EAs shown, APP1 first manages socket1. Before time t6, APP1 can transmit data through socket1. From time t6 to time t7, the network link corresponding to socket1 releases the link. At time t8 after time t7, the network and / or IP is restored, such as network loss recovery, IP change completion, self-healing recovery, etc., the new network card is turned on again, and the system of the electronic device can report a network available (nwavailable) notification to APP1. After APP1 receives the nwavailable notification, it can determine whether to re-establish the network link. If the judgment result is yes, APP1 re-establishes the network link from time t8 to time t9. The new network link established at this time corresponds to the new socket2. After time t9 when the new network link is established, APP1 can transmit data through the new socket2. Among them, time t6 to time t9 is the time when data transmission is unavailable.

[0130] In the above-mentioned same-path switching scenario, the socket managed by the APP is disconnected, and there may be a brief period of no network and / or no IP, or the local IP may be changed. When the network and / or IP is restored, the APP can perceive it. After perception, the APP will determine whether to rebuild the link. The late perception will lead to late reconstruction of the link. In addition, the APP cannot perceive dead links, link failures or failures of the communication counterpart (such as the server). The APP cannot know that the disconnected network link will be restored soon or needs to be rebuilt quickly. Therefore, it will be treated as a general no-network and no-IP scenario. The business will be stuck and may be prompted that the network is unavailable, which is highly dependent on the cooperation of the APP. The above-mentioned same-path switching is a hard switch (i.e., disconnect first and then connect), which cannot achieve soft switching or concurrent scenarios.

[0131] Figure 2A-2C Schematic diagrams of user interfaces in some network switching / concurrency scenarios are exemplified. Figure 2A-2C The cellular communication mode is used as an example for explanation. Other communication modes are similar and will not be described in detail.

[0132] like Figure 2A As shown, the electronic device can display a user interface 210, which may include a status bar 211 at the top and a chat application window 212. The status bar 211 may include a cellular network indicator 211A and a data service arrow 211B. The indicator 211A may be a fifth generation mobile communication technology (5G) with 4 signal bars (i.e., full bars), indicating that the current cellular network is normal and of good quality. The data service arrow 211B indicates that data is currently being sent and received through the cellular network. Figure 2A The user interface 210 shown may be a user interface displayed during normal data transmission.

[0133] like Figure 2B As shown, the electronic device can display the user interface 220, the user interface 220 and Figure 2A The user interface 210 shown is similar, except that in the user interface 220, the status bar 211 includes an indicator 211A for the cellular network, but does not include a data service arrow 211B, and the chat application window 212 also includes a prompt message 212A ("Currently unable to connect to the network").

[0134] like Figure 2C As shown, the electronic device can display a user interface 230, the user interface 230 and Figure 2A The user interface 210 shown is similar, except that, in the user interface 230, the status bar 211 includes an indicator 211A for the cellular network, but does not include a data service arrow 211B, and the current signal of the indicator 211A is grayed out and includes an ×, indicating that the current cellular network is abnormal / cannot be connected to the cellular network, and the chat application window 212 also includes a prompt message 212A ("Currently unable to connect to the network").

[0135] Figure 2B The user interface 220 and Figure 2C The illustrated user interface 230 may be the user interface displayed before the network is restored.

[0136] For example, assuming that APP1 is a chat application, Figure 1C In the same path switching shown, before time t6, the electronic device can display Figure 2A In the user interface 210 shown, at time t6, the network card is turned off and there is no IP. At this time, the electronic device can cancel the display of the data service arrow 211B, and optionally display a prompt message that the network is unavailable, such as displaying Figure 2B The user interface 220 shown in FIG. 2 is not displayed until the link is established at time t9, at which time the electronic device can resume displaying the data service arrow 211B, i.e., displaying Figure 2A User interface 210 is shown.

[0137] For example, assuming that APP1 is a chat application, Figure 1D In the same path switching shown, before time t6, the electronic device can display Figure 2A The user interface 210 shown in FIG. 210 is disconnected at time t6. At this time, the signal displayed by the electronic device can be grayed out, and the data service arrow 211B can be canceled. Optionally, a prompt message indicating that the network is unavailable can be displayed, such as a message indicating that the network is unavailable. Figure 2C The user interface 230 shown in FIG. 2 is not displayed until time t8 when the network is successfully established, the network card is turned on and an IP address is available. At this time, the signal displayed by the electronic device can be restored, for example, Figure 2BThe user interface 230 shown in FIG. 2 is then displayed. The link is then established at time t9. The electronic device can then resume displaying the data service arrow 211B. Figure 2A User interface 210 is shown.

[0138] The above-mentioned network switching process is not smooth enough. In the above-mentioned network switching scenario, the network link will be released, but the APP may not be able to perceive it or perceive it at a late time. For example, in the above-mentioned cross-path switching and same-path switching examples, for example, the remote IP change, transmission path failure (such as hanging, reset, current limiting, congestion, etc.) leads to the current link failure, link self-healing, etc., which makes it impossible to rebuild the link or rebuild the link at a late time. It is easy for the APP business to be stuck, the APP to prompt that the network is unavailable, etc. The user can perceive the network switching through the interface change, and the experience is not good. Moreover, even if the network link is sensed to be released, the APP will determine whether to rebuild the link. Some APPs will rebuild, but some APPs may not rebuild, resulting in the APP that is not rebuilt being unable to use the network normally, such as network disconnection.

[0139] Similarly, the transport protocol is unable to perceive the release of the network link or perceives it late, and often only performs blind retries (i.e., attempts to transmit data at intervals, with the intervals gradually increasing). The link cannot be reestablished in time, and the network switching process is not fast or smooth enough. Furthermore, the data from the blind retries will occupy the cache queue, and the data redundancy of the blind retries will affect the actual transmission and reception of business data (for example, exacerbating congestion), resulting in poor air interface characteristics. Examples of transport protocols include, but are not limited to, TCP, UDP, IP, Hypertext Transfer Protocol (HTTP), Hypertext Transfer Protocol Secure (HTTPS), Quick UDP Internet Connections (QUIC), Transport Layer Security (TLS), Datagram Transport Layer Security (DTLS), File Transfer Protocol (FTP), Stream Control Transmission Protocol (SCTP), WebSocket, etc.

[0140] An embodiment of the present application provides a network switching method, which is applied to an electronic device 100. The APP of the electronic device 100 can manage (also known as maintain) a session, which can correspond to at least one connection (such as a socket). The handover or concurrency of the connection is implemented by the system of the electronic device 100, and the details of the switching / concurrency are shielded from the APP. It can be understood that the "system switching" in the embodiment of the present application replaces the "APP flow disconnection" in the above-mentioned network switching scenario, and the "system must rebuild the link" in the embodiment of the present application replaces the "APP cooperates with link reconstruction" in the above-mentioned network switching scenario. For the APP, no matter how many connections there are, no matter what state the connection is in (such as disconnected, establishing, established, etc.), the APP always manages a normal session, and it is simpler for the APP to use the network link. There is no need to pay attention to the network card (such as no need to bind the network card) or pay attention to details. Moreover, at the start and end time of the switching or concurrency of the connection, the system of the electronic device 100 can send a notification to the APP (including a handover start notification and a handover complete notification) to avoid the APP not being able to perform data transmission normally after the switching or concurrency due to the APP not being aware (for example, the APP not being aware causes the APP not to perform the first action described below, the APP not being aware causes the transmission protocol used to be abnormal, or the APP not being aware causes the encrypted message and the dependent message to be unable to be transmitted normally, etc.). The embodiment of the present application does not need to rely on the cooperation of the APP, so there will be no problems caused by the above-mentioned APP not being able to perceive or perceive late, nor will there be the problem that the above-mentioned APP cannot use the network normally due to non-reconstruction. The embodiment of the present application also does not require the transport layer to rebuild the link, so there will be no problems caused by the above-mentioned transport layer not being able to perceive or perceive late. In other words, the embodiment of the present application can achieve fast and smooth network switching or concurrency, and the interface displayed by the electronic device 100 is smooth (for example, there will be no Figure 2B and Figure 2C The data service arrow shown disappears, the signal is abnormal, prompt information, etc.), so that users cannot perceive the network switching or perceive smooth network switching, thereby improving the user experience.

[0141] The switching / concurrency process in the embodiment of the present application may be a process after the system of the electronic device 100 sends a handoverstart notification and before the system of the electronic device 100 sends a handovercomplete notification. That is, the starting time point of the switching / concurrency process in the embodiment of the present application is the time point of sending the handoverstart notification, and the end time point is the time point of sending the handovercomplete notification.

[0142] Figure 3 1 is a schematic diagram of the architecture of a communication system 10 provided in an embodiment of the present application.

[0143] like Figure 3 As shown, the electronic device 100 can establish a network link with the server 200 through a far-field communication method and communicate based on the network link. The electronic device 100 can also establish a network link with the electronic device 300 through a far-field communication method or a near-field communication method and communicate based on the network link. Among them, the far-field communication method includes, but is not limited to, wireless local area networks (WLAN) (such as Wi-Fi), satellites, cellular communications, etc., and the near-field communication method includes, but is not limited to, Bluetooth, WLAN (such as Wi-Fi), device to device (D2D), near field communication (NFC), ultra wide band (UWB), infrared, short-range wireless communication technology specified by the SparkLink Alliance (for example, SparkLink low energy access (SLE), SparkLink basic access (SLB)), etc.

[0144] The network link between the electronic device 100 and the server 200 may be switched or concurrent, and the network link between the electronic device 100 and the electronic device 300 may be switched or concurrent.

[0145] The APP of the electronic device 100 can establish an APP flow through the electronic device 100 and the communication peer to realize the communication process with the communication peer. At this time, the APP flow is a session. When the network link switches or is concurrent, the APP flow will not switch or close. Among them, when the communication method used is a far-field communication method, the communication peer can be a server 200 or an electronic device 300. When the communication method used is a near-field communication method, the communication peer can be a near-field electronic device 300 or a relay device (not shown, such as a router, switch or other electronic device, etc.).

[0146] Figure 3 The form and quantity of the server 200 and the electronic device 300 shown are for example only. In other examples, there may be multiple servers 200 and / or multiple electronic devices 300, and the embodiments of the present application do not limit this.

[0147] Next, the electronic device 100 provided in an embodiment of the present application is exemplarily introduced.

[0148] In the embodiment of the present application, the electronic device 100 can be a mobile phone, a tablet computer, a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart TV, a smart screen, a smart speaker and other smart home devices, augmented reality (AR), virtual reality (VR), mixed reality (MR) and other extended reality (XR) devices, a vehicle or vehicle-mounted equipment, smart manufacturing equipment, and smart city equipment, etc. The embodiment of the present application does not impose any special restrictions on the specific type of electronic device.

[0149] It should be understood that the structures illustrated in the embodiments of the present application do 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.

[0150] Figure 4 Schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application.

[0151] like Figure 4 As shown, 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 194, and a 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.

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

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

[0154] Processor 110 may also include a memory for storing instructions and data. In one embodiment, 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 retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0155] In one embodiment, 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 SIM interface, and / or a universal serial bus (USB) interface.

[0156] 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 implementations, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging implementations, 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 100 via the power management module 141.

[0157] 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 another embodiment, the power management module 141 can also be set in the processor 110. In another embodiment, the power management module 141 and the charging management module 140 can also be set in the same device.

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

[0159] 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 another embodiment, the antenna can be used in conjunction with a tuning switch.

[0160] The mobile communication module 150 can provide wireless communication solutions for the electronic device 100, including second generation (2G), third generation (3G), fourth generation (4G), fifth generation (5G), and sixth generation (6G). The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves for radiation via the antenna 1. In one embodiment, at least some of the functional modules of the mobile communication module 150 can be located in the processor 110. In another embodiment, at least some of the functional modules of the mobile communication module 150 and at least some of the modules of the processor 110 can be located in the same device.

[0161] 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 one embodiment, the modem processor may be an independent device. In another embodiment, 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.

[0162] The wireless communication module 160 can provide wireless communication solutions applied to the electronic device 100, 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 technology (IR), and wireless communication technologies specified by the SparkLink Alliance (such as SLE, SLB). 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.

[0163] In one embodiment, 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 the network and other devices through 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 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).

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

[0165] Display screen 194 is used to display images, videos, etc. 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 one embodiment, electronic device 100 may include N display screens 194, where N is a positive integer greater than 1.

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

[0167] 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 transformed into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and other factors. It can also optimize parameters such as exposure and color temperature of the captured scene. In one embodiment, the ISP can be located within camera 193.

[0168] 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 one embodiment, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

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

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

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

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

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

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

[0175] 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 one embodiment, 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.

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

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

[0178] 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 another embodiment, 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 another embodiment, the electronic device 100 can also be provided with three, four or more microphones 170C to realize sound signal collection, noise reduction, and can also identify the source of sound, realize directional recording function, etc.

[0179] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In one embodiment, 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 one embodiment, 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.

[0180] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. The air pressure sensor 180C is used to measure air pressure. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The distance sensor 180F is used to measure the distance. 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 ambient light sensor 180L is used to sense the brightness of the ambient light. The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc. The temperature sensor 180J is used to detect temperature. The bone conduction sensor 180M can obtain vibration signals.

[0181] 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 another embodiment, the touch sensor 180K can also be disposed on the surface of the electronic device 100, in a location different from that of the display screen 194.

[0182] Keys 190 include a power button, volume button, and other buttons. Keys 190 can be mechanical or touch-sensitive. Electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of electronic device 100. Motor 191 can generate vibration prompts. Indicator 192 can be an indicator light that can be used to indicate charging status, battery level changes, messages, missed calls, notifications, and more.

[0183] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 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, etc. Multiple cards (for example, a main card and a secondary card) 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 one embodiment, 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.

[0184] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. For example, the software system with a layered architecture can be an Android system, a Harmony operating system (OS), or other software systems. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100.

[0185] Figure 5 Schematic diagram of the software architecture of an electronic device 100 provided in an embodiment of the present application.

[0186] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In one embodiment, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0187] The application layer can include a series of application packages.

[0188] like Figure 5As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. The application in this application may also be replaced by other software such as mini-programs and atomic services. The application in the embodiment of this application may also be replaced by other software such as mini-programs and atomic services.

[0189] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0190] like Figure 5 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

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

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

[0193] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0194] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).

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

[0196] The notification manager enables applications to display notification information in the status bar. This can be used to convey notification-type messages and can disappear automatically after a short period of time without user interaction. For example, the notification manager is used to notify the completion of downloads, message reminders, etc. The notification manager can also be used to display notifications in the form of icons or scrolling text in the top status bar of the system, such as notifications from applications running in the background, or notifications that appear on the screen in the form of dialog windows. For example, a text message can be displayed in the status bar, a notification sound can be emitted, the electronic device 100 can vibrate, an indicator light can flash, etc.

[0197] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.

[0198] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0199] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0200] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0201] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0202] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0203] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0204] A 2D graphics engine is a drawing engine for 2D drawings.

[0205] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0206] The following describes the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.

[0207] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, touch operation timestamp, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer to capture a still image or video through the camera 193.

[0208] Figure 6 1 is a schematic diagram of the architecture of an electronic device 100 provided in an embodiment of the present application.

[0209] like Figure 6 As shown, the electronic device 100 may include an application processor (AP) system (which may be referred to as an application system) and a wireless communication system (for example, a wireless chipset). Among them, the application system can be divided into four layers, from top to bottom: application layer, framework layer (framework, FW), hardware abstract layer (hardware abstract layer, HAL) and kernel layer (kernel). The wireless communication system may include but is not limited to at least one of the following: cellular communication system (for example, 2G / 3G / 4G / 5G / 6G, etc.) (for example, modem), Wi-Fi system, Bluetooth system, satellite system (for example, Beidou, Tiantong, Starlink, etc.), NFC system (not shown), D2D system (not shown), Star Flash system (not shown), infrared system, etc. (not shown).

[0210] The application layer in the application system may include APP and third-party libraries (3rdlib). The 3rdlib may be a transmission protocol library interface encapsulated by the third-party library.

[0211] The framework layer in the application system may include a network service system, a transmission service, a socket service, and a network management system, wherein the network service system may be a high-level network programming interface encapsulated by the system, such as a wireless network tool (networkkit) or a wireless network library (network libraries). The transmission service may be a transmission protocol library, which may include but is not limited to the following transmission protocols: HTTP, HTTPS, QUIC), TLS, DTLS, FTP, SCTP, WebSocket, etc. The socket service may include a BSD socket (which may be referred to as a socket for short) and / or an encapsulated socket group (encapsulating multiple sockets). The network management system may detect network quality, network events, etc. to determine whether to switch or concurrency.

[0212] The hardware abstraction layer in the application system may include interfaces for interaction between the wireless communication system and the application system, such as: a radio interface layer deamon (RILD) module (i.e., an interface for interaction between the cellular communication system and the application system), and a Wi-Fi daemon (Wi-Fideamon) module (i.e., an interface for interaction between the Wi-Fi system and the application system). Not limited to this, it may also include interfaces for interaction between other communication systems and application systems in the wireless communication system. The hardware abstraction layer may also include a network deamon (NETD) module. The NETD module may be used to monitor network events, such as disconnection, connection, errors, etc., and report them to the framework layer. Not limited to this, the NETD module may also be used to manage network-related information such as routing rules and network card status.

[0213] The kernel layer in the application system may include a transport protocol stack and a driver layer. The transport protocol stack may include but is not limited to TCP, UDP, and IP. The driver layer may include but is not limited to display driver, audio driver, sensor driver, etc.

[0214] A cellular communication system in a wireless communication system may include hardware modules for cellular communication, such as firmware and chips. A Wi-Fi system in a wireless communication system may include hardware modules for Wi-Fi communication. A Bluetooth system in a wireless communication system may include hardware modules for Bluetooth communication. A satellite system in a wireless communication system may include hardware modules for satellite communication.

[0215] like Figure 6As shown, when the APP in the application layer implements the transmission function, it can call at least one of the following: 3rdlib, network service system, transmission service, or socket service. When the 3rdlib in the application layer implements the transmission function, it can call at least one of the following: network service system, transmission service, or socket service.

[0216] Not limited to Figure 6 In the examples shown, in other examples, the network service system and the network management system can also be integrated together.

[0217] Figure 7 This is a schematic diagram of the architecture of another electronic device 100 provided in an embodiment of the present application.

[0218] like Figure 7 As shown, when the APP / 3rd lib of the electronic device 100 communicates with the communication peer (at least one network link can be used), a session can be managed. A session can have a session identifier (identity document, id) (sessionid), and different sessions have different sessionids. A session can include at least one connection. A connection (using an IP and a port) can correspond to a network link / physical link (path), and a path can correspond to one connection, or to multiple connections. For example, connection and path can be understood as concepts at different levels. Path is a concept at the air interface level, and connection is a concept of the system of the electronic device 100. Figure 6 Take the architecture shown as an example, the connection and path are Figure 6 The concepts of application system and communication system are shown.

[0219] In an embodiment of the present application, the APP / 3rd lib of the electronic device 100 can call the encapsulation interface of the electronic device 100 system to manage the session (the APP / 3rd lib can be called the caller, and the encapsulation interface can be called the encapsulated session interface), and the encapsulated session interface manages the connection corresponding to the session, for example, to realize the switching and / or concurrency of the connection corresponding to the session.

[0220] For example, Figure 7As shown, cross-path switching from a cellular network to a Wi-Fi network can be achieved. The connection corresponding to the session managed by the APP / 3rd library can be switched from connection 11 (corresponding to the cellular communication link) to connection 12 (corresponding to Wi-Fi link 1). Cross-path switching from Wi-Fi network 1 (for example, 2.4 gigahertz (GHz)) to Wi-Fi network 2 (for example, 5GHz) can also be achieved. The connection corresponding to the session managed by the APP / 3rd library can be switched from connection 12 (corresponding to Wi-Fi link 1) to connection 13 (corresponding to Wi-Fi link 2).

[0221] For example, Figure 7 As shown, the same-path switching of the cellular communication link can be achieved. The connection corresponding to the session managed by APP / 3rd lib can always be connection11 (corresponding to the cellular communication link). However, during the switching process, the cellular communication link may be disconnected or not, and connection11 may be closed or not.

[0222] For example, Figure 7 As shown, concurrency of Wi-Fi network and Bluetooth network can be achieved, and the connection corresponding to the session managed by APP / 3rd lib can be changed from connection13 (corresponding to Wi-Fi link 2) to connection13 and connection14 (corresponding to Bluetooth link).

[0223] like Figure 7 As shown, when the lower-level physical network link switches / concurrently, the connection corresponding to the network link may switch / concurrently, but the session exposed at the encapsulated session interface remains unchanged (sessionid remains unchanged). Therefore, when the caller and the communication counterpart communicate once, no matter what the communication method is or how the communication method changes, the session of this communication will be maintained. It can be understood that the session can represent the complete life cycle of this communication. The system of the electronic device 100 has the initiative to initiate switching / concurrency and can automatically complete the switching / concurrency without the caller actively initiating the reconstruction of the link (the flow maintained by the caller remains unchanged). In addition, the system of the electronic device 100 can send a corresponding notification to the caller to allow the caller to cooperate with the switching / concurrency, thereby achieving smooth switching, smooth business, and no random prompts from the APP that the network is unavailable, thereby improving the user experience.

[0224] The above encapsulated session interface can be deployed in a variety of locations, including any of the following: network service system, transmission service, encapsulated socket group, BSD socket (referred to as socket), for details, see Figure 8 .

[0225] Figure 8 This is a schematic diagram of the architecture of another electronic device 100 provided in an embodiment of the present application.

[0226] like Figure 8 As shown, according to the encapsulation hierarchy, from high to low, they are: network service system, transmission service / encapsulated socket group, BSD socket (referred to as socket), and transmission protocol stack. Among them, socket is an interface for encapsulating the transmission protocol stack, such as encapsulating TCP, encapsulating UDP, or raw socket (sock_raw). The transmission service can encapsulate the socket. The encapsulated socket group can encapsulate the socket. The network service system can encapsulate at least one of the following: transmission service, encapsulated socket group, and socket.

[0227] In one embodiment, when the encapsulated session interface is deployed on a socket, the session managed by the caller is a socket, and the connection corresponding to the session is a socket. When the encapsulated session interface is deployed on a socket, there is no need to deploy it elsewhere, but all modules that call the socket must be adapted.

[0228] In another embodiment, when the encapsulated session interface is deployed in a transport service or an encapsulated socket group, the connection corresponding to the session managed by the caller is a socket.

[0229] In another embodiment, when the encapsulated session interface is deployed in a network service system, the network service system can encapsulate some or all of the transport protocols in the transport service. In this case, the connection corresponding to the session managed by the caller can be any of the transport protocols encapsulated in the transport service (for specific examples, see Figure 6Alternatively, the network service system can encapsulate a socket or an encapsulated socket group. In this case, the connection corresponding to the caller-managed session can be a socket. Alternatively, the network service system can encapsulate a transport service (partial or complete transport protocol) and a socket service (socket and / or encapsulated socket group). In this case, the connection corresponding to the caller-managed session can be any transport protocol encapsulated in the transport service, or a socket.

[0230] The above examples are illustrated by taking the caller as APP / 3rd lib. In other examples, the caller can also be a transport protocol, including but not limited to TCP, IP, UDP, HTTP, HTTPS, QUIC, TLS, DTLS, FTP, SCTP, WebSocket, etc. For the convenience of explanation, the following embodiments are mainly described by taking the caller as APP as an example.

[0231] In one embodiment, the caller can achieve session awareness through the encapsulated session interface, which may include but is not limited to:

[0232] Awareness of network handover / network concurrency, such as through handover start notifications and handover complete notifications reported by the encapsulated session interface;

[0233] Perception of available and unavailable connections, where unavailable connections include, for example, overall network / IP unavailability (e.g., no network connection available, waiting for IP recovery), or partial connections being marked unavailable due to scheduling, power consumption, performance, and other reasons;

[0234] Traffic interruption awareness, which may include session disconnection and / or connection disconnection, such as notification of a preset time before the disconnection, such as notification of the duration of the disconnection;

[0235] Packet loss awareness (both upstream and downstream), such as through discard notifications reported by the encapsulated session interface, explicit loss notification (ELN), or explicit drop notification (EDN);

[0236] Congestion awareness (both upstream and downstream), for example, through explicit congestion notification (ECN) reported by the encapsulated session interface;

[0237] Packet loss and congestion feedback in wireless communication systems, such as through specially constructed messages, Internet Control Message Protocol (ICMP), or acknowledgment character (ACK) feedback;

[0238] Timeout perception, such as the duration of time when service data is not sent normally;

[0239] Send / retry awareness, such as awareness of changes in send / retry intervals.

[0240] Next, the network switching / concurrency process provided by the embodiment of the present application is exemplarily introduced.

[0241] Example 1: First establish a new network link and then disconnect the old network link. This can be understood as a soft switch that connects first and then disconnects. Switching replaces direct disconnection, which can ensure smooth switching without the need for APP cooperation or weak APP cooperation, avoids service jams, improves bandwidth, and stabilizes latency. Example 1 can be applied to cross-path switching / concurrent scenarios, as well as same-path switching / concurrent scenarios. In one embodiment, soft switching can be implemented by the system of the electronic device 100, and the session managed by the APP remains unchanged, that is, the APP flow does not switch. For details, please refer to the following Figures 9-11 Description.

[0242] Figure 9 This is a schematic diagram of a network switching / concurrency process provided in an embodiment of the present application.

[0243] like Figure 9As shown, APP1 manages one session1, session1 corresponds to connection1, connection1 corresponds to network link (path) 1, and APP1 can transmit data through connection1. When the system of the electronic device 100 detects that session1 needs to switch to a new path (for example, it detects that the link quality of session1 is poor), or APP1 has concurrency requirements (for example, high-bandwidth download scenarios, stable latency gaming scenarios), that is, at time t10, the system of the electronic device 100 can activate the new path2 (including activating the network card, such as a new network card), and send / report a handover start notification to APP1 (which can carry the triggering reason for the switch / concurrency), wherein the order of activating path2 and sending the handoverstart notification is not limited, and the system enters the link establishment period T00. During the system link establishment period T00, the old connection1 is maintained, and APP1 can send and receive data through the old connection1. During the system link establishment period T00, the system of the electronic device 100 can concurrently establish a link on the new path2. The link establishment process includes, for example, DNS and TLS / DTLS handshakes, etc. The link establishment process may include establishing a three-way handshake connection (that is, when the transport layer protocol is TCP), or may not include establishing a three-way handshake connection (that is, when the transport layer protocol is UDP). Moreover, during the system link establishment period T00, the connection corresponding to the session1 managed by APP1 includes not only the old connection1, but also a new connection2 (corresponding to path2). When the system of the electronic device 100 completes the link establishment process, that is, at time t11, a handover completion (handovercomplete) notification can be reported to APP1. The starting point of the system link establishment period T00 is the time t10 when the handoverstart notification is reported, and the end point is the time t11 when the handovercomplete notification is reported. Among them, activating the new path2 and network card configuration may not be included in the system link establishment period T00. At this time, the trigger point for the system to report the handoverstart notification to APP1 is, for example, the completion of path2 activation and / or the completion of the network card configuration. Not limited to this, activating the new path2 and network card configuration may also be included in the system link establishment period T00. At this time, the trigger point for the system to report the handoverstart notification to APP1 may be, but is not limited to, determined by the system through the notification interface of APP1 or automatically determined by the system based on the quality of experience (QoE).The trigger point for the system to report the handovercomplete notification to APP1 can be the time when the link establishment process is completed (for example, the TLS handshake is completed) and data can be sent. It is not limited to this and can also be the time when the system automatically completes login authentication (optional).

[0244] like Figure 9 As shown, after the system link establishment period T00, the APP autonomous period T01 can be entered. The starting point of the APP autonomous period T01 is the time t11 when the handovercomplete notification is reported, and the end point of the APP autonomous period T01 is the time t12 after the starting point after a preset time (for example, the default is 3 seconds). In the network switching scenario, the APP autonomous period T01 can be understood as the maximum retention time of the old path1 after the handovercomplete notification is reported. During the APP autonomous period T01, APP1 can independently select path1 (corresponding to connection1) and / or path2 (corresponding to connection2) for data transmission, and APP1 can independently determine the diversion / replication method, wherein, when APP1 uses path1 and path2 at the same time, it can perform diversion, that is, path1 and path2 send different data respectively. When APP1 uses path1 and path2 at the same time, it can also perform replication, that is, path1 and path2 send the same data, which can achieve short-term concurrency. Optionally, during the APP autonomous period T01, APP1 may execute a first action to achieve a "complete switch" of the communication link. In some examples, the first action may include user login authentication (credentials will be carried again for authentication, and a new token will be generated). For example, when the communication peer supports fast IP re-entry, user login authentication may not be performed, and the old, authenticated token can be used directly. In some examples, the first action may include APP1 sending a network card change notification / link status change notification to the communication peer. In some examples, in a video scenario, the first action may include APP1 sending a request for an I frame to the communication peer. It can be understood that if the communication peer cannot perceive the network switching / concurrency of the electronic device 100 in a timely manner, it will still send data packets to the electronic device 100 on the old IP and old port, or send I frames on the old link, but due to problems with the downlink of the old path 1 of the electronic device 100, the I frame cannot be received. After the communication peer perceives the network switching / concurrency of the electronic device 100, it will send a P frame to the electronic device 100 on the new path 2, but since the electronic device 100 has not received the reference I frame, even if the P frame is received, the data cannot be restored. Therefore, APP1 can send an I frame request to the communication peer to obtain the I frame.

[0245] like Figure 9As shown, after the APP autonomous period T01, the system dominant period T02 can be entered, and the starting point of the system dominant period T02 is the end point of the APP autonomous period T01 (i.e., time t12). During the system dominant period T02, the system of the electronic device 100 can determine whether to perform concurrency (i.e., aggregation of replication or diversion) based on whether the communication peer of APP1 meets the concurrency conditions. When it is determined that concurrency is not performed (for example, the communication peer does not meet the concurrency conditions) (i.e., the network switching scenario), the system of the electronic device 100 can realize link release on the old path1, and the old connection1 will also be closed. The order of realizing link release and closing connection1 on path1 is not limited, and APP1 can transmit data through the new connection2 after the APP autonomous period T01. When concurrency is determined (for example, the communication peer meets the concurrency conditions) (i.e., the network concurrency scenario), the system of the electronic device 100 can divert or copy the uplink data to be sent by APP1 to path1 and path2. In some examples, the diversion or copying can be performed based on the air interface quality and link transmission quality of path1 and / or path2. Without limitation, the diversion or copying can also be performed based on the current business scenario of APP1.

[0246] Among them, the concurrency conditions of the above-mentioned communication peers may include but are not limited to at least one of the following: whether to support two-way IP access, whether to support IP fast re-entry, whether to support data diversion / replication / aggregation, whether to support two-way connection shared keys, whether to support multipath TCP transmission control protocol (MPTCP) / multipath UDP transmission control protocol (MPUDP) / SCTP, whether to support HTTP-Range (belonging to the HTTP request header, which can also be understood as whether to support user selection of HTTP protocol), etc.

[0247] Not limited to the above examples, in other examples, during the system dominant period T02, the system of the electronic device 100 can also determine whether to perform concurrency based on the type of the current business of APP1. For example, some business types have concurrency requirements, while some business types do not.

[0248] Not limited to the network switching / concurrency process in the above examples, in other examples, the APP autonomous period T01 may not be performed when the APP does not need to perform the above first action. For example, when the communication peer supports fast IP re-entry, the APP does not need to perform user login authentication. When the communication peer promptly perceives the network switching / concurrency of the electronic device 100, the APP does not need to send a network card change notification / link status change notification and an I frame request.

[0249] Not limited to the above examples, in other examples, if the duration of the APP autonomous period T01 is set to infinite, the subsequent system-dominated period T02 may not be performed. It can be understood that data transmission is all implemented autonomously by the APP.

[0250] Figure 9 The network switching / concurrency process shown can be cross-path switching / concurrency, then path1 corresponding to connection1 and path2 corresponding to connection2 can be different communication links, for example, path1 and path2 are Wi-Fi and cellular communication links respectively, for example, path1 and path2 are links for the primary card and the secondary card respectively.

[0251] Figure 9 The network switching / concurrency process shown can also be the same path switching / concurrency, then path1 corresponding to connection1 and path2 corresponding to connection2 can be the same communication link, but the IP used can be different, and / or the ports used can be different. For example, in the same path concurrency scenario, path1 (also known as path2) can correspond to connection1 and connection2. For example, path1 and path2 are both the same Wi-Fi link with the same port, but the versions of the IP used are different (for example, one is v4 and the other is v6). In the same path switching / concurrency scenario, it is not limited to Figure 9 In the example network switching / concurrency process, in other examples, during the system link establishment period T00, the old path 1 may also be released by the link and has not yet been restored.

[0252] Not limited to the network switching / concurrency process in the above examples, in other examples, the system of the electronic device 100 may not report the handoverstart notification and / or handovercomplete notification to the APP, such as MPTCP, MPTUDP, SCTP, HTTP-Range, etc., where the APP does not need to participate in the network switching / concurrency process.

[0253] Figure 10 This is a schematic diagram of a network switching method provided in an embodiment of the present application. Figure 10 The method shown can be applied to the electronic device 100, which can include an APP (using APP1 as an example for illustration), a network service system, a socket service / transmission service, and a network management system. Figure 10 The following describes an example of deploying an encapsulated session interface in a network service system. Figure 10 The method shown may include, but is not limited to, the following steps:

[0254] S101: APP1 calls the network service system to create session1.

[0255] In some examples, when creating session1, parameters of session1 can be included, such as but not limited to: the service type of session1 (such as voice call, video call, game, etc.), the IP of the communication peer, the domain name of the communication peer, the port of the communication peer, the transmission protocol used, etc.

[0256] S102: The network service system applies session1 to the network management system (which can be understood as registering the information of session1 or synchronizing the information of session1).

[0257] S103: The network management system returns an application response (apply response) to the network service system.

[0258] In some examples, the network service system can apply session1 to the network management system so that the network management system can obtain information about session1 and manage session1. For example, the network management system can make decisions on network switching / concurrency processes for session1. For specific examples, see the descriptions of S109 and S110.

[0259] S104: The network service system calls the socket service / transmission service and binds connection1 (corresponding to path1) to session1 (in this case, session1 corresponds to connection1).

[0260] In an embodiment of the present application, binding a connection to a session may include: creating the connection and determining that the connection corresponds to the session (i.e., the session includes the connection). For example, the above binding connection1 to session1 includes: creating connection1 and determining that connection1 corresponds to session1 (i.e., session1 includes connection1).

[0261] S105: The network service system calls the socket service / transport service, establishes a link on connection1 and completes the handshake (eg, TLS / DTLS handshake).

[0262] In some examples, when the protocol in the transport layer is TCP, S105 may establish a link on connection1. Without limitation, in other examples, when the protocol in the transport layer is UDP, S105 may not establish a link on connection1.

[0263] S106: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0264] S107: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection1.

[0265] S108: APP1 calls the network service system and reports the QoE of APP1 to the network management system.

[0266] S108 is an optional step.

[0267] S109: The network management system evaluates the QoE and activates the new network card according to the evaluation result (also called opening the new network card, the new network card corresponds to the following connection2).

[0268] In some examples, the network management system can obtain QoE and evaluate QoE, wherein the network management system can obtain QoE by automatically identifying the QoE of the electronic device 100 and / or receiving the QoE of the APP reported by the APP (for example, executing S108).

[0269] In some examples, activating the new network card may be activating a new path2.

[0270] S110: The network management system sends a switching command to the network service system.

[0271] In S109 and S110 , when the network management system determines to perform network switching / concurrency according to the evaluation result, it may activate the new network card and send a switching command to the network service system.

[0272] S111: The network service system sends a handover start notification (which may carry a handover / concurrency triggering reason) to APP1.

[0273] In some examples, the handoverstart notification may carry a triggering reason for the handover / concurrency, such as the character "reason," which may be, for example, "reason: suspend," but is not limited thereto and may carry a more detailed reason. In some examples, the handoverstart notification may also include the duration of the handover process (e.g., system link establishment period T00), i.e., the duration from S111 to S114.

[0274] In some examples, the handoverstart notification may further include information about the data transmission speed, so that APP1 adjusts the current data transmission speed (e.g., data sending speed) of APP1 according to the data transmission speed information in the handoverstart notification during the handover process (i.e., after receiving the handoverstart notification and before receiving the handovercomplete notification). For example, the data transmission speed information in the handoverstart notification is a specific numerical value, which may be referred to as data speed (dataspeed), and is used to instruct APP1 to set the data transmission speed to the dataspeed. For example, the data transmission speed information in the handoverstart notification is a level, which may be referred to as data speed level (dataspeedlevel), and is used to instruct APP1 to set the data transmission speed level to the dataspeedlevel. Assuming that the data transmission speed is divided into levels from small to large, in the order of: zero, low, normal, and high (actually, it can be more or less), the data transmission speed at the zero level is 0, the data transmission speed at the low level is less than the data transmission speed at the normal level, and the data transmission speed at the high level is greater than the data transmission speed at the normal level. For example, the data transmission speed information in the handoverstart notification is an adjustment strategy, which is assumed to include three strategies: lower (ie, instructing to lower the data transmission speed), maintain (ie, instructing to maintain the current data transmission speed), and increase (ie, instructing to increase the data transmission speed).

[0275] In some examples, the handoverstart notification may further include an identifier of the switched connection 1 in session 1, for example, indicating that connection 1 in session 1 is suspended.

[0276] S109-S111 are explained by taking the example of activating the new network card and then sending the handoverstart notification. In other examples, the handoverstart notification can be sent first and then the new network card can be activated, or both can be implemented at the same time. For example, S109-S110 can be replaced by: the network management system evaluates QoE, and when determining to perform network switching / concurrency based on the evaluation results, sends a switching command to the network service system; after S111 is executed or while S111 is executed, the network management system / network service system can activate the new network card.

[0277] S112: The network service system calls the socket service / transmission service and binds connection2 (corresponding to path2) to session1 (in this case, session1 corresponds to connection1 and connection2).

[0278] S113: The network service system calls the socket service / transport service, establishes a link on connection2 and completes a handshake (eg, a TLS / DTLS handshake). The description of S113 is similar to that of S105 and will not be repeated here.

[0279] S114: The network service system sends a handover complete notification to APP1.

[0280] In some examples, the handovercomplete notification may include the result of the handover process, such as handover success or handover failure, for example, the handover success reason is: resume.

[0281] In some examples, the handovercomplete notification may include whether a path switch occurs during the handover process, such as switching from a path of one communication mode to a path of another communication mode, so that APP1 can independently determine whether to perform operations such as DNS.

[0282] In some examples, the handovercomplete notification may include whether the communication IP changes during the handover process, so that APP1 can determine whether to perform the first action. For example, when the communication IP does not change, APP1 may not perform the first action.

[0283] In some examples, the handovercomplete notification may include the duration of the APP autonomous period T01.

[0284] In some examples, the handovercomplete notification may include information about the connections included in session 1 after the handover process, such as the number of connections included, IDs, etc.

[0285] In some examples, the handover complete notification may include information about the connections included in session 1 before the handover process, such as the number and ID of the connections included.

[0286] In some examples, the handoverstart notification and handovercomplete notification can be reported based on the APP level / session group level. Since each APP can manage one or more sessions and a session group can include one or more sessions, the handoverstart notification and handovercomplete notification can carry the ID of the corresponding session. For example, the handoverstart notification of S111 and the handovercomplete notification of S114 can carry the ID of session1. Therefore, the handoverstart notification can indicate that session1 is paused, and the handovercomplete notification can indicate that session1 is resumed.

[0287] In other examples, the handoverstart notification and handovercomplete notification may also be reported based on the session level, that is, based on the object report of the corresponding session. In this case, the electronic device 100 can automatically obtain the session corresponding to the handoverstart notification / handovercomplete notification. Therefore, the handoverstart notification and handovercomplete notification may not carry the ID of the corresponding session. At this time, the handoverstart notification can still indicate that session1 is paused, and the handovercomplete notification can still indicate that session1 is resumed.

[0288] In some examples, the handovercomplete notification may include identifiers of connection1 and connection2 in session1, for APP1 to perform S115.

[0289] S115: APP1 calls the network service system, and the network service system calls the socket service / transmission service to implement: data transmission (sending and / or receiving data of APP1) through connection1 and / or connection2.

[0290] When APP1 calls the network service system, APP1 can send the network service system a connection identifier for transmitting data of APP1. When the network service system calls the socket service / transmission service, the network service system can also send the socket service / transmission service a connection identifier for transmitting data of APP1.

[0291] Optionally, during S111 to S114 , the electronic device 100 may simultaneously execute S106 - S107 .

[0292] When the execution time of S115 exceeds the preset time T01, the following situation 1 (concurrent scenario) or the following situation 2 (switching scenario) can be performed. For instructions on how to choose to perform situation 1 or situation 2, please refer to Figure 9 Description of the system dominant period T02.

[0293] In case 1 (concurrent scenario), Figure 10 The method shown may include, but is not limited to, the following steps:

[0294] S116: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0295] S117: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection1.

[0296] S118: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection2.

[0297] The data transmitted in S117 and S118 may be the same or different.

[0298] In case 2 (switching scenes), Figure 10 The method shown may include, but is not limited to, the following steps:

[0299] S119: The network service system calls the socket service / transmission service and closes connection1.

[0300] S120: The network service system deactivates the old network card through the network management system (it may also be called shutting down the old network card, the old network card corresponds to connection1).

[0301] S120 is an optional step.

[0302] S121: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0303] S122: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection2.

[0304] Figure 10 The method shown can correspond to Figure 9 The process shown, where Figure 10 S111-S114 correspondence Figure 9 The system chain building period is T00, Figure 10 S115 corresponding Figure 9 APP autonomy period T01, Figure 10 Case 1 / Case 2 corresponds to Figure 9 system-dominant period.

[0305] Not limited to Figure 10 In the examples shown, in other examples, some operations performed by the network service system can also be performed by the APP. The network service system can report notifications to the APP, and the APP performs corresponding operations based on the notifications. For example, link establishment and handshake can be performed by the APP.

[0306] Not limited to Figure 10 In another embodiment of the network switching method shown, the encapsulated session interface can also be deployed in the transmission service or the encapsulated socket group. Figure 10 The process shown is similar, except that this time Figure 10 The network service system in needs to be replaced with socket service / transmission service. Figure 10 The socket service / transport service in needs to be replaced with BSD socket. In another embodiment, the encapsulated session interface can also be deployed on BSD socket. The process in this case can be seen below. Figure 11 .

[0307] Figure 11 This is a schematic diagram of another network switching method provided in an embodiment of the present application. Figure 11 The method shown can be applied to the electronic device 100, which can include an APP (using APP1 as an example for illustration), a BSD socket (abbreviated as socket), a transmission protocol stack, and a network management system. Figure 11 The following describes the deployment of the encapsulated session interface in a socket as an example. Figure 11 The method shown may include, but is not limited to, the following steps:

[0308] S201: APP1 calls socket to create session1 (i.e., create socket3). Figure 10The description of S101 is similar and will not be repeated here.

[0309] S202: The socket applies session 1 to the network management system.

[0310] S203: The network management system returns an application response (applyresponse) to the socket.

[0311] S204: The socket calls the transport protocol stack and binds socket4 (ie, connection1, corresponding to path1) to session1 (in this case, session1 corresponds to connection1).

[0312] In an embodiment of the present application, binding a socket to a session may include: creating the socket, and determining that the socket corresponds to the session (i.e., the session includes the socket. For example, the above binding of socket4 to session1 includes: creating socket4, and determining that socket4 corresponds to session1 (i.e., session1 includes socket4).

[0313] S205: APP1 calls the socket, and the socket calls the transport protocol stack to establish a link on socket4 and complete the handshake (for example, TLS / DTLS handshake). Figure 10 The description of S105 is similar and will not be repeated here.

[0314] S206: APP1 and the socket transmit data (send and / or receive data of APP1).

[0315] S207: The socket calls the transmission protocol stack and transmits data through socket 4 (sends and / or receives data of APP1).

[0316] S208: APP1 calls the socket to report the QoE of APP1 to the network management system.

[0317] S208 is an optional step.

[0318] S209: The network management system evaluates QoE and activates the new network card (the new network card corresponds to socket 5 below) based on the evaluation results (S209 can also be understood as determining network switching / concurrency based on QoE). Figure 10 The description of S109 is similar and will not be repeated here.

[0319] S210: The network management system sends a switching command to the socket.

[0320] S211: The socket sends a handover start notification (which may carry a handover / concurrency triggering reason) to APP1.

[0321] The order of activating the new network card in S209 and S211 is not limited.

[0322] S212: The socket calls the transport protocol stack and binds socket5 (i.e., connection2, corresponding to path2) to session1 (in this case, session1 corresponds to connection1 and connection2).

[0323] S213: The socket calls the transport protocol stack, establishes a link on socket5 and completes the handshake (for example, TLS / DTLS handshake). Figure 10 The description of S105 is similar and will not be repeated here.

[0324] S214: The socket sends a handover complete notification to APP1.

[0325] For details on the handoverstart notification and handovercomplete notification, see Figure 10 The difference is that Figure 11 The switching process is the process from S211 to S214, and the rest will not be repeated.

[0326] S215: APP1 calls the socket, and the socket calls the transmission protocol stack to implement: data transmission through socket4 and / or socket5 (sending and / or receiving data of APP1).

[0327] When APP1 calls the socket, APP1 can send the identifier of the path / connection (the connection is the socket) used to transmit APP1's data to the socket. When the socket calls the transport protocol stack, the socket can send the identifier of the path / connection used to transmit APP1's data to the transport protocol stack.

[0328] Optionally, during S211 to S214 , the electronic device 100 may simultaneously execute S206 - S207 .

[0329] When the execution time of S215 exceeds the preset time T01, the following situation 1 (concurrent scenario) or the following situation 2 (switching scenario) can be performed. For instructions on how to choose to perform situation 1 or situation 2, please refer to Figure 9 Description of the system dominant period T02.

[0330] In case 1 (concurrent scenario), Figure 11 The method shown may include, but is not limited to, the following steps:

[0331] S216: APP1 and the socket transmit data (send and / or receive data of APP1).

[0332] S217: The socket calls the transmission protocol stack and transmits data through socket 4 (sends and / or receives data of APP1).

[0333] S218: The socket calls the transmission protocol stack and transmits data through socket5 (sends and / or receives data of APP1).

[0334] In case 2 (switching scenes), Figure 11 The method shown may include, but is not limited to, the following steps:

[0335] S219: The socket calls the transport protocol stack and closes socket4.

[0336] S220: The socket activates the old network card (the old network card corresponds to socket 4) through the network management system.

[0337] S220 is an optional step.

[0338] S221: APP1 and socket transmit data (send and / or receive data of APP1).

[0339] S222: The socket calls the transmission protocol stack and transmits data through socket5 (sends and / or receives data of APP1).

[0340] Figure 11 The method shown can correspond to Figure 9 The process shown, where Figure 11 S211-S214 correspond to Figure 9 The system chain building period is T00, Figure 11 S215 corresponding Figure 9 APP autonomy period T01, Figure 11 Case 1 / Case 2 corresponds to Figure 9 system-dominant period.

[0341] Not limited to Figure 11In the examples shown, in other examples, the socket and the network management system can also be integrated together.

[0342] Not limited to Figure 11 In the example shown, in other examples, some operations performed by the socket can also be performed by the APP. The socket can report notifications to the APP, and the APP performs corresponding operations based on the notifications. For example, link establishment and handshake can be performed by the APP.

[0343] In the implementation shown in the above-mentioned embodiment 1, the APP of the electronic device 100 maintains a session (corresponding to a connection, which can be called an old connection). When the old connection is in a normal state (for example, when used to transmit APP data), the system of the electronic device 100 can establish a new connection concurrently according to the current network status and / or business status. Subsequently, it can be chosen whether to retain the old connection according to demand. It can be understood as a soft switch, rather than a hard switch of first disconnecting the old connection and then establishing a new connection. Moreover, it does not rely on the caller such as the APP to implement the switching / concurrency process, so that the APP will not experience business lag, nor will it prompt network abnormalities (such as pop-up boxes), thereby realizing a fast and smooth network switching / concurrency process.

[0344] Not limited to the implementation shown in the above embodiment 1, in another implementation, the APP can also independently implement soft switching with the assistance of the system of the electronic device 100, and the flow managed by the APP (this time it is a connection) will be switched. For details, please refer to the following Figure 12 and Figure 13 Description.

[0345] Figure 12 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0346] like Figure 12 As shown, APP1 manages one connection1, which corresponds to path1. APP1 can transmit data through connection1. When the system of electronic device 100 detects a better new link and the communication peer meets the concurrency condition (see Figure 9), that is, at time t21, the system of the electronic device 100 can report a new link (newpath) notification (also called a better link (better path) notification) to APP1, and then enter the APP autonomous period T03. The starting point of the APP autonomous period T03 is the time t21 when the newpath notification is reported, and the end point of the APP autonomous period T03 is the time t22 after the preset time after the starting point. In the network switching scenario, the APP autonomous period T03 can be understood as the maximum retention time of the old path1 after the newpath notification is reported. During the APP autonomous period T03, APP1 can determine whether to establish a link. If the judgment result is yes, APP1 can activate the new path2 and establish a link on path2 by itself, and APP1 can also open a new connection2 (corresponding to path2). At this time, APP1 manages connection1 and connection2, and the time for link establishment to be completed is time t23 after time t21 and before time t22. During the APP autonomous period T03, for the old path1 (corresponding to connection1), APP1 can independently choose whether to transmit data. After the link is established (i.e., from time t23 to time t22), for the new path2 (corresponding to connection2), APP1 can independently choose whether to transmit data. APP1 determines whether to establish the link after receiving the newpath notification, rather than relying on the passive perception of the path / connection being closed. APP1 perception is more timely. For other instructions on the APP autonomous period T03, please refer to Figure 9 The description of the APP autonomous period T01 will not be repeated here.

[0347] like Figure 12 As shown, after the APP autonomous period T03, the system dominant period T04 can be entered. The starting point of the system dominant period T04 is the end point of the APP autonomous period T03 (i.e., time t22). APP1 can notify the relationship between the old path1 and the new path2 to the system of the electronic device 100. During the system dominant period T04, the system of the electronic device 100 can determine whether to perform concurrency based on the notification sent by APP1 and whether the communication partner of APP1 meets the concurrency conditions. For other instructions on the system dominant period T04, please refer to Figure 9 The description of the system dominant period T02 will not be repeated here.

[0348] Not limited to the above examples, in other examples, the new path2 may exist before the APP autonomous period T03. In this case, path2 may not be activated or a new network card may not be created within the APP autonomous period T03. Therefore, the embodiment of the present application can achieve: switching / concurrency scenarios that cannot be achieved by the current network switching method (relying only on the available notification of the physical link / network card) due to poor transmission quality, bandwidth, latency and other factors.

[0349] Figure 13 This is a schematic diagram of another network switching method provided in an embodiment of the present application. Figure 13 The method shown can be applied to the electronic device 100, which can include an APP (using APP1 as an example for illustration), a socket, a transmission protocol stack, and a network management system. Figure 13 This section uses the example of an app managing a connection and a socket as an example. Figure 13 The method shown may include, but is not limited to, the following steps:

[0350] S301: APP1 calls socket and creates socket6 (i.e. connection1, corresponding to path1). Figure 10 The description of S101 is similar and will not be repeated here.

[0351] S302: APP1 calls the socket, and the socket calls the transport protocol stack to implement: establishing a link on socket6 and completing the handshake (such as TLS / DTLS handshake). Figure 10 The description of S105 is similar and will not be repeated here.

[0352] S303: APP1 and the socket transmit data (send and / or receive data of APP1).

[0353] S304: The socket calls the transmission protocol stack and transmits data through socket6 (sends and / or receives data of APP1).

[0354] S305: APP1 calls the socket to report the QoE of APP1 to the network management system.

[0355] S305 is an optional step.

[0356] S306: When the network management system determines that a new link with a better quality exists according to the QoE, it sends a corresponding notification to the socket.

[0357] The instructions for obtaining QoE in the network management system can be found in Figure 10S109, no more details.

[0358] S307: The socket sends a new path notification (also called a better path notification) to APP1.

[0359] In some examples, the newpath notification includes information of path1 and information of path2.

[0360] In some examples, the newpath notification includes the lifecycle of path1 (that is, the lifecycle of connection1). For example, APP1 can establish a link for path2 before the end of the lifecycle of path1 based on the lifecycle of path1, that is, execute S308 and S309. For example, APP1 can release the link of path1 before or at the end of the lifecycle of path1 based on the lifecycle of path1.

[0361] In some examples, the newpath notification includes action information, which can be used to instruct APP1 to perform related operations of the network switching / concurrency process. The related operation can be at least one operation performed by the system of the electronic device 100 in the embodiment of the present application, such as operations S308 and S309.

[0362] In some examples, the newpath notification may include Figure 10 For details on the contents of the handoverstart notification, see Figure 10 Description.

[0363] S308: APP1 calls socket and creates socket7 (ie, connection2, corresponding to path2).

[0364] S309: APP1 calls the socket, and the socket calls the transport protocol stack to establish a link on socket7 and complete the handshake (for example, TLS / DTLS handshake). Figure 10 The description of S105 is similar and will not be repeated here.

[0365] Optionally, during S308 to S309 , the electronic device 100 may execute S303 - S304 simultaneously.

[0366] S310: APP1 calls socket, socket calls transmission protocol stack, and realizes: data transmission (sending and / or receiving data of APP1) through socket6 and / or socket7. Figure 11 The instructions for S215 are similar and will not be repeated here.

[0367] After S307, when the preset time T03 has passed, the following situation 1 (concurrent scene) or the following situation 2 (switching scene) can be performed. For instructions on how to choose to perform situation 1 or situation 2, please refer to Figure 12 Description of the system dominant period T04.

[0368] In case 1 (concurrent scenario), Figure 13 The method shown may include, but is not limited to, the following steps:

[0369] S311: APP1 and socket transmit data (send and / or receive data of APP1).

[0370] S312: The socket calls the transmission protocol stack and transmits data through socket6 (sends and / or receives data of APP1).

[0371] S313: The socket calls the transmission protocol stack and transmits data through socket 7 (sends and / or receives data of APP1).

[0372] In case 2 (switching scenes), Figure 13 The method shown may include, but is not limited to, the following steps:

[0373] S314: The socket calls the transport protocol stack and closes socket6.

[0374] S315: The socket activates the old network card (the old network card corresponds to socket 6) through the network management system.

[0375] S315 is an optional step.

[0376] S316: APP1 and the socket transmit data (send and / or receive data of APP1).

[0377] S317: The socket calls the transmission protocol stack and transmits data through socket 7 (sends and / or receives data from APP1).

[0378] Figure 13 The method shown can correspond to Figure 12 The process shown, where Figure 13 S307-S309 corresponding Figure 12 From time t21 to time t23, Figure 13 S310 corresponding Figure 12 From time t23 to time t22, Figure 13 Case 1 / Case 2 corresponds to Figure 12 system-dominant period.

[0379] Not limited to Figure 13 In the examples shown, in other examples, the socket and the network management system can also be integrated together.

[0380] Not limited to Figure 13 In another embodiment, the connection managed by the APP can also be a packaged socket group or transport service. Figure 13 The process shown is similar, except that this time Figure 13 The socket in the package needs to be replaced with the encapsulated socket group or transport service, and the transport protocol stack needs to be replaced with the socket.

[0381] In one embodiment, Figure 12 and Figure 13 In the process shown, the system of the electronic device 100 can not only send a newpath notification to APP1, but also send a handoverstart notification to APP1. The handoverstart notification can include information about the data transmission speed (such as a value, level, or adjustment strategy) so that APP1 can control the current data transmission speed (i.e., the speed of transmitting data through connection1), for example, lowering the data transmission speed. In some examples, Figure 12 Before t21, that is, Figure 13 Before S306 / S307, the system of the electronic device 100 may send a handoverstart notification to APP1.

[0382] Example 2: In some scenarios of same-path switching, the IP will not change, such as changing cells, RRC release caused by loss of synchronization, switching of mobile standards (such as 5G to 4G), and temporary packet transmission restrictions due to the inability of the current card to send and receive due to the preemption of another card in dual-card TDM. In this scenario, the session managed by the APP remains unchanged, and the system of the electronic device 100 can send a notification to the APP to prevent the APP from sending data before the network link is restored, so that the user does not feel the network switching process. For details, please refer to the following Figure 14-15 Description.

[0383] Figure 14 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0384] like Figure 14As shown, APP1 manages 1 session1, session1 corresponds to connection1, connection1 corresponds to path1, and APP1 can transmit data through connection1. When the system of the electronic device 100 detects that the preset event 1 (i.e., the same-path switching event with unchanged IP) is started, that is, at time t31, the system of the electronic device 100 can report a handoverstart notification to APP1. The notification can carry the triggering reason for the switch / concurrency, such as the character reason: suspendlocal. After receiving the handoverstart notification, APP1 will stop sending data through connection1, but can continue to receive data. After time t31, the bottom layer link drop / no chain period T05 can be entered. During this period, path1 may be disconnected at the bottom layer, and there will be link abnormalities, but the IP will be maintained, and connection1 and session1 will also be maintained. The end point of the bottom layer link drop / no chain period T05 is time t32. After time t32, the underlying link establishment period T06 can be entered. During this period, path1 may be re-established at the underlying layer, that is, the link is restored. The end point of the underlying link establishment period T06 is the time t33 when the link is restored. For example, during the underlying link loss / no link period T05, a loss of synchronization may occur, resulting in RRC release, initiation of cell change, initiation of 5G to 4G switching, or the start of preemption of the other card in dual-SIM TDM (such as connecting a call on the other card). During the underlying link establishment period T06, RRC reestablishment is completed, cell switching is completed, 5G switches to 4G, and the end of preemption of the other card in dual-SIM TDM (such as ending a call on the other card) may occur. The underlying link loss / no link period T05 and the underlying link establishment period T06 are implemented by the system of the electronic device 100 and do not require the cooperation of the APP. When path1 achieves link recovery, that is, at time t33, a handover complete notification can be reported to APP1. After time t33, the transmission period T07 can be entered. During the transmission period T07, APP1 can resume normal data transmission and reception.

[0385] Not limited to the above example, in other examples, APP1 may also extend the data transmission timeout timer after receiving the handoverstart notification.

[0386] It is understandable that the above examples are explained with the caller being an APP. In other examples, the caller may also be a transmission protocol. In this case, after receiving the handoverstart notification, the transmission protocol may stop retrying to send data or extend the retry timer. When the transmission protocol receives the handovercomplete notification, it may immediately trigger data sending (including retrying), or the retry timer may continue to take effect. That is to say, in an embodiment of the present application, the transmission protocol can retry immediately when the network is restored, instead of performing blind data transmission (such as a timeout retry of data transmission based on a retry timer (i.e., blind retry)). The network switching process is fast and smooth, and the data sent by the transmission protocol after receiving the handovercomplete notification will not occupy the cache queue, will not affect the actual reception and transmission of business data, and has good air interface characteristics.

[0387] Figure 15 This is a schematic diagram of another network switching method provided in an embodiment of the present application. Figure 15 The method shown can be applied to the electronic device 100, which can include an APP (using APP1 as an example for illustration), a network service system, a socket service / transmission service, and a network management system. Figure 15 The following describes an example of deploying an encapsulated session interface in a network service system. Figure 15 The method shown may include, but is not limited to, the following steps:

[0388] S401: APP1 calls the network service system to create session1. Figure 10 The description of S101 is similar and will not be repeated here.

[0389] S402: The network service system applies session 1 to the network management system.

[0390] S403: The network management system returns an application response (applyresponse) to the network service system.

[0391] S404: The network service system calls the socket service / transmission service and binds connection1 (corresponding to path1) to session1 (in this case, session1 corresponds to connection1).

[0392] S405: The network service system calls the socket service / transport service, establishes a link on connection1 and completes the handshake (for example, TLS / DTLS handshake). For an explanation of S405, see Figure 10 The description of S105 is omitted here.

[0393] S406: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0394] S407: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection1.

[0395] S408: When the network management system detects that the preset event 1 (ie, the same-path switching event with unchanged IP) has started, it sends a switching command to the network service system.

[0396] S409: The network service system sends a handover start notification (which may carry a handover / concurrency triggering reason) to APP1.

[0397] For example, after receiving the handoverstart notification, APP1 stops sending data and can receive data.

[0398] S410: When the network management system detects that the preset event 1 ends, it sends a switching command to the network service system (the switching command here may be different from the switching command in S408).

[0399] S411: The network service system sends a handover complete notification to APP1.

[0400] Among them, the preset event 1 occurs during S408 to S411, including: the path 1 corresponding to the connection 1 is disconnected at the bottom layer (after S409 and before S410), and then the path 1 is automatically restored at the bottom layer, but the connection 1 is always maintained during this period.

[0401] For details on the handoverstart notification and handovercomplete notification, see Figure 10 The difference is that Figure 15 The switching process is from S409 to S411 (i.e. Figure 14In some examples, the handoverstart notification / handovercomplete notification may further include information indicating that the current switching process is a same-path switching, such as including the characters: same path. In some examples, the triggering reason for the switching in the handover start notification may further indicate that the current switching process is caused by the electronic device 100 itself, such as including reason: suspend local. In some examples, when the result of the switching completion in the handovercomplete notification is a successful switching, it includes the characters: resume, same path. In some examples, the dataspeed / dataspeedlevel in the handoverstart notification is 0. Therefore, after APP1 receives the handoverstart notification, it may stop sending and / or receiving data. Other details will not be repeated.

[0402] S412: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0403] S413: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection1.

[0404] Figure 15 The method shown can correspond to Figure 14 The process shown, where Figure 15 S409 to S411 correspond to Figure 14 The underlying chain drop / no chain period T05 and the underlying chain building period T06, Figure 15 S412-S413 corresponds to Figure 14 The transmission period is T07.

[0405] Not limited to Figure 15 In the examples shown, in other examples, some operations performed by the network service system can also be performed by the APP. The network service system can report notifications to the APP, and the APP performs corresponding operations based on the notifications. For example, link establishment and handshake can be performed by the APP.

[0406] Not limited to Figure 15 In another embodiment of the network switching method shown, the encapsulated session interface can also be deployed in the transmission service or the encapsulated socket group. Figure 15 The process shown is similar, except that this time Figure 15 The network service system in needs to be replaced with socket service / transmission service. Figure 15The socket service / transport service in needs to be replaced with BSD socket. In another implementation, the encapsulated session interface can also be deployed on BSD socket. The process in this case can refer to Figure 15 and Figure 11 The process shown will not be repeated here.

[0407] In the above-mentioned second embodiment, the APP of the electronic device 100 maintains a session (corresponding to a connection, which can be called an old connection). The old connection may have a situation where the IP remains unchanged but packets cannot be sent temporarily (i.e., preset event 1). The system of the electronic device 100 can report a notification to the APP at the beginning and end of the preset event 1, so that the APP does not send data when the preset event 1 is in progress, avoiding the APP from sending data during the underlying link drop / no link period T05 and the underlying link establishment period T06, resulting in data overflow in the buffer and packet loss. Therefore, the APP will not experience service lag when the preset event 1 is in progress, nor will it prompt a network anomaly (such as a random pop-up box), realizing a fast and smooth network switching / concurrency process. It can be understood that when the preset event 1 is in progress, the link can be automatically restored without the APP performing operations such as link establishment.

[0408] The above embodiment 2 is described by taking the sending of the handoverstart notification when detecting the start of the preset event 1 as an example. In other examples, the system of the electronic device 100 may also send the handoverstart notification to APP1 when predicting that the preset event 1 is about to start, so that APP1 caches data in advance. The cached data can be used for the service of APP1 during the underlying link loss / no link period T05 and the underlying link establishment period T06, that is, to ensure the normal use of the service and achieve smooth network switching. For example, Figure 14 In the figure, t31 is the start time of the preset event 1. Before t31, the system of the electronic device 100 can report the handoverstart notification to APP1, and APP1 can cache data. After t31 and before t33, APP1 can use the cached data for business.

[0409] Example 3: In some scenarios of same-path switching, IP will change, such as temporary network disconnection, self-healing, local IP change, communication peer IP change, communication peer link failure (such as communication peer link disconnection, IP and port unavailable, or detection of communication peer link as a dead link, or low priority scheduling, etc.), wireless communication chip abnormality resulting in uplink data but no downlink data or restricted transmission, base station / core network or other intermediate transmission nodes resulting in uplink data but no downlink data or restricted transmission, etc. In this scenario, the session managed by APP remains unchanged, and the system of electronic device 100 can establish and switch connections by itself without the cooperation of APP. For details, please refer to the following Figure 16-18 Description.

[0410] Figure 16 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0411] like Figure 16As shown, APP1 manages 1 session1, session1 corresponds to connection1, connection1 corresponds to network link (path) 1, and APP1 can transmit data through connection1. When the system of electronic device 100 detects that the preset event 2 (i.e., the same-path switching event of IP change) is started, that is, at time t41, the system of electronic device 100 can report a handoverstart notification to APP1, which can carry the triggering reason of the switch / concurrency, such as the character reason: suspend. After time t41, the system recovery period T08 can be entered. In the system recovery period T08, from time t41 to time t42, the link of path1 will be released, the IP will not be maintained, and the connection1 corresponding to the original IP can be closed. The order of link release and connection1 closure of path1 is not limited, and session1 can be maintained. The end point of the system recovery period T08 is time t43 when the system IP is restored (such as network loss recovery, IP change completion, self-healing recovery, etc.) (optionally and network card recovery). After time t43, the system link establishment period T09 can be entered. During this period, the system of the electronic device 100 can re-establish the link on the new path2, and the connection corresponding to the session1 managed by APP1 becomes the new connection2 (corresponding to path2) (corresponding to the new IP after recovery). The end point of the system link establishment period T09 is the time t44 when the link establishment is completed. When the system of the electronic device 100 completes the link establishment, that is, at time t44, a handovercomplete notification can be reported to APP1. After time t44, the transmission period T010 can be entered. During the transmission period T010, APP1 can resume normal data transmission and reception. Optionally, before the start of the transmission period T010, APP1 can first perform the first action to achieve "complete switching" of the communication link. For specific instructions, please refer to Figure 9 The description of the first action in will not be repeated here.

[0412] Figure 17 This is a schematic diagram of another network switching method provided in an embodiment of the present application. Figure 17 The method shown can be applied to the electronic device 100, which can include an APP (using APP1 as an example for illustration), a network service system, a socket service / transmission service, and a network management system. Figure 17 The following describes an example of deploying an encapsulated session interface in a network service system. Figure 17 The method shown may include, but is not limited to, the following steps:

[0413] S501: APP1 calls the network service system to create session1. Figure 10 The description of S101 is similar and will not be repeated here.

[0414] S502: The network service system applies session 1 to the network management system.

[0415] S503: The network management system returns an application response (applyresponse) to the network service system.

[0416] S504: The network service system calls the socket service / transmission service and binds connection1 (corresponding to path1) to session1 (in this case, session1 corresponds to connection1).

[0417] S505: The network service system calls the socket service / transport service, establishes a link on connection1 and completes the handshake (for example, TLS / DTLS handshake). For an explanation of S505, see Figure 10 The description of S105 is omitted here.

[0418] S506: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0419] S507: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection1.

[0420] S508: When the network management system detects that the preset event 2 (ie, the same-path switching event with IP change) has started, it sends a switching command to the network service system.

[0421] S509: The network service system sends a handover start notification (which may carry a handover triggering reason) to APP1.

[0422] S510: The network service system calls the socket service / transmission service and closes connection1 (session1 has no corresponding connection at this time).

[0423] S511: When the network management system detects that the system IP is restored (which can be understood as the end point of preset event 2), it sends a switching command to the network service system.

[0424] Among them, the preset event 2 occurs during S509 to S511, including: path 1 corresponding to connection 1 is released, and then the system IP is restored (the restored IP is different from the previous IP).

[0425] S512: The network service system calls the socket service / transmission service and binds connection2 to session1 (session1 corresponds to connection2 at this time).

[0426] S513: The network service system calls the socket service / transport service, establishes a link on connection2 (corresponding to path2) (corresponding to the restored IP) and completes the handshake (for example, TLS / DTLS handshake). For an explanation of S513, see Figure 10 The description of S105 is omitted here.

[0427] S514: The network service system sends a handover complete notification to APP1.

[0428] For details on the handover start notification and handover complete notification, see Figure 10 The difference is that Figure 17 The switching process is the process from S509 to S514 (ie Figure 16 In some examples, the handover start notification may further include information indicating that the current switching process is a same-path switching, such as including the characters: same path. In some examples, the triggering reason for the switching in the handover start notification may further indicate that the current switching process is caused by the electronic device 100 itself, such as including reason: suspend local. In some examples, when the result of the switching completion in the handover complete notification is a successful switching, it includes the characters: resume, same path, and optionally also includes the characters: re-entry (reEnter), or ip change (ip change). In some examples, the dataspeed / dataspeedlevel in the handover start notification is 0. Therefore, after APP1 receives the handover start notification, it can stop sending data and / or receiving data. Other details will not be repeated.

[0429] S515: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0430] S516: The network service system calls the socket service / transmission service to transmit data (send and / or receive data of APP1) through connection2.

[0431] Figure 17 The method shown can correspond to Figure 16 The process shown, where Figure 17 S509 to S511 correspond to Figure 16 System recovery period T08, Figure 17 S512 to S514 correspond to Figure 16 The system link building period is T09, Figure 17 S515-S516 corresponding Figure 16 The transmission period is T010.

[0432] The above examples illustrate that the system IP will automatically recover. In other examples, it may not recover automatically. If the system IP is not recovered within the preset time after the handoverstart notification is reported, and the connection2 link cannot be successfully established, the network switching process can be terminated, and the network service system of the electronic device 100 can report a session close notification to APP1, and session1 can be closed. The preset time can be set by the system of the electronic device 100 or notified to the system of the electronic device 100 by the caller.

[0433] Not limited to the preset event 1 / preset event 2 exemplified in the above-mentioned embodiment 2 and embodiment 3, in another embodiment, the above-mentioned preset event 1 / preset event 2 may also be caused by the communication counterpart or intermediate transmission node of the electronic device 100 (for example, caused by a core network abnormality or an access network abnormality). Optionally, the handoverstart notification may carry corresponding indication information, for example, reason: suspend remote. In another embodiment, the above-mentioned preset event 1 / preset event 2 may also be triggered by the system of the electronic device 100 detecting a failure in the transmission protocol, such as but not limited to: no downlink water (i.e., the communication peer cannot receive downlink data, for example, some users cannot load the applet page), TCP zero window (i.e., when the receiving buffer of the receiving end is full, it will notify the sending end to stop sending data), DNS no response / no response to link establishment / packet internet groper (ping) no response, the transport layer does not perceive the air interface (for example, the number of HTTP multiplexing is not associated with the air interface, the transport layer blind retry, etc.), blind data transmission (that is, the electronic device does not obtain the air interface status and blindly performs data transmission, for example, including blind retry: timeout retry of data transmission based on the retry timer), blind protection (for example, the electronic device does not obtain the air interface status and blindly protects the data link), do Recovery does not cover the core network / server failure or detection time is too long / electronic device modem failure or detection time is too long / no self-healing measures are available (for example, when there is uplink data but no downlink data, transport layer data and signaling are not distinguished; when there is uplink data but no downlink data, flow statistics are not counted; DNS / synchronize sequence numbers (SYN) / ping is not covered when there is uplink but no downlink data; signaling anomalies are not monitored and self-healing is not available; DNS is too long; detection time for uplink data but no downlink data is too long; a large number of retransmitted packets are received during or after a link is broken); link establishment / teardown anomalies are not perceived by the app (for example, no response to link establishment, TCP reset immediately after the response to link establishment, or a large number of retransmitted packets are received during or after a link is broken). For examples of transmission protocol failures, see Figure 18 .

[0434] The above embodiment three is explained by taking the automatic recovery of the system IP as an example. In another embodiment, the system IP may not recover automatically, for example, the above-mentioned communication peer failure, intermediate transmission node failure, transmission protocol failure, etc., then the above-mentioned system IP recovery can also be replaced by: the electronic device 100 uses a new communication IP by itself, for example, replaces the communication IP, or switches the version of the communication IP (for example, switching from v4 to v6 or from v6 to v4). Not limited to this, the above-mentioned system IP recovery can also be replaced by: replacing the communication port, the above-mentioned system IP recovery can also be replaced by: replacing the IP of the communication peer (for example, using other IPs cached in the DNS, or re-initiating a DNS query to obtain a new destination IP), the above-mentioned system IP recovery can also be replaced by: replacing the port of the communication peer, the above-mentioned system IP recovery can also be replaced by: the electronic device 100 triggers system self-healing (for example, turning on and off the flight mode, turning on and off the data service switch, resetting the communication chip, etc.). It is understandable that in the case that the system IP does not recover automatically, for example, when there is no network and no IP, the network or IP is lost due to the common delayed reporting or non-reporting, if the original communication IP or port is used to re-establish the connection, it is likely that the switching cannot be completed normally. For example, take a scenario where the link is abnormally disconnected and the link is re-established at the same communication IP as an example. APP1 performs a TCP reset but the communication peer is still sending data to APP1. For example, during or after the link is disconnected, APP1 receives a large number of retransmitted messages for more than 2 minutes, and the electronic device 100 performs TCP reconstruction on the same communication IP but the communication peer has no response. In this embodiment of the present application, the system of the electronic device 100 can use a new communication IP or trigger system self-healing, and then re-establish the link, and interact with APP1 through handoverstart notification, handovercomplete notification, and the above problems will not occur.

[0435] Not limited to Figure 17 In the examples shown, in other examples, some operations performed by the network service system can also be performed by the APP. The network service system can report notifications to the APP, and the APP performs corresponding operations based on the notifications. For example, link establishment and handshake can be performed by the APP.

[0436] Not limited to Figure 17 In another embodiment of the network switching method shown, the encapsulated session interface can also be deployed in the transmission service or the encapsulated socket group. Figure 17 The process shown is similar, except that this time Figure 17 The network service system in needs to be replaced with socket service / transmission service. Figure 17The socket service / transport service in needs to be replaced with BSD socket. In another implementation, the encapsulated session interface can also be deployed on BSD socket. The process in this case can refer to Figure 17 and Figure 11 The process shown will not be repeated here.

[0437] Figure 18 This is a schematic diagram of another network switching method provided in an embodiment of the present application. Figure 18 The method shown can be applied to an electronic device 100, which can include an APP (using APP1 as an example for illustration), a network service system, and a transmission protocol stack. Figure 18 The following describes an example in which a preset event is caused by an abnormality in the transmission protocol stack. Figure 18 The method shown may include, but is not limited to, the following steps:

[0438] S601: APP1 reports service freeze to the network service system.

[0439] S601 is an optional step.

[0440] S602: When the transmission protocol stack detects that the transmission protocol stack is abnormal, it sends a corresponding notification to the network service system.

[0441] S603: The network service system sends a handover start notification (which may carry a handover triggering reason) to APP1.

[0442] Among them, after the network service system obtains the transmission protocol stack exception, it can execute S603, and since the system IP generally does not recover automatically in this scenario, the network service system can execute at least one of the following: changing the communication IP of the local end, switching the version of the communication IP of the local end, changing the communication port of the local end, changing the IP of the communication peer end, changing the port of the communication peer end, triggering system self-healing, etc., and then performing the link establishment shown in S604-S605.

[0443] S604: The network service system calls the transport protocol stack and starts to build a link on the new connection.

[0444] S605: The transport protocol stack returns to the network service system: the link is established on the new connection.

[0445] S606: The network service system sends a handover complete notification to APP1.

[0446] S607: APP1 and the network service system transmit data (send and / or receive data of APP1).

[0447] S608: The network service system calls the transmission protocol stack to transmit data (send and / or receive data of APP1) through the new connection.

[0448] Not limited to the implementation shown in the above-mentioned embodiment three, in another implementation, it can also be "Example two turns to Example three". Specifically, under Example two, when the underlying link establishment period T06 cannot be completed, for example, the system of the electronic device 100 cannot successfully establish a link on the original path1 (that is, it cannot successfully execute S410), then the subsequent steps in Example two can be omitted. In some examples, when APP1 actively disconnects session1 or connection1, the underlying link establishment period T06 cannot be completed, and the system of the electronic device 100 can directly end the network switch. In other examples, when the communication peer actively disconnects the network link with APP1, the underlying link establishment period T06 cannot be completed, and the system of the electronic device 100 can report the link disconnection notification to APP1, and APP1 determines how to handle it. Alternatively, the system of the electronic device 100 can also perform subsequent steps as described in Example three, such as: using a new communication IP / triggering system self-healing, and then executing Figure 17 S512-S516 shown.

[0449] In the above-mentioned embodiment three, the APP of the electronic device 100 maintains a session (corresponding to a connection, which can be called an old connection). The old connection may have a preset event 2 of IP change. When the preset event 2 occurs, the system of the electronic device 100 can actively establish a new connection, which can support the IP change of the local end or the communication end, and can achieve link self-healing without relying on the APP, avoiding the problems caused by the APP not being rebuilt, and realizing a fast and smooth network switching / concurrency process.

[0450] The above embodiment 3 is described by taking the sending of the handoverstart notification when detecting the start of the preset event 2 as an example. In other examples, the system of the electronic device 100 may also send a handoverstart notification to APP1 when predicting that the preset event 2 is about to start, so that APP1 caches data in advance. The cached data can be used for the service of APP1 during the system recovery period T08 and the system link establishment period T09, that is, to ensure the normal use of the service and achieve smooth network switching. For example, Figure 16In the figure, t41 is the start time of the preset event 2. Before t41, the system of the electronic device 100 can report the handoverstart notification to APP1, and APP1 can cache data. After t41 and before t44, APP1 can use the cached data for business.

[0451] The above embodiments 2 and 3 are described by taking the sending of handover start notification and handover complete notification to APP (or 3rd lib, or transmission protocol) as an example. In a specific implementation, the system of the electronic device 100 (such as a network service system or other modules, etc.) can also send a notification to the module for managing the display of the signal bar of the electronic device 100 (which can be simply referred to as the display module). The notification may include the handover start notification and / or handover complete notification in the embodiment of the present application. For example, the module for managing the indicator of the cellular network in the signal bar is Figure 6 The communication (telephony) module (not shown) in the framework layer shown, or Figure 6 The RILD module in the hardware abstraction layer shown, wherein the indicator of the cellular network includes, for example Figure 2A The indicator 211A and the data service arrow 211B in the user interface 210 shown, for example, the module for managing the indicator of the Wi-Fi network in the signal bar (which may include the data service arrow) is Figure 6 The Wi-Fi management module (not shown) in the framework layer shown, or Figure 6The Wi-Fi guard module in the hardware abstraction layer shown. Next, take the telephony module as an example to illustrate. In an embodiment of the present application, when the network service system detects that the preset event 2 has started or is about to start, it sends a handover start notification to the telephony module; after the telephony module receives the handover start notification, it can control the indicator of the cellular network in the signal bar to remain unchanged or change smoothly during the switching process. For example; after the network service system detects that the system IP has recovered, or performs other operations (such as changing the communication IP of the local end, switching the version of the communication IP of the local end, changing the communication port of the local end, changing the IP of the communication peer end, changing the port of the communication peer end, or triggering system self-healing, etc.), it sends a handover complete notification to the telephony module; after the telephony module receives the handover complete notification, the indicator of the cellular network in the signal bar can be displayed normally. Among them, the network service system sends a handover start notification to the telephony module, and, the order in which the network service system sends the handover start notification to the APP is not limited. The order in which the network service system sends the handovercomplete notification to the telephony module and the network service system sends the handovercomplete notification to the APP is not limited.

[0452] For example, assuming that the same path switching process when the network switching method of the embodiment of the present application is not executed is Figure 1D The process shown in Figure 1D In the example, the network will be disconnected at time t6. Therefore, before time t6, the signal bar displayed by the telephony module can be Figure 2A The status bar 211 in the user interface 210 shown, namely the cellular network indicator 211A and the data service arrow 211B are normal. After time t6, the signal bar displayed by the telephony module may be Figure 2C The status bar 211 in the user interface 230 shown, i.e., the signal of the cellular network indicator 211A is grayed out and includes an x, and the data service arrow 211B is not displayed. At time t8, the network is successfully established, and PDP is successfully acted. Therefore, after time t8, the signal bar displayed by the telephony module can be Figure 2B The status bar 211 in the user interface 220 shown, that is, the signal of the cellular network indicator 211A is normal, but the data service arrow 211B is not displayed. After time t9, when APP1 transmits data through the cellular network, the telephony module controls the displayed signal bar to return to normal. Figure 2AIn the status bar 211 of the user interface 210 shown in FIG, when APP1 is not transmitting data through the cellular network, the signal bar is still Figure 2B The status bar 211 in the user interface 220 shown in FIG. The same path switching process and Figure 1D The difference is as follows: at time t6 when the network is disconnected, the system of the electronic device 100 can send a handoverstart notification to the telephony module. At time t8, the network is successfully established, and the PDP act is successfully, the system IP is restored, and the system of the electronic device 100 can establish a link by itself. At time t9, the link establishment is completed, and the system of the electronic device 100 can send a handovercomplete notification to the telephony module. After time t9, APP1 can perform data transmission through the cellular network. Among them, the time from t6 to t9 can correspond to Figure 16 From time t41 to time t44, the telephony module controls the cellular network indicator in the signal column to remain unchanged, for example, to remain unchanged. Figure 2A The status bar 211 in the user interface 210 shown, or the telephony module controls the smooth display of the cellular network indicator in the signal bar, optionally increases the time interval for the signal bar to change, optionally delays the time for the signal bar to change, and optionally displays only part of the status of the signal bar change.

[0453] The example of the telephony module controlling the smooth display of the cellular network indicator in the signal bar is as follows. For example, assuming Figure 1D The time from time t6 to the start of data transmission is 5 seconds, and the time for starting data transmission is time t9 or after time t9. Here, time t9 is used as an example for explanation. If the network switching method of the embodiment of the present application is not executed, please refer to the above Figure 1DWhen executing the network switching method of the embodiment of the present application, from time t6 to time t9, the signal bar will change from the status bar 211 in the user interface 210 to the status bar 211 in the user interface 230 within 2 seconds, and then change to the status bar 211 in the user interface 220 after 1 second, and finally change to the status bar 211 in the user interface 210 after 2 seconds. The case is not limited to the above example. In other examples, it can remain as the status bar 211 in the user interface 210 in the first 2 seconds and remain as the status bar 211 in the user interface 220 in the remaining 3 seconds, and the status of the status bar 211 in the user interface 230 is not displayed (which can be understood as a network disconnected state). In other examples, when executing the network switching method of the embodiment of the present application, the signal bar may always display the cellular network indicator 211A and the data service arrow 211B within 5 seconds, wherein the number of signal bars of the cellular network indicator 211A may change within 5 seconds, such as: 4 bars (i.e., full bars) within 2 seconds (at this time the signal bar is the status bar 211 in the user interface 210), 2 bars within the next 2 seconds, and 4 bars within the remaining 1 second (at this time the signal bar is the status bar 211 in the user interface 210), and the status of the status bar 211 in the user interface 220 and the status of the status bar 211 in the user interface 230 are not displayed.

[0454] Example 4: During or before the same-path switching process of communication mode 1, the system of electronic device 100 can concurrently start the link establishment process of communication mode 2 (which can be simply referred to as the concurrent link establishment process). Communication mode 1 and communication mode 2 are different, and the session managed by the APP remains unchanged.

[0455] The same path switching process in the fourth embodiment may include the link release and link establishment of the communication mode 1, which may be the same path switching process shown in the second embodiment, for example, including Figure 14 The process in the bottom layer link drop / no link period T05 and the bottom layer link establishment period T06 shown in the embodiment may be the same path switching process shown in the third embodiment, for example, including Figure 16 The concurrent link establishment process in the fourth embodiment may include the link establishment in communication mode 2, which may be the link establishment shown in the first embodiment, for example, including Figure 9 The same path switching process and the concurrent link establishment process in the fourth embodiment are processes corresponding to different connections, but belong to the same session.

[0456] The fourth embodiment can be understood as the electronic device 100 combining the switching / concurrency strategy shown in the first embodiment (see Figures 9-11), and the switching / concurrency strategies shown in Example 2 / Example 3 (see Figures 14-18 (Hard switching), that is, converged switching, can solve the problem of not being able to send and receive messages normally before the network link is restored in the same path switching scenario, making the network switching / concurrency process faster and smoother. For details, see the following Figures 19-23 Description.

[0457] Exemplarily, communication mode 1 is Wi-Fi, and communication mode 2 is cellular communication. When the user moves back and forth between the coverage areas of the two Wi-Fi networks, the electronic device 100 will frequently connect to and disconnect from the Wi-Fi network, that is, the Wi-Fi same-path switching process will be performed multiple times, and the Wi-Fi network will not be able to access the Internet normally. In Example 4, before the Wi-Fi same-path switching process is performed, the concurrent link establishment process of the cellular communication can be started concurrently, that is, the cellular communication network can be pulled up before the above-mentioned Wi-Fi network switching, and the cellular communication network can be disconnected after the above-mentioned Wi-Fi network switching, so that a smooth experience of Wi-Fi switching can be guaranteed by switching of cellular communication. Not limited to the above examples, in other examples, the Wi-Fi same-path switching process can also be a process in which the system of the electronic device 100 triggers Wi-Fi self-healing when Wi-Fi data transmission and reception is abnormal. The cellular communication network can be pulled up before the Wi-Fi self-healing is restored, and the cellular communication network can be disconnected after the Wi-Fi self-healing is restored.

[0458] For example, communication mode 1 is cellular communication of the primary card, and communication mode 2 is cellular communication of the secondary card. Before the same-path switching process of the primary card is performed, the concurrent link establishment process of the secondary card can be started concurrently. That is, when the electronic device 100 uses the cellular communication service of the primary card, if the cellular communication service of the primary card fails, the electronic device 100 can first switch to the cellular communication service of the secondary card and trigger the self-healing of the primary card. When the primary card recovers after self-healing, the electronic device 100 switches to the cellular communication service of the primary card. In this way, the smooth self-healing experience of the primary card can be guaranteed by switching the secondary card.

[0459] Figure 19 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 19 For example, the concurrent link establishment process starts earlier than the same-path switching process.

[0460] like Figure 19As shown, the electronic device 100 can perform a concurrent link establishment process between time t51 and time t54, and a same-path switching process between time t52 and time t53, where the time order from earliest to latest is: t51, t52, t53, t54. The system of the electronic device 100 can report a handoverstart notification to the APP at the starting point of the concurrent link establishment process that starts earlier (i.e., time t51). The system of the electronic device 100 can report a handovercomplete notification to the APP at the end point of the same-path switching process that ends earlier (i.e., time t53).

[0461] Figure 20 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 20 For example, the start time of the concurrent link establishment process is equal to the start time of the same-path switching process.

[0462] Figure 20 and Figure 19 Similar, the difference is that the time sequence of t51, t52, t53, and t54 is different. Figure 20 The earliest and latest time are: t51 (equal to t52), t54, t53. In addition, the method of sending the switching notification is different. Figure 20 In the process, the system of the electronic device 100 can report a handoverstart notification to the APP at the starting point of the same-path switching process and the concurrent link establishment process (i.e., time t51, i.e., time t52). The system of the electronic device 100 can report a handovercomplete notification to the APP at the end point of the concurrent link establishment process (i.e., time t54) and at the end point of the same-path switching process (i.e., time t53).

[0463] Not limited to Figure 20 In the example shown, in other examples, the end time t53 of the same-path switching process may be earlier than the end time t54 of the concurrent link establishment process, or they may be equal.

[0464] Figure 21 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 21 For example, the start time of the concurrent link establishment process is earlier than the start time of the same-path switching process, and the end time of the concurrent link establishment process is earlier than the end time of the same-path switching process.

[0465] Figure 21 and Figure 19 Similar, the difference is that the time sequence of t51, t52, t53, and t54 is different. Figure 21The earliest to latest time is: t51, t52, t54, t53. In addition, the method of sending the switching notification is different. Figure 21 In the process, the system of the electronic device 100 can report a handoverstart notification to the APP at the starting point of the concurrent link establishment process that started earlier (i.e., time t51). The system of the electronic device 100 can report a handovercomplete notification to the APP at the end point of the concurrent link establishment process (i.e., time t54) and at the end point of the same-path handover process (i.e., time t53).

[0466] Figure 22 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 22 For example, the end time of the concurrent link establishment process is earlier than the start time of the same-path switching process.

[0467] Figure 22 and Figure 19 Similar, the difference is that the time sequence of t51, t52, t53, and t54 is different. Figure 22 The earliest to latest time is: t51, t54, t52, t53. In addition, the method of sending the switching notification is different. Figure 22 In the process, the system of the electronic device 100 can report a handoverstart notification to the APP at the start point of the concurrent link establishment process (i.e., time t51) and at the start point of the same-path handover process (i.e., time t52). The system of the electronic device 100 can report a handovercomplete notification to the APP at the end point of the concurrent link establishment process (i.e., time t54) and at the end point of the same-path handover process (i.e., time t53).

[0468] Not limited to the above example, in other examples, the end time t54 of the concurrent link establishment process may be equal to the end time t53 of the same-path switching process.

[0469] Not limited to the above example, in other examples, the end time t54 of the concurrent link establishment process may be equal to the start time t52 of the same-path switching process.

[0470] It can be understood that in order to ensure that messages can be sent and received normally before the network link is restored in the same-path switching scenario, the start time t51 of the concurrent link establishment process must be earlier than or equal to the start time t52 of the same-path switching process, but the end time t54 of the concurrent link establishment process and the end time t53 of the same-path switching process are not limited in order.

[0471] In embodiment four, the system of the electronic device 100 can report a handoverstart notification to the APP at the start time of the concurrent link establishment process and / or the start time of the same-path switching process, and the system of the electronic device 100 can report a handovercomplete notification to the APP at the end time of the concurrent link establishment process and / or the end time of the same-path switching process.

[0472] Below is Figure 20 The execution mode shown in the figure is used as an example to introduce the specific implementation mode of the network switching / concurrency process under embodiment 4. Figure 23 The instructions for other execution methods are similar and will not be repeated here.

[0473] Figure 23 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0474] like Figure 23As shown, APP1 manages one session1, session1 corresponds to connection3, connection3 corresponds to network link (path) 3, and APP1 can transmit data through connection3. Subsequently, the same path switching process corresponding to connection3 will occur (time t55 to time t59), wherein time t55 to time t57 is the system recovery period T08, during which path3 will be released and connection3 will be closed. The order of path3 link release and connection3 closure is not limited, and then the system IP will be restored. Time t57 to time t59 is the system link establishment period T09, during which the system of electronic device 100 can establish a link on the new path4, and the connection corresponding to session1 managed by APP1 becomes the new connection4 (corresponding to path2). Moreover, at the start time t55 of the same-path switching process, the concurrent link establishment process (i.e., the system link establishment period T00) can be started simultaneously (time t55 to time t56, t56 is less than t57). During the system link establishment period T00, the system of the electronic device 100 can concurrently establish a link on the new path5, and the connection corresponding to the session1 managed by APP1 adds a new connection5 (corresponding to path5). After the system link establishment period T00, the APP autonomous period T01 can be entered (time t56 to time t58, t58 is greater than t57 and less than t59). During the APP autonomous period T01, for connection5, APP1 can independently choose whether to transmit data. Optionally, APP1 can perform the first action to achieve "complete switching" of the communication link. After the APP autonomous period T01 times out, APP1 can transmit data through connection5. At the start time t55 of the same-path switching process (that is, the start time of the concurrent link establishment process), the system of the electronic device 100 can report a handoverstart notification to APP1. At the end time t56 of the concurrent link establishment process, and at the end time t59 of the same-path switching process, the system of the electronic device 100 can report a handovercomplete notification to APP1.

[0475] like Figure 23As shown, after the end time t59 of the same path switching process, the system of electronic device 100 can determine whether to perform concurrency. If it is determined that concurrency is not performed, the system of electronic device 100 can release the link on path 5 established during the concurrent link establishment process, and connection 5 will also be closed. APP1 can perform data transmission through connection 4 after the same path switching. If it is determined that concurrency is performed, the system of electronic device 100 can divert or copy the uplink data to be sent by APP1 to path 4 and path 5.

[0476] The above description uses a two-path case of a same-path switching process and a concurrent link establishment process as an example. In a specific implementation, there may be three or more paths, where some or all of these paths may be different communication links. For example, the three paths include a same-path switching process and two concurrent link establishment processes. The same-path switching process is the switching process of the link of communication mode 1, and the two concurrent link establishment processes are the establishment processes of the links of communication mode 2 and communication mode 3, respectively. The specific description is similar to the above process and will not be repeated here.

[0477] The above examples illustrate some ways to determine whether to perform network switching / concurrency, for example, Figure 10 and Figure 11 In the process, the network management system can determine whether to perform network switching / concurrency based on the obtained QoE. For example, Figure 18 In the embodiment, the network service system can determine whether to perform network switching / concurrency based on the service freeze notification feedback from the APP and the abnormal notification sent by the transmission protocol stack. It is not limited to this. It can also be determined based on other instructions reported by the APP, or based on the notification reported by the wireless communication system. The system can also identify it by itself from the transmission protocol stack, wireless communication system, etc. The embodiment of the present application does not limit the method of determining whether to perform network switching / concurrency.

[0478] Example 5: Service avoidance is achieved through handover notification, wherein service avoidance can be: the system of the electronic device 100 analyzes the performance, power consumption, and whether the APP service flow / data packet is a key flow / data packet (for example, a higher priority, a lower latency requirement, etc.), maintains the normal transmission and reception of the key flow / data packet, and stops or limits the transmission and reception of other flows / data packets. For details, see Figure 24 Description.

[0479] Figure 24 This is a schematic diagram of a service avoidance process provided in an embodiment of the present application. Figure 24 The process shown can be applied to the electronic device 100, which can include multiple APPs (using APP2, APP3 and APP4 as examples for illustration) and a network service system. Figure 24 The process shown may include, but is not limited to, the following steps:

[0480] S701: APP3 notifies the network service system of the existence of a key flow.

[0481] S701 is an optional step. In another implementation, it is not the APP that notifies the network service system, but the network service system that automatically identifies the key flow.

[0482] S702: The network service system sends a switching notification 1 to APP2.

[0483] S703: The network service system sends a switching notification 2 to APP4.

[0484] After the network service system obtains the existence of the key flow of APP3, it can stop or limit the data transmission and reception of other APPs (APP2 and APP4), so S702 and S703 can be executed. In one embodiment, the switching notification 1 / switching notification 2 in S702 / S703 may include indication information. If the indication information indicates suspension, it indicates that the data transmission and reception of other APPs is stopped. If the indication information indicates speed-limited (for example, the indication information is the same as the speed-limited information), the switching notification 1 / switching notification 2 in S702 / S703 may include indication information. Figure 10 The information about the data transmission speed included in the handoverstart notification is similar and will not be repeated here), which indicates that the amount of data / speed at which other apps can send and receive data is limited.

[0485] The order of S702 and S703 is not limited.

[0486] S704: APP3 and the network service system transmit APP3's business data.

[0487] S705: The network service system transmits the business data of APP3.

[0488] S704 and S705 may be executed during the period when the key flow of APP3 exists, so as to realize the normal sending and receiving of the key flow of APP3.

[0489] After S702, APP2 can start service avoidance after receiving the switching notification 1, and after S703, APP4 can start service avoidance after receiving the switching notification 2. Service avoidance can include active avoidance and passive avoidance. For the convenience of explanation, Figure 24 The following description is made by taking an example where APP2 performs active avoidance and APP4 performs passive avoidance.

[0490] During the period when APP2 performs active avoidance, APP2 may not send or reduce the sending of APP2's business data to the network service system.

[0491] While APP4 is performing passive avoidance, the electronic device 100 may execute S706 and S707.

[0492] S706: APP4 and the network service system transmit the business data of APP4.

[0493] S707: The network service system returns an avoidance message to APP4, or processes the business data of APP4 through other flow control methods.

[0494] The avoidance message includes, for example, a block message, a busy message, or an eagain message.

[0495] In one embodiment, during the period when APP3 has a critical flow, if another APP (using APP2 as an example) that is performing service avoidance has a critical data packet, the service avoidance of APP2 can be temporarily lifted, and service avoidance can be performed again after the transmission of the critical data packet of APP2 is completed. For specific examples, please refer to the description of the following steps. After S707, Figure 24 The illustrated method may further include:

[0496] S708: When the network service system detects that APP2 has a critical data packet, it sends a switching notification 3 to APP2.

[0497] Among them, switching notification 3 corresponds to switching notification 1. When the indication information in switching notification 1 indicates suspend, the indication information in switching notification 3 indicates resume. When the indication information in switching notification 1 indicates speed-limited, the indication information in switching notification 3 indicates speed-unlimited.

[0498] S708 is described by taking the network service system automatically identifying key data packets as an example. In other examples, the APP may notify the network service system.

[0499] After receiving the switching notification 3, APP2 can resume normal data transmission and reception, that is, execute S709 and S710.

[0500] S709: APP2 and the network service system transmit key data packets of APP2.

[0501] S710: The network service system transmits the key data packet of APP2.

[0502] S711: The network service system sends a switching notification 4 to APP2.

[0503] After the network service system detects that the transmission of the key data packet of APP2 is completed, S711 can be executed. The description of switching notification 4 is similar to that of switching notification 1 / switching notification 2 above. Therefore, after receiving switching notification 4, APP2 can continue to avoid services.

[0504] After S707 / S711, Figure 24 The illustrated method further includes:

[0505] S712: The network service system sends a switching notification 5 to APP2.

[0506] S713: The network service system sends a switching notification 6 to APP4.

[0507] The descriptions of Handover Notification 5 and Handover Notification 6 are similar to those of Handover Notification 4. Therefore, upon receiving Handover Notification 5, APP2 can stop performing service avoidance and subsequently continue data transmission normally. Similarly, upon receiving Handover Notification 6, APP4 can stop performing service avoidance and subsequently continue data transmission normally.

[0508] In some examples, the handover notification 1 / handover notification 2 is a handoverstart notification, and the handover notification 5 / handover notification 6 is a handovercomplete notification.

[0509] In some examples, the handover notification 3 is a handoverstart notification, and the handover notification 4 is a handovercomplete notification.

[0510] In the above embodiment, the network switching / concurrency process occurs after the network link is established (i.e., the data transmission stage). In a specific implementation, it can also occur during the network link establishment process. For specific examples, see Figure 25-27 It can also occur when the network link is not established (the network link is not initiated or fails to be established). For specific examples, see Figure 28 Description.

[0511] Figure 25 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 25 For example, the time it takes to complete link establishment for path 1 is equal to the time it takes to complete link establishment for path 2.

[0512] like Figure 25As shown, APP1 manages one session1. From time t61 to time t63, the link establishment process of path1 can be performed. Specifically, APP1 can establish a link on path1, and the connection corresponding to session1 managed by APP1 adds a new connection1 (corresponding to path1). From time t62 (t62 is greater than t61) to time t63 (i.e., the system link establishment period T00), the link establishment process of path2 can be performed. Specifically, the system of electronic device 100 can concurrently establish a link on the new path2, and the connection corresponding to session1 managed by APP1 adds a new connection2 (corresponding to path2). At the starting time t62 of the system link establishment period T00, the system of electronic device 100 can report a handoverstart notification to APP1. At the end time t63 of the system link establishment period T00 (i.e., the time when path1 link establishment is completed, i.e., the time when path2 link establishment is completed), the system of electronic device 100 can report a handovercomplete notification to APP1. Time t63 to time t64 can be the APP autonomous period T01. After the APP autonomous period T01, the system dominant period T02 can be entered. The description of the APP autonomous period T01 and the system dominant period T02 here is the same as Figure 9 The descriptions of the APP autonomous period T01 and the system-dominated period T02 are similar and will not be repeated here.

[0513] Figure 26 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 26 For example, the time when path 1 is established is earlier than the time when path 2 is established.

[0514] Figure 26 and Figure 25 The difference is that the completion time t65 of the link establishment process of path1 is different from the completion time t63 of the link establishment process of path2. t65 is less than t63. From time t65 to time t63, APP1 can use connection1 for data transmission.

[0515] Figure 27 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 27 For example, the time when path 1 is established is later than the time when path 2 is established.

[0516] Figure 27 and Figure 25The difference is that the completion time t65 of the link establishment process for path1 is different from the completion time t63 of the link establishment process for path2. t65 is greater than t63. From time t63 to time t65, App1 can use connection2 for data transmission. In addition, the App autonomous period T01 at this time is from time t65 to time t64.

[0517] The above example Figure 25-27 Taking the release of the old path 1 (executed during the system dominant period T02) when no concurrency is performed as an example, in a specific implementation, a new path 1 may also be released, or the released path may be selected based on the information of path 1 and path 2. For example, in a scenario of connection competition, a path with a lower transmission speed may be selected for link release. This embodiment of the present application is not limited to this.

[0518] Figure 28 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0519] like Figure 28 As shown, APP1 manages one session1, and the path corresponding to session1 has not been established, so there is no IP at this time. From time t66 to time t67 (i.e., the system link establishment period T00), the link establishment process of path1 can be performed. Specifically, APP1 can establish a link on path1, and the connection corresponding to session1 managed by APP1 adds a new connection1 (corresponding to path1). At time t66, the system of electronic device 100 can report a handoverstart notification to APP1, and at time t67, the system of electronic device 100 can report a handovercomplete notification to APP1. Figure 28 The electronic device creates session 1 when it has no IP (for example, it is disconnected from the network).

[0520] It is understandable that even in the stage of no network and no IP, a session and corresponding connection can be established without having to worry about whether the network card and network are normal, and the application scenarios are more extensive.

[0521] Example 6: After a link switch or link reset occurs (i.e., after executing the above-mentioned network switching / concurrency process), some data is still in the buffer of the electronic device 100 (not successfully sent to the communication counterpart) (for example, the function write / send / sendto indicates that the sending is successful but is not actually successfully sent to the communication counterpart). In this case, the electronic device 100 can use the path after the network switch / concurrency to send the data, or the system of the electronic device 100 can report a data discard notification to the APP to avoid aggravation of packet loss.

[0522] In one embodiment, when the path before network switching / concurrency (which may be referred to as the old path) and the path after network switching / concurrency (which may be referred to as the new path) share a common key (at this time, the local end and the communication peer end can distinguish data and correctly decode), or the old path and the new path support aggregation, the electronic device 100 can use the new path to send data in the buffer to the communication peer end. For specific examples, see Figure 29 Exemplarily, the old path is the path used for data transmission before the handover complete notification is reported, and the new path is the path used for data transmission after the handover complete notification is reported.

[0523] Figure 29 This is a schematic diagram of a cache retransmission process provided in an embodiment of the present application.

[0524] like Figure 29 As shown, APP1 manages 1 session1, session1 corresponds to connection1, and connection1 corresponds to path1. From time t71 to time t73, APP1 can transmit data through connection1, for example, including sending data U1, data U2, and data U3, but data U2 and U3 are still in the buffer of electronic device 100. From time t72 to time t73 (i.e., system link establishment period T00), the system of electronic device 100 can complete the link establishment process of path2 (corresponding to connection2). For the description of system link establishment period T00, please refer to Figure 9 The description of the system link establishment period in

[15] . After time t73, the system of electronic device 100 can release path 1, and APP1 can use only path 2 for data transmission. Path 1 is the old path, and path 2 is the new path. After time t73, the system of electronic device 100 can use path 2 to send the data U2 and data U3 still in the buffer. After data U2 and U3 are sent to the communication peer, other data such as U4 can be sent.

[0525] In another embodiment, when the old path and the new path are encrypted independently and do not share a common key, or the old path and the new path cannot be aggregated, the system of the electronic device 100 can report a data discard notification to the APP, allowing the APP to adjust the data transmission strategy on its own. For specific examples, see Figure 30 Description.

[0526] Figure 30 This is a schematic diagram of a discard notification process provided in an embodiment of the present application.

[0527] Figure 30 and Figure 29 The difference is that at the end time t73 of the system link establishment period T00, the system of electronic device 100 can report a data discard notification to APP1. Therefore, after time t73, the system of electronic device 100 will not use path 2 to send data U2 and data U3 still in the buffer, but will let APP1 send other data such as U4 and U5.

[0528] The buffer of the electronic device 100 may be a buffer of a transport layer protocol stack, that is, Figure 31 The sending buffer 1 and receiving buffer 1 shown in FIG. 1 may also be buffers in a wireless communication system, that is, Figure 31 As shown in the send buffer 2 and receive buffer 2. Figure 31 In the architecture of the electronic device 100 shown, the APP and the socket can transmit the business data of the APP, the socket and the transmission protocol stack can transmit the business data of the APP, the sending buffer 1 in the transmission protocol stack can be used to store the data to be sent by the APP (to be sent to the communication counterpart), the receiving buffer 1 in the transmission protocol stack can be used to store the received data of the APP (sent from the communication counterpart to the APP), the transmission protocol stack and the wireless communication system can transmit the business data of the APP, the sending buffer 2 in the wireless communication system can be used to store the data to be sent by the APP (to be sent to the communication counterpart), and the receiving buffer 2 in the wireless communication system can be used to store the received data of the APP (sent from the communication counterpart to the APP).

[0529] It is understandable that Example 6 can be applied to any connection / session managed by an APP. Example 6 can be applied to multiple connections / sessions managed by an APP. For example, the APP can send the association relationship of multiple connections / sessions to the system of the electronic device 100, and the electronic device 100 can perform the cache retransmission process or discard notification process of the multiple connections / sessions.

[0530] The above examples illustrate the cache retransmission process or discard notification process after link switching / link reset. In other examples, the cache retransmission process or discard notification process can also be performed in other packet loss scenarios. For example, although the link has not been switched / reset, congestion still exists, resulting in packet loss, thereby avoiding worsening congestion.

[0531] The above example uses discard notification as an example. In a specific implementation, other notifications can also be used. For example, in a packet loss scenario, notification can be performed through ELN or EDN, and in a congestion scenario, notification can be performed through ECN.

[0532] Example 7: The flow managed by the APP is a connection, not a session. The system of the electronic device 100 can send a handoverstart notification and a handoverstream notification to the APP, and optionally send a pre-close notification. After receiving these notifications, the APP can switch / concurrently by itself, for example, it can create a new connection and establish a link according to the handoverstream notification, for example, it can also close the old connection according to the handoverstream notification or the pre-close notification, instead of the system implementing the switch / concurrency. The flow managed by the APP will switch / concurrently. For details, please refer to the following Figure 32-Figure 34 The above notification allows the app to be aware of network switching / concurrency in advance, so that it can re-establish the connection in time, reducing the occurrence of app service lag and app prompts of network unavailability, improving the user experience. In addition, the app does not need to call the newly added session interface to manage the session, and it is also applicable to apps that have not added the logic of calling the session interface.

[0533] In some examples, the handoverstart notification may include information about the data transmission speed (such as a value, level, or adjustment strategy) so that the APP can control the current data transmission speed (i.e., the speed of transmitting data through the old connectionio), such as lowering the data transmission speed. This allows the APP to prepare for network switching / concurrency in advance, such as preparing to establish a new network card, etc., so that the network switching / concurrency is faster and smoother.

[0534] Figure 32 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 32For example, a scenario where the new and old paths do not have a concurrent period (i.e., they cannot coexist, which can be understood as the underlying link not supporting concurrency) is described. For example, after the new path is activated, the default route is switched. This scenario includes, for example, switching between a Wi-Fi network and a cellular network by modifying the default route, or a user manually turning off the Wi-Fi network switch on a Wi-Fi network, resulting in a switch from the Wi-Fi network to the cellular network.

[0535] like Figure 32As shown, APP1 first manages connection1. Before time t81, APP1 can transmit data through connection1. At time t81, the system of electronic device 100 sends a handoverstart notification to APP1. For relevant instructions of the handoverstart notification (such as the time point of sending, the content included, etc.), please refer to the instructions of the above-mentioned handoverstart notification. For example, the handoverstart notification includes dataspeedlevel, and it is low. Therefore, after time t81, APP1 can continue to transmit data through connection1 and set the data transmission speed to the low level. When APP1 transmits data through connection1, assuming it is time t82 (t82 is greater than or equal to t81), the system of electronic device 100 can report a pre-close (PreClose) notification to APP1. The PreClose notification can instruct APP1 to close the old connection1, for example, including the reason for switching, for example, also including the life cycle of the old connection1, etc. The life cycle of the old connection1 is, for example, the difference between the current time point and the closing time point of connection1, which can be understood as how long the life cycle of connection1 is left. From time t83 (t83 is greater than or equal to t82) to time t85 after APP1 receives the PreClose notification, APP1 can close the old connection1 and release the link of path1 (corresponding to connection1). For example, the link release can be achieved at the end of the life cycle of the old connection1, or before the end of the life cycle of the old connection1. At time t84 (t84 is greater than t82), the new network card (corresponding to connection2) is established, and the system of the electronic device 100 can report a handover stream notification to APP1 so that APP1 can establish a link on the new network card. The handover stream notification can include information about the old path1 (corresponding to connection1), information about the new path2 (corresponding to connection2) after switching, and optionally, the life cycle of path1 (that is, the life cycle of connection1). From time t86 (t86 is greater than or equal to t85, and t86 is greater than t84) to time t87, APP1 can open / create a new connection2 on the new network card and re-establish a new path2 (corresponding to connection2) according to the handover stream notification.After time t87, APP1 can transmit data through connection2.

[0536] exist Figure 32 In the example, APP1 closes the old connection1 according to the PreClose notification sent by the system of the electronic device 100, and then opens / creates a new connection2 according to the handover stream notification sent by the system of the electronic device 100. Without limitation to this, in another embodiment, the system of the electronic device 100 may not send a PreClose notification, and APP1 may close the old connection1 and create a new connection2 according to the handover stream notification sent by the system of the electronic device 100. For a specific example, see the following. Figure 33 Description.

[0537] Figure 33 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application.

[0538] Figure 33 and Figure 32 Similar, the difference is that the system of electronic device 100 does not send a PreClose notification to APP1, and the time t84 when the system of electronic device 100 sends a handover stream notification to APP1 can be before the time t83 when the link release starts, or the same, that is, t84 is less than or equal to t83, that is, after APP1 receives the handover stream notification (including the life cycle of the old connection1), it can close the old connection1 and release the link of path1, for example, the link release can be achieved at the end of the life cycle of the old connection1, or before the end of the life cycle of the old connection1. Among them, the time t84 is greater than or equal to the time t81. After the link release is completed, APP1 can establish a link based on the received handover stream notification (establish a link based on the new network card established before t84), and the time t85 when the link release is completed is less than or equal to the time t86 when the link establishment starts.

[0539] Figure 34 This is a schematic diagram of another network switching / concurrency process provided in an embodiment of the present application. Figure 34 For example, the new and old paths can coexist during a period of concurrency (i.e., they can coexist, which can be understood as the underlying link supporting concurrency). This can include concurrent Wi-Fi and cellular networks, concurrent primary and secondary SIM cards, or multiple network cards coexisting and a network switch occurring without changing the default route.

[0540] like Figure 34 As shown, APP1 first manages connection1. Before time t91, APP1 can perform data transmission through connection1. At time t91, the system of the electronic device 100 sends a handoverstart notification to APP1. For relevant instructions of the handoverstart notification (such as the time point of sending, the included content, etc.), please refer to the above-mentioned instructions of the handoverstart notification. For example, the handoverstart notification includes dataspeedlevel, which is low. Therefore, after time t91, APP1 can continue to perform data transmission through connection1 and set the data transmission speed to the low level. When APP1 performs data transmission through connection1, assuming that at time t92 (t92 is greater than or equal to t91), the new network card (corresponding to connection2) is established, the system of the electronic device 100 can report a handover stream notification to APP1 so that APP1 can establish a link on the new network card. The handover stream notification can include information about the old path1 (corresponding to connection1), information about the new path2 (corresponding to connection2) after switching, and the life cycle of path1 (that is, the life cycle of connection1). From time t93 to time t94 after time t92, APP1 can open / create a new connection2 on the new network card and re-establish a new path2 (corresponding to connection2) based on the received handover stream notification. After time t94, APP1 can transmit data through connection2. At time t95 after time t93 when link establishment starts, for example, at t95 after time t94 when link establishment is completed, APP1 can close the old connection1 and release the link of path1 based on the received handover stream notification. For example, the link release can be achieved at the end of the life cycle of the old connection1, or before the end of the life cycle of the old connection1. The new network card (corresponding to connection2) can be established before the link is established (i.e., established before time t93), for example, established before APP1 receives the handover stream notification (i.e., established before time t92), or the new network card can also be established during the link establishment process.

[0541] Figure 34For example, path 1 may release the link. In other examples, path 1 may not release the link. That is, APP 1 may use both the old path 1 and the new path 2 for concurrent transmission (eg, traffic diversion or replication).

[0542] In one embodiment, after the electronic device 100 receives the handover stream notification, it can perform a network switching process or a network concurrency process. For example, when the life cycle of connection1 in the handover stream notification / PreClose notification is longer, the network concurrency process is performed, and when it is shorter, the network switching process is performed. When the new path and the old path can coexist (for example Figure 34 The situation shown) can only be carried out in the network concurrent process, and when coexistence is not possible (for example Figure 32 Even if the life cycle is long, the network switching process will be performed. For example, the network concurrent process is Figure 34 In the process shown, assuming that the time t94 when the link is established is less than the time t95 when the link is released, APP1 can concurrently use connection1 and connection2 for data transmission (such as splitting or copying) from time t94 to t95. Figure 33 or Figure 32 In the process shown, assuming that the time t86 when the link establishment starts is greater than or equal to the time t85 when the link release is completed, APP1 will not manage and use connection1 and connection2 at the same time.

[0543] Figure 32-Figure 33 Take the example of the system of the electronic device 100 reporting the handover stream notification to APP1 when the new network card is established. In other examples, the system of the electronic device 100 may report the handover stream notification to APP1 after a period of time after the new network card is established. For example, in the above two cases, the new network card may be established by the system of the electronic device 100, or the new network card may be automatically restored and established (such as a self-healing scenario). In other examples, the new network card may be established by APP1 according to the handover stream notification after the system of the electronic device 100 reports the handover stream notification to APP1. For example, it may be established during the link establishment process, or it may be established before the link is established. In other examples, the new network card may not be established, such as in the scenario of same-path switching.

[0544] Understandably, Figure 32-Figure 34APP1 closes the old connection1 and creates a new connection2. In another embodiment, the system of the electronic device 100 may close the old connection1 and release the link of path1, for example Figure 32 In the process shown, the system of the electronic device 100 does not send a PreClose notification to APP1. Figure 33 and Figure 34 In the process shown, if APP1 does not release the link before the lifecycle of the old connection1 ends, the system of the electronic device 100 can release the link and close the old connection1 when the lifecycle of the old connection1 ends.

[0545] The above is explained using the handover stream notification as an example of instructing APP to create a new connection2 and, optionally, close the old connection1. In a specific implementation, the handover stream notification may also include action information. The action information may be used to instruct APP1 to perform related operations of the network switching / concurrency process. The related operation may be at least one operation performed by the system of the electronic device 100 in the embodiment of the present application. For example, when in the same-path switching scenario (see the scenario description of Example 3 for a specific example), the action information may be used to instruct APP1 to perform at least one of the following: changing the communication IP of the local end, switching the version of the communication IP of the local end, changing the communication port of the local end, changing the IP of the communication peer end, changing the port of the communication peer end, triggering system self-healing, etc. APP1 may perform corresponding operations according to the action information in the handover stream notification, and then establish a link.

[0546] It can be understood that embodiment seven can be applied to cross-path switching / concurrency scenarios, that is, the old path1 and the new path2 can be different network links, and embodiment seven can also be applied to same-path switching / concurrency scenarios, that is, the old path1 and the new path2 can be the same network link (IP can be the same or different).

[0547] Figure 35 This is a schematic diagram of another network switching method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0548] S801: When a first application of a first device manages a first session (including a first connection), the system of the first device sends a first message to the first application.

[0549] S802: When a first application of a first device manages a first session (including a first connection), a system of the first device establishes a second connection of the first session.

[0550] S803: When the second connection is established, the system of the first device sends a second message to the first application.

[0551] S804: The first application performs data transmission through the first connection and the second connection, or performs data transmission through the second connection.

[0552] Figure 35 The first device shown may be the electronic device 100 described in the above embodiment, the first session is the session described in the above embodiment, the connection included in the first session is the connection described in the above embodiment, the first message is the handoverstart notification described in the above embodiment, and the second message is the handovercomplete described in the above embodiment.

[0553] Figure 35 The first session shown is used for a first application to communicate with a second device via a first device, where the second device is, for example, the server 200 or the electronic device 300 described in the above embodiment.

[0554] Figure 35 For a specific implementation example, please refer to the above embodiment 1 ( Figures 9-11 ), wherein the first session is session1, the first connection is connection1, the second connection is connection2, S801-S802 is the system link establishment period T00, and S804 is the APP autonomous period T01 and / or the system dominant period T02.

[0555] In one embodiment, S801 and S802 may be executed when the system of the first device detects that the network link of the first session needs to be switched, or the first session needs to implement concurrent transmission. The execution order of S801 and S802 is not limited.

[0556] In one embodiment, before S804, the first device determines whether the second device meets the preset concurrency condition. The description of the concurrency condition can be found in Figure 9Description of the concurrency conditions in . When the first device determines that the second device meets the concurrency conditions, it can close the first connection. At this time, S804 can be used to transmit data through the second connection. This scenario can be understood as a network switching scenario. When the first device determines that the second device does not meet the concurrency conditions, it can maintain the first connection. At this time, S804 can be used to transmit data through the first connection and the second connection. This scenario can be understood as a network concurrency scenario. For example, the above-mentioned first device determines whether the second device meets the preset concurrency conditions and S804 is the system dominant period T02 in Example 1.

[0557] In one embodiment, within the first time period after the first application receives the second message (i.e., within the first time period after S803 and before S804), the first application chooses to use the first connection and / or the second connection for data transmission; when the time period after the first application receives the second message exceeds the first time period, the first device determines whether the second device meets the preset concurrency condition, thereby determining whether to close the first connection. In S804, when the first connection is closed, the first application transmits data through the second connection, and when the first connection is not closed, the first application transmits data through the first connection and the second connection. For example, the process executed within the above-mentioned first time period is the APP autonomous period T01 in Example 1, and the process executed when the above-mentioned time period exceeds the first time period (the first device determines whether the second device meets the preset concurrency condition and S804) is the system-dominated period T02 in Example 1.

[0558] In one embodiment, within a first time period after the first application receives the second message (i.e., within a first time period after S803 and before S804), the first application performs a first action, such as login authentication, sending a link change notification to the second device, or sending an I frame request to the second device. Specific examples of the first action can be found in Figure 9 Description of the first action in .

[0559] In one embodiment, when the first data is stored in the buffer of the first device (i.e., data that the first application failed to successfully send to the second device through the first connection before the second connection is established), the system of the first device determines whether the first connection and the second connection support aggregation (optionally and a shared key). When the first connection and the second connection support aggregation (optionally and a shared key), after the second connection is established (i.e., after S802), the system of the first device sends the first data to the second device through the second connection; when the first connection and the second connection do not support aggregation (optionally and do not share a key), the system of the first device sends a third message to the first application, and the third message indicates that the data is lost. For a specific example, please refer to the description of the above-mentioned embodiment 6, where the third message is a discard notification.

[0560] In one embodiment, the first application manages the first session by calling the network service system of the first device, and the connection included in the first session is a transmission protocol or socket encapsulated by the network service system; or, the first application manages the first session by calling the transmission protocol or socket group of the first device, and the connection included in the first session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the first session by calling the socket of the first device, and the connection included in the first session is a socket. For specific examples, please refer to Figure 8 Description.

[0561] In one embodiment, the first connection before S803 may have been established and is used to transmit data between the first application and the second device, such as the description of the first embodiment. Alternatively, the first connection before S803 is in the process of being established, such as Figure 25-27 Alternatively, the first connection before S803 is not established, for example Figure 28 Description.

[0562] In one embodiment, after S801 (such as when S802 starts or after S802 starts), the first connection undergoes a first change process, wherein the first change process includes: the network link of the first connection is restored after being disconnected at the bottom layer (the IP address of the first connection remains unchanged before and after the first change process), for example, the preset event 1 shown in Example 2 occurs. Alternatively, the first change process includes: the network link of the first connection is established by the first device after being disconnected (the IP address of the first connection changes before and after the first change process), for example, the preset event 2 shown in Example 3 occurs. For a specific implementation example, please refer to the description of Example 4 above, wherein the first change process is a same-path switching process, and S802 is a concurrent link establishment process.

[0563] In one embodiment, the network link corresponding to the first connection and the network link corresponding to the second connection are the same or different. Figure 35 The process shown is same-path switching / concurrency or cross-path switching / concurrency.

[0564] Figure 36 This is a schematic diagram of another network switching method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0565] S901: When a first application of a first device manages a third connection, the system of the first device sends a fourth message to the first application.

[0566] S902: The first application establishes a fourth connection before the lifecycle of the third connection ends.

[0567] S903: The first application performs data transmission through the third connection and the fourth connection, or performs data transmission through the fourth connection.

[0568] The fourth message includes the life cycle of the third connection.

[0569] Figure 36 The first device shown may be the electronic device 100 described in the above embodiment, and the connection (third connection / fourth connection) managed by the first application is the connection described in the above embodiment (which may be a socket or a transmission protocol).

[0570] Figure 36 The third connection and the fourth connection shown are used for the first application to communicate with the second device through the first device, where the second device is, for example, the server 200 or the electronic device 300 described in the above embodiment.

[0571] Figure 36 For a specific implementation example, please refer to the above embodiment 7 ( Figures 9-11 ), wherein the third connection is connection1, the fourth connection is connection2, and the fourth message is a handoverstream notification.

[0572] Figure 36 S902 may also be replaced by establishing a fourth connection at the end of or after the lifecycle of the third connection. For details, please refer to the description of the seventh embodiment above.

[0573] In one embodiment, before S901, when the first application manages the third connection, if the first device detects that the network link of the third connection needs to be switched, or that the third connection needs to implement concurrent transmission, the system of the first device sends a fifth message to the first application. The fifth message may include information about the data transmission speed, and the first application may control the data transmission speed of the third connection based on the fifth message. The fifth message is the handoverstart notification described in the above embodiment. For a detailed description, please refer to the description of the handoverstart notification in the above embodiment 7.

[0574] In a possible implementation, after S901, the first application closes the third connection before the end of the life cycle of the third connection according to the fourth message. For details, see Figure 33 and Figure 34 Instructions for closing the old connection1 based on the switch stream notification.

[0575] In a possible implementation, when the life cycle of the third connection in the fourth message is greater than a preset length, the first application performs data transmission through the third connection and the fourth connection, thereby achieving network concurrency. For a specific example, see Figure 34 When the life cycle of the third connection in the fourth message is less than or equal to the preset length, the first application performs data transmission through the fourth connection, and network switching is achieved at this time. For specific examples, see Figure 32 and Figure 33 Description.

[0576] In a possible implementation, S901 may be implemented when the first network card is established, and the first network card corresponds to the fourth connection. Figure 32-Figure 34 In the time when the new network card is established (such as Figure 32 At t84), the system of the electronic device 100 may report a handover stream notification to APP1 so that APP1 can establish a link on the new network card.

[0577] In a possible implementation, the fourth message further includes behavior information, and the first application may perform corresponding operations according to the behavior information. For details, refer to the description of the action information included in the handover stream notification in the seventh embodiment above.

[0578] In one embodiment, the network link corresponding to the third connection and the network link corresponding to the fourth connection are the same or different. Figure 36 The process shown is same-path switching / concurrency or cross-path switching / concurrency.

[0579] Figure 37 This is a schematic diagram of another network switching method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0580] S1001: When a first application of a first device manages a second session (including a fifth connection), the first application transmits data through the fifth connection.

[0581] S1002: When detecting that a first event is about to begin, the system of the first device sends a sixth message to the first application.

[0582] S1003: When detecting that the first event ends, the system of the first device sends a seventh message to the first application.

[0583] S1004: The first application transmits data via the fifth connection.

[0584] Figure 37The first device shown may be the electronic device 100 described in the above embodiment, the second session is the session described in the above embodiment, the connection included in the second session is the connection described in the above embodiment, the sixth message is the handoverstart notification described in the above embodiment, and the seventh message is the handovercomplete described in the above embodiment.

[0585] Figure 37 The second session shown is used for the first application to communicate with the second device through the first device, where the second device is, for example, the server 200 or the electronic device 300 described in the above embodiment.

[0586] Figure 37 For a specific implementation example, please refer to the description of the above-mentioned embodiment 2, wherein the second session is session1, the fifth connection is connection1, S1002-S1003 are the underlying link drop / no link period T05 and the underlying link establishment period T06, S1004 is the transmission period T07, and the first event is the preset event 1.

[0587] In one embodiment, the first application manages the second session by calling the network service system of the first device, and the connection included in the second session is a transmission protocol or socket encapsulated by the network service system; or, the first application manages the second session by calling the transmission protocol or socket group of the first device, and the connection included in the second session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the second session by calling the socket of the first device, and the connection included in the second session is a socket. For specific examples, please refer to Figure 8 Description.

[0588] In one embodiment, the sixth message indicates that the same network link in the second session is suspended, for example, including reason: suspend, same path. The seventh message indicates that the same network link in the second session is resumed, for example, including reason: resume, same path.

[0589] In one embodiment, before or at the start of the first event, the system of the first device establishes a sixth connection for the second session. The network link corresponding to the sixth connection is different from the network link corresponding to the fifth connection, and the sixth connection is used for data transmission by the first application. For a specific implementation example, see the description of Example 4 above, where the first event is a same-path handover process, and the establishment of the sixth connection for the second session by the system of the first device is a concurrent link establishment process.

[0590] In one embodiment, S1002 is executed before the first event starts. After receiving the sixth message, for example, before the first event starts, the first application caches the application data and outputs the cached application data after the first event starts. Figure 14 In the figure, t31 is the time when the first event starts. Before t31, the system of the electronic device 100 can report a handoverstart notification to APP1, and APP1 can cache data. After t31 and before t33, APP1 can use the cached data for business.

[0591] Figure 38 This is a schematic diagram of another network switching method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0592] S1101: When a first application of a first device manages a third session (including a seventh connection corresponding to a first communication address), the first application transmits data through the seventh connection.

[0593] S1102: When detecting that the second event is about to start, the system of the first device sends an eighth message to the first application.

[0594] S1103: The system of the first device closes the seventh connection.

[0595] S1104: The system of the first device uses the second communication address to establish an eighth connection of the third session.

[0596] S1105: When the eighth connection is established, the system of the first device sends a ninth message to the first application.

[0597] S1106: The first application transmits data through the eighth connection.

[0598] Figure 38 The first device shown can be the electronic device 100 described in the above embodiment, the third session is the session described in the above embodiment, the connection included in the third session is the connection described in the above embodiment, the eighth message is the handoverstart notification described in the above embodiment, and the ninth message is the handovercomplete described in the above embodiment.

[0599] Figure 38 The third session shown is used for the first application to communicate with the second device through the first device, where the second device is, for example, the server 200 or the electronic device 300 described in the above embodiment.

[0600] Figure 38For a specific implementation example, please refer to the description of the above-mentioned embodiment three, wherein the third session is session1, the seventh connection is connection1, the eighth connection is connection2, S1102-S1103 is the system recovery period T08, S1104-S1105 is the system link establishment period T09, S1106 is the transmission period T010, and the second event is the preset event 2.

[0601] In one embodiment, the second event includes the communication address of the third session being restored to the second communication address, and S1104 may be executed when it is detected that the communication address of the third session is restored to the second communication address. Figure 16 and Figure 17 As shown, when the system IP is restored (such as Figure 16 At t43), a new connection2 is established and the link is rebuilt on the new path2.

[0602] In one embodiment, the second event does not include restoring the communication address of the third session. Before S1104, the system of the first device may determine to perform at least one of the following: changing the communication address of the first device, changing the version of the communication address of the first device, changing the communication port of the first device, changing the communication address of the second device, changing the communication port of the second device, or triggering the system self-healing of the first device. The self-healing of the first device is any one of the following: turning on and off the flight mode of the first device, turning on and off the network switch of the first device, or resetting the communication chip of the first device. For specific instructions, please refer to the description of the system IP may not be automatically restored in Example 3, for example Figure 18 Description.

[0603] In one embodiment, the eighth message indicates that the same network link in the third session is suspended, for example, including reason: suspend, same path. The ninth message indicates that the same network link in the third session is resumed, and the ninth message indicates that the third session is re-entered or the communication address is changed, for example, including reason: resume, same path, reEnter, or ipchange.

[0604] In one embodiment, before S1106, the first application executes a first action, such as login authentication, sending a link change notification to the second device, or sending an I frame request to the second device. Figure 9 Description of the first action in .

[0605] In one embodiment, when the buffer of the first device stores the second data (i.e., data that the first application failed to successfully send to the second device through the seventh connection before the start of the second event), the system of the first device determines whether the seventh connection and the eighth connection support aggregation (optionally and a shared key). When the seventh connection and the eighth connection support aggregation (optionally and a shared key), after the eighth connection is established (i.e., after S1104), the system of the first device sends the second data to the second device through the eighth connection; when the seventh connection and the eighth connection do not support aggregation (optionally and do not share a key), the system of the first device sends a tenth message to the first application, and the tenth message indicates that the data is lost. For a specific example, please refer to the description of the above-mentioned embodiment 6, where the tenth message is a discard notification.

[0606] In one embodiment, the first application manages the third session by calling the network service system of the first device through the first application, and the connection included in the third session is a transmission protocol or socket encapsulated by the network service system; or, the first application manages the third session by calling the transmission protocol or socket group of the first device through the first application, and the connection included in the third session is a socket encapsulated by the transmission protocol or socket group; or, the first application manages the third session by calling the socket of the first device through the first application, and the connection included in the third session is a socket. For specific examples, please refer to Figure 8 Description.

[0607] In one embodiment, before or at the start of the second event, the system of the first device establishes a ninth connection for the third session. The network link corresponding to the ninth connection is different from the network link corresponding to the seventh connection, and the network link corresponding to the ninth connection is also different from the network link corresponding to the eighth connection. The ninth connection is used for data transmission by the first application. For a specific implementation example, see the description of Example 4 above, in which the second event is a same-path handover process, and the establishment of the ninth connection for the third session by the system of the first device is a concurrent link establishment process.

[0608] In one embodiment, S1102 is executed before the second event starts. After receiving the eighth message, for example, before the second event starts, the first application caches the application data and outputs the cached application data after the second event starts. Figure 16 In the figure, t41 is the time when the second event starts. Before t41, the system of the electronic device 100 can report a handoverstart notification to APP1, and APP1 can cache data. After t41 and before t44, APP1 can use the cached data for business.

[0609] In one embodiment, when it is detected that the second event is about to begin, the system of the first device may further send an eleventh message to the first module of the first device, the first module being configured to control the display status of the network indicator in the signal bar of the first device, the network indicator being, for example, a cellular network indicator and a corresponding data service arrow, or a Wi-Fi network indicator and a corresponding data service arrow. After receiving the eleventh message, the first module controls the network indicator in the signal bar of the first device to be displayed in a normal state (e.g., indicating that the network status is normal), or the first module controls the time interval at which the network indicator in the signal bar changes to increase. When the eighth connection is established, the system of the first device sends a twelfth message to the first module. The first module is the display module described in the above embodiment, such as the telephony module, the eleventh message is a handover start notification, and the twelfth message is a handover complete notification. For a detailed description of the above process, please refer to the description of the system of the electronic device 100 (e.g., a network service system or other module, etc.) and the module for managing the display of the signal bar of the electronic device 100 (which may be referred to as the display module).

[0610] It can be understood that before executing the network switching method provided in the embodiment of the present application, in the network switching scenario / network concurrency scenario, the APP of the electronic device 100 can manage the socket, and the system of the electronic device 100 will send some network notifications to the APP: network change (such as RAT change, network search, network disconnection) notification, signal strength notification, network card status (such as up / available, down / unavailable) notification, etc., for example Figure 1A Network card change notification / link status change notification shown, Figure 1B The cross-network notification shown, Figure 1C The network card is turned off and on, Figure 1DThe notification of successful network access shown is implemented, for example, by monitoring the broadcast through the function ConnectivityManagerregisterNetworkCallback / ConnectivityManager.CONNECTIVITY_ACTION on Android. After receiving the network notification, the APP will determine whether to rebuild the link. After executing the network switching method provided in the embodiment of the present application, in the network switching scenario / network concurrency scenario, the APP of the electronic device 100 (or other caller, here taking the APP as an example) can manage the session / connection, and the system of the electronic device 100 will send a switching start notification and a switching completion notification to the APP, or send a new link notification. In this case, the system of the electronic device 100 can continue to send the above-mentioned network notification to the APP, or it can not continue to send the above-mentioned network notification to the APP, or it can smooth the process of sending the above-mentioned network notification to the APP (for example, increase the time interval for sending network notifications, delay the time for sending network notifications, not send some network notifications, etc. The specific example is similar to the example of the telephony module controlling the smooth display of the cellular network indicator in the signal bar, and will not be repeated here). The above-mentioned situation of not continuing to send or smoothly sending can be implemented during the switching process or within a specific period of time, or it can also be implemented outside of this (which can be understood as not sending or sending smoothly at all times). In the case of not continuing to send or sending smoothly, the APP does not need to pay attention to the specific status of various communication methods. The APP developer also does not need to pay attention to related processes such as determining whether to rebuild the link when the status of various communication methods changes. The APP only needs to pay attention to notifications such as switching start notification, switching completion notification or new link notification. Therefore, there will be no prompts for network abnormalities, and the implementation is also simpler.

[0611] The above examples are explained by taking the case where the concurrency is determined based on whether the communication peer satisfies the concurrency conditions (concurrency cannot be performed if the concurrency conditions are not met). In other examples, if the communication peer has a peer layer for data diversion / copying with the electronic device 100, concurrency can be performed even if the communication peer does not meet the concurrency conditions. Among them, the communication peer has a peer layer for data diversion / copying with the electronic device 100, for example, the architecture of the electronic device 100 and the communication peer are both Figure 6-Figure 8 In the architecture shown, for example, the electronic device 100 and the communication counterpart both maintain sessions through encapsulated session interfaces, and the encapsulated session interfaces are deployed at the same level and the encapsulated contents are consistent, such as the session interfaces at both ends are deployed in a network service system, and the network service system encapsulates socket services.

[0612] The above example uses the APP (caller) to perceive the network switching / concurrency process through handover start and handover complete as an example. In specific implementations, the APP can also perceive it in other ways. For example, the above session perception also includes: perception of connection availability and connection unavailability, flow interruption perception, timeout perception, send / retry perception, etc.

[0613] The above embodiments are described by taking the starting time point of the switching / concurrent process as the time point for sending the handoverstart notification and the ending time point as the time point for sending the handovercomplete notification. In other embodiments, the handoverstart notification may be sent before the starting time point of the switching / concurrent process. The handoverstart notification may include the difference between the current time point and the starting time point of the switching / concurrent process (for example, 30 seconds). It can be understood that the system of the electronic device 100 sends a handoverstart notification to the caller (taking APP as an example) in advance, and informs the APP through the handoverstart notification how long it will take to start the switching / concurrent process, further advancing the time for APP to perceive it, so that the APP has enough time to prepare. In one embodiment, in the case where a handoverstart notification is sent in advance, after receiving the handoverstart notification, the APP may reply with a response message (which may be referred to as a handover response message, for example, implemented by the APP by calling a system interface (such as a handover response)). The handover response may carry a parameter indicating whether the handover / concurrency process is approved. Optionally, when the APP wishes to postpone the handover / concurrency process, the handover response may further carry a parameter indicating a suggestion to postpone the handover / concurrency process. Optionally, when the APP wishes to postpone the handover / concurrency process, the handover response may further carry a parameter indicating the starting time point of the handover / concurrency process recommended by the APP (which may be referred to as the suggested time point). The parameter may be the suggested time point or the difference between the current time point and the suggested time point. Optionally, when the APP disagrees with or wishes to postpone the handover / concurrency process, the handover response may further carry a parameter indicating the corresponding reason, for example, the reason being that the APP is currently in the process of transmitting critical data (which may also include a description of the specific service, such as the user is currently performing real-time operations on a game). The system of electronic device 100 can choose, based on the handover response message replied by APP, to: continue to start the switching / concurrent process according to the previous starting time point, postpone the starting time point of the switching / concurrent process, or cancel the switching / concurrent process.

[0614] The above embodiments are described by taking the example of the system of the electronic device 100 (such as the network management system and the network service system) independently determining the starting time point of the switching / concurrency process. For example, in the first embodiment, it is determined based on the QoE evaluation result, in the second embodiment, it is determined based on the start time of the detected preset event 1, and in the third embodiment, it is determined based on the start time of the detected preset event 2. In other embodiments, the caller (using the APP as an example) may actively send to the system of the electronic device 100: the specific moment or time range of the starting time point of the switching / concurrency process (also referred to as the recommended time point) recommended by the APP. For example, the APP may comprehensively consider the QoE, the current operation time reserved for the user, whether the user is performing a key operation, etc. to determine the recommended time point. The system of the electronic device 100 may set the starting time point of the switching / concurrency process to the recommended time point of the specific moment sent by the APP, or the system of the electronic device 100 may determine the starting time point of the switching / concurrency process based on the time range of the recommended time point sent by the APP. It can be understood that the system of the above-mentioned electronic device 100 interacts with the APP to determine the starting time point of the switching / concurrency process, which can effectively solve the following problems: the switching of the APP in certain business scenarios will affect the user experience (for example, the switching causes the user to miss the key time window of the current business, such as the calling scene of chess and card games, the fierce battle scene of fighting games, the scene that requires user operation, etc.), the switching of the APP in certain business scenarios will cause business failure (for example, switching in a scenario where the data transmission time itself is short will cause the data transmission failure, such as the payment scenario), and the switching occurs when the communication peer does not meet the concurrency conditions (such as not supporting the two-way aggregation capability), resulting in APP business abnormalities, etc.

[0615] It can be understood that for each session / each APP, the system of the electronic device 100 can determine the occurrence time of the corresponding switching / concurrent process based on actual conditions, such as QoE, business requirements of the APP, whether a switching event occurs (such as the preset events 1 and 2 mentioned above), the handoverresponse message sent by the APP, the recommended time point actively sent by the APP, etc. It can be understood that different processing of the switching / concurrent processes of different sessions and different processing of the switching / concurrent processes of different APPs can be achieved.

[0616] In the above embodiment, the system of the electronic device 100 can send a "one" notification to APP1 (such as sending a handoverstart notification and sending a handovercomplete notification, etc.) to implement the network switching / concurrency of the current flow (session or connection) of APP1. However, in other embodiments, the above "one" notification can also implement the network switching / concurrency of all flows managed by APP1, which can be understood as implementing the network switching / concurrency of the entire APP1. For example, Figure 10 In the example, after APP1 receives the handoverstart notification, it can bind a new connection and establish a link on each managed flow.

[0617] The above embodiments are described using the handoverstart notification and / or handovercomplete notification to implement the network switching / concurrency process as an example. In other embodiments, a data transmission speed adjustment process can also be implemented. For example, when the adjustment process starts, the system of the electronic device 100 can send a handoverstart notification to APP1. At this time, the handoverstart notification can include information about the data transmission speed, such as a number, level, or adjustment strategy, so that APP1 can control the data transmission speed accordingly. When the adjustment process ends, the system of the electronic device 100 can send a handovercomplete notification to APP1 (for example, it can include information about the data transmission speed), and APP1 can restore the data transmission speed before the adjustment process started. In other embodiments, a data caching process can also be implemented. For example, when the data caching process starts, the system of the electronic device 100 can send a handoverstart notification to APP1, and APP1 can cache data. When the data caching process ends, the system of the electronic device 100 can send a handovercomplete notification to APP1, and APP1 can no longer cache data. In other embodiments, a service avoidance process can also be implemented. For details, please refer to the description of the above embodiment 5 and will not be repeated here.

[0618] The above embodiments are described using the example of the handoverstart notification / handovercomplete notification including information on the data transmission speed. In other examples, the data transmission speed information may also be sent through other messages, such as additionally sending a data control message, which includes information on the data transmission speed. The timing of sending the data control message may be consistent with or inconsistent with the timing of sending the handoverstart notification / handovercomplete notification.

[0619] The following illustrates some interfaces designed in the embodiments of the present application.

[0620] First, the service type setting interface can include the following two types:

[0621] Single stream: When only one type of business data needs to be transmitted, a single stream interface can be used. The single stream interface can implement session / connection binding business type. For example, this interface is called to bind the business type when creating a session / connection.

[0622] Mixed flow: When data of multiple business types needs to be transmitted, the mixed flow interface can be used. The mixed flow interface can bind the business type with the data. For example, when sending or receiving data of any business type, the interface is called to bind the bu...

Claims

1. A network switching method, characterized in that: Applied to a first device, the method includes: When a first application of the first device manages a first session, and the first session includes a first connection, sending a first message to the first application and establishing a second connection of the first session; the first session is used for the first application to communicate with a second device through the first device; When the second connection is established, sending a second message to the first application; After receiving the second message, the first application performs data transmission through the first connection and the second connection, or performs data transmission through the second connection.

2. The method according to claim 1, wherein The sending the first message to the first application and establishing the second connection of the first session includes: If it is detected that the network link of the first session needs to be switched or the first session needs to implement concurrent transmission, the first message is sent to the first application and the second connection of the first session is established.

3. The method according to claim 1 or 2, wherein: After the first application receives the second message, the method further includes: transmitting data through the first connection and the second connection, or before transmitting data through the second connection. Determining whether the second device meets a preset concurrency condition, wherein the concurrency condition includes at least one of the following: supporting two-way communication address access, supporting fast re-entry of the communication address, supporting data splitting, supporting data replication, supporting data aggregation, supporting a shared key for two connections, supporting the Multi-channel Transport Control Protocol (MPTCP), supporting the Multi-channel User Datagram Protocol (MPUDP), supporting the Stream Control Transmission Protocol (SCTP), and supporting the Hypertext Transfer Protocol (HTTP) request header range; When the second device does not meet the concurrency condition, closing the first connection; After receiving the second message, the first application performs data transmission through the first connection and the second connection, or performs data transmission through the second connection, including: When the first connection is closed, the first application receives the second message and performs data transmission through the second connection; When the first connection is not closed, after receiving the second message, the first application transmits data through the first connection and the second connection.

4. The method according to any one of claims 1 to 3, wherein After receiving the second message, the first application performs data transmission through the first connection and the second connection, or performs data transmission through the second connection, including: Within a first time period after the first application receives the second message, the first application chooses to use the first connection and / or the second connection for data transmission; When the time period after the first application receives the second message exceeds the first time period, if the first connection is closed, the first application transmits data through the second connection, or if the first connection is not closed, the first application transmits data through the first connection and the second connection.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Within a first period of time after the first application receives the second message, the first application performs at least one of the following: login authentication, sending a link change notification to the second device, or sending an I frame request to the second device.

6. The method according to any one of claims 1 to 5, wherein: The method further comprises: When first data is stored in the buffer of the first device, determining whether the first connection and the second connection support aggregation; the first data is data that the first application fails to send to the second device through the first connection before the second connection is established; When the first connection and the second connection support aggregation, after the second connection is established, sending the first data to the second device through the second connection; When the first connection and the second connection do not support aggregation, a third message is sent to the first application, where the third message indicates data loss.

7. The method according to any one of claims 1 to 6, wherein: The first application manages the first session by invoking a network service system of the first device through the first application, and the connection included in the first session is a transmission protocol or socket encapsulated by the network service system; or The first application manages the first session by invoking a transmission protocol or a socket group of the first device by the first application, and the connection included in the first session is a socket encapsulated by the transmission protocol or the socket group; or, The first application manages the first session by calling a socket of the first device, and the connection included in the first session is a socket.

8. The method according to any one of claims 1 to 7, wherein: Before sending the second message to the first application, the first connection has been established and is used to transmit data of the first application; or, Before sending the second message to the first application, the first connection is in the process of being established.

9. The method according to any one of claims 1 to 8, wherein After sending the first message to the first application, the first connection undergoes a first change process, wherein the first change process includes: the network link of the first connection is restored after being disconnected at the bottom layer, or the first change process includes: after the network link of the first connection is disconnected, the first device re-establishes the network link of the first connection.

10. The method according to any one of claims 1 to 9, wherein The network link corresponding to the first connection and the network link corresponding to the second connection are the same or different.

11. The method according to any one of claims 1 to 10, wherein: The first message is a handover start message, and the second message is a handover completion message.

12. A network switching method, characterized in that: Applied to a first device, the method includes: When a first application of the first device manages a first connection, sending a first message to the first application, the first message including a lifecycle of the first connection; the first connection is used for the first application to communicate with a second device through the first device; The first application establishes a second connection according to the first message before the lifecycle of the first connection ends; the second connection is used for the first application to communicate with the second device through the first device; After the second connection is established, the first application performs data transmission through the first connection and the second connection, or performs data transmission through the second connection.

13. The method according to claim 12, wherein: Before sending the first message to the first application, the method further includes: When the first application manages the first connection, if it is detected that the network link of the first connection needs to be switched or the first application needs to implement concurrent transmission, sending a second message to the first application; The first application controls the data transmission speed of the first connection according to the second message.

14. The method according to claim 12 or 13, wherein: The method further comprises: The first application closes the first connection before the lifecycle of the first connection ends according to the first message.

15. The method according to any one of claims 12 to 14, wherein: After the second connection is established, the first application transmits data through the first connection and the second connection, or transmits data through the second connection, including: When the lifecycle of the first connection in the first message is greater than a preset length, the first application performs data transmission through the first connection and the second connection; When the lifecycle of the first connection in the first message is less than or equal to the preset length, the first application performs data transmission through the second connection.

16. The method according to any one of claims 12 to 15, wherein: The sending the first message to the first application comprises: When the first network card is established, the first message is sent to the first application, and the first network card corresponds to the second connection.

17. The method according to any one of claims 12 to 16, wherein: The first message further includes behavior information, and the method further includes: Before the first application establishes the second connection, it performs at least one of the following according to the behavior information: changing the communication address of the first device, changing the version of the communication address of the first device, changing the communication port of the first device, changing the communication address of the second device, changing the communication port of the second device, or triggering system self-healing of the first device, where the self-healing of the first device is any one of the following: turning on and off the airplane mode of the first device, turning on and off the network switch of the first device, or resetting the communication chip of the first device.

18. The method according to any one of claims 12 to 17, wherein: The first connection and the second connection are sockets or transport protocols.

19. The method according to any one of claims 12 to 18, wherein: The network link corresponding to the first connection and the network link corresponding to the second connection are the same or different.

20. An electronic device, characterized in that: The method comprises a transceiver, a processor and a memory, wherein the memory is used to store a computer program, and the processor calls the computer program to execute the method according to any one of claims 1 to 19.

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

22. A computer program product, characterized in that When the computer program product is run on an electronic device, it is used to execute the method according to any one of claims 1 to 19.