CN108834203B - Network switching method, device, terminal and storage medium - Google Patents

Network switching method, device, terminal and storage medium Download PDF

Info

Publication number
CN108834203B
CN108834203B CN201810698050.XA CN201810698050A CN108834203B CN 108834203 B CN108834203 B CN 108834203B CN 201810698050 A CN201810698050 A CN 201810698050A CN 108834203 B CN108834203 B CN 108834203B
Authority
CN
China
Prior art keywords
network
network connection
data
application program
timer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810698050.XA
Other languages
Chinese (zh)
Other versions
CN108834203A (en
Inventor
朱志伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN201810698050.XA priority Critical patent/CN108834203B/en
Publication of CN108834203A publication Critical patent/CN108834203A/en
Application granted granted Critical
Publication of CN108834203B publication Critical patent/CN108834203B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/18Selecting a network or a communication service
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/0005Control or signalling for completing the hand-off
    • H04W36/0011Control or signalling for completing the hand-off for data sessions of end-to-end connection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/30Connection release

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the application discloses a network switching method, a device, a terminal and a storage medium, belonging to the field of network connection, wherein the method comprises the following steps: transmitting network data over a first network connection; when a network switching request is received, establishing a second network connection within the time length of a timer, wherein the network switching request is used for indicating that a first network is switched to a second network, and the network connection modes of the first network connection and the second network connection are different; if the second network connection is established in the time length of the timer, the second network connection is switched to be used for transmitting the network data; the first network connection is disconnected. In the embodiment of the application, a buffer period is set before the network connection is disconnected, and the new network connection is tried to be established in the buffer period, so that the network terminal caused by the current network disconnection is avoided, the influence of the network switching process on the network data transmission is reduced, and the effect of switching the network without awareness is achieved.

Description

Network switching method, device, terminal and storage medium
Technical Field
The present disclosure relates to the field of network connection, and in particular, to a network switching method, an apparatus, a terminal, and a storage medium.
Background
Wireless Fidelity (WiFi) network connection and mobile data network connection are two common network connection methods used in a terminal.
When the environment does not have a WiFi network, the terminal can access through a mobile data network; when the mobile data network enters the coverage of the WiFi network and the terminal starts the WiFi connection function, the terminal disconnects the mobile data network connection and then performs network access by establishing the WiFI network connection, so that the mobile data network and the WiFi network are switched.
Disclosure of Invention
The embodiment of the application provides a network switching method, a network switching device, a terminal and a storage medium, which can be used for solving the problem that network connection is interrupted in the process of disconnecting the current network connection and reestablishing the network connection with other networks. The technical scheme is as follows:
in one aspect, a network handover method is provided, where the method includes:
transmitting network data over a first network connection;
when a network switching request is received, establishing a second network connection within the time length of a timer, wherein the network switching request is used for indicating switching from a first network to a second network, and the network connection modes of the first network connection and the second network connection are different;
if the second network connection is established in the timer duration, switching to use the second network connection to transmit the network data;
disconnecting the first network connection.
In another aspect, a network switching apparatus is provided, the apparatus including:
the transmission module is used for transmitting network data through first network connection;
the system comprises an establishing module, a judging module and a judging module, wherein the establishing module is used for establishing a second network connection within the time length of a timer when receiving a network switching request, the network switching request is used for indicating switching from a first network to a second network, and the network connection modes of the first network connection and the second network connection are different;
the switching module is used for switching to use the second network connection to transmit the network data if the second network connection is established in the timer duration;
a disconnection module for disconnecting the first network connection.
In another aspect, a terminal is provided, where the terminal includes a processor and a memory, where the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the network handover method according to the above aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, the instruction being loaded and executed by a processor to implement the network switching method according to the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
when receiving a network switching request in the process of transmitting network data by using a first network connection, the terminal tries to establish a second network connection within the time length of the timer, and switches to use the second network connection to transmit the network data after establishing the second network connection within the time length of the timer, so as to disconnect the first network connection; compared with the prior art that the current network connection is immediately disconnected and then a new network connection is established, in the embodiment of the application, a buffer period is set before the network connection is disconnected, and the new network connection is tried to be established in the buffer period, so that the network terminal caused by the fact that the current network is immediately disconnected is avoided, the influence of the network switching process on network data transmission is reduced, and the effect of switching the network without awareness is achieved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 illustrates an environmental schematic of an implementation environment provided by an exemplary embodiment of the present application;
fig. 2 is a flowchart illustrating a network handover method according to an exemplary embodiment of the present application;
fig. 3 is a schematic diagram illustrating a network handover method according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a network handover method according to another exemplary embodiment of the present application;
fig. 5 is a flowchart illustrating a network handover method according to another exemplary embodiment of the present application;
fig. 6 is a block diagram illustrating a network switching apparatus according to an exemplary embodiment of the present application;
fig. 7 shows a block diagram of a terminal according to an exemplary embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
In the description of the present application, "plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Referring to fig. 1, an environment diagram of an implementation environment provided by an exemplary embodiment of the present application is shown, where the implementation environment includes a terminal 110 and a server 120.
The terminal 110 is an electronic device having a WiFi network connection and a mobile data network connection function. The mobile data network may be a third Generation mobile communication technology (3rd-Generation, 3G) network, a fourth Generation mobile communication technology (4th-Generation, 4G) network, a Long Term Evolution (LTE) network, a fifth Generation mobile communication technology (5th-Generation, 5G) network, or the like.
When the terminal 110 starts the WiFi network connection function, the terminal 110 may search for a nearby WiFi network and perform internet access by accessing the WiFi network; when the mobile data network connection function is turned on, the terminal 110 can perform internet access through the mobile data network. The WiFi network connection function and the mobile data network connection function can be started simultaneously.
In addition, at least one application is installed in the terminal 110, and the at least one application requires internet access, and the application may be an instant messaging application, an email application, a social application, a video playing application, a browser application, a game application, a news reading application, and the like.
The terminal 110 is connected to the server 120 through a WiFi network or a mobile data network.
The server 120 is a server, a server cluster formed by a plurality of servers, or a cloud computing center. In the embodiment of the present application, the server 120 is a background server of the application program in the terminal 110. During the running process of the application program, the local network data is sent to the server 110, and the network data sent by the server 110 is received. The terminal 110 may perform network data transmission with multiple servers 120 (corresponding to different applications running in foreground or background in the terminal 110) at the same time.
In one possible application scenario, the terminal 110 establishes a mobile data network connection and transmits network data of the application program through the mobile data network connection. When the mobile terminal moves to the coverage of the WiFi network and the WiFi network is available, the user triggers a network handover request, and after receiving the network handover request, the terminal 110 tries to establish a WiFi network connection on the premise of maintaining the mobile data network connection for a predetermined time. When the WiFi network connection is established within the preset time, the terminal uses the WiFi network connection for transmitting network data during switching, and the first network connection is disconnected, so that network switching is realized.
Optionally, the implementation environment may further include a target server, and the terminal 110 accesses the target server through the established network connection, so as to obtain the quality of the network connection, and further determine whether network handover is required.
The following embodiments are described by taking an example in which the network handover method is applied to the terminal 110 in fig. 1.
Referring to fig. 2, a flowchart of a network handover method according to an exemplary embodiment of the present application is shown. The present embodiment is illustrated by applying the method to the terminal 110 in fig. 1. The method comprises the following steps:
step 201, network data is transmitted over a first network connection.
The first network connection is a mobile data network connection or a WiFi network connection.
In a possible application scenario, when the terminal is out of the coverage of the WiFi network, or the terminal is in the coverage of the WiFi network but the WiFi network is not available, or the terminal does not turn on the WiFi network connection function, the terminal transmits network data through the mobile data network connection.
In another possible application scenario, when the terminal is within the coverage of the WiFi network, the WiFi network is available, and the WiFi network connection function is turned on, the terminal transmits network data through the WiFi network connection.
Optionally, the network data includes data transmitted by foreground applications, background applications, and/or system services.
Step 202, when a network switching request is received, a second network connection is established within the time length of the timer, the network switching request is used for indicating that the first network is switched to the second network, and the network connection modes of the first network connection and the second network connection are different.
In one possible implementation, after receiving the network handover request, the terminal starts a Timer (Timer) and attempts to establish the second network connection within a Timer duration specified by the Timer. If the second network connection is established within the time length of the timer, execute step 203; if the second network connection is not established within the time length of the timer, the first network connection is disconnected, and the second network connection is reestablished, so that the first network connection is prevented from being occupied for too long time (especially when the first network connection is a mobile data network connection).
Optionally, the network connection mode is one of a WiFi network connection and a mobile data network connection, that is, when the first network connection is the mobile data network connection, the second network connection is the WiFi network connection; when the first network connection is a WiFi network connection, the second network connection is a mobile data network connection.
Optionally, the network handover request is triggered manually by a user, or automatically by the terminal.
When the network handover request is manually triggered by the user, in one possible embodiment, the WiFi network connection function is in an off state while the terminal transmits network data through the mobile data network connection. When the user manually starts the WiFi network connection function and the WiFi network exists, the terminal receives the network switching request and requests to switch to the WiFi network.
When the network handover request is automatically triggered by the terminal, in one possible embodiment, the WiFi network connection function is in an on state when the terminal transmits network data through the mobile data network, and when there is no WiFi network (or no WiFi network available). When the terminal moves to a place where the WiFi network is available, the terminal automatically triggers a network switching request to switch to the WiFi network.
In other possible embodiments, when the terminal transmits network data through the WiFi network connection, the user may trigger the network handover request by manually turning off the WiFi network connection function (in this case, the terminal needs to maintain the WiFi connection within the duration of the timer).
The terminal still transmits network data through the first network connection in the process of trying to establish the second network connection within the time length of the timer, so that transmission interruption in the network switching process is avoided; meanwhile, the timer is arranged, so that the flow consumption caused by continuously using the first network connection to transmit the network data when the second network connection cannot be established for a long time is avoided.
Optionally, the duration of the timer may be a fixed value, or may be dynamically determined according to the current foreground application. For example, the timer may have a duration of 3 s.
As shown in fig. 3, the terminal transmits network data through the first network connection from time 0, and when a network handover request is received at time t, the terminal starts a timer, continues to transmit network data through the first network connection, and attempts to establish a second network connection.
Step 203, if the second network connection is established within the time length of the timer, the second network connection is switched to be used for transmitting the network data.
And when the second network connection is successfully established within the time length of the timer and the second network connection can be accessed, the terminal switches the network data to the second network connection for transmission.
As shown in fig. 3, when the terminal establishes the second network connection at time t '(t' -t ≦ timer duration), the terminal performs network data transmission through the second network connection.
Step 204, disconnecting the first network connection.
Accordingly, when the second network connection is successfully established, the terminal disconnects the first network connection.
As shown in fig. 3, when the terminal establishes the second network connection at time t '(t' -t ≦ timer duration), the terminal disconnects the second network connection.
In one possible application scenario, a user uses a terminal to play an online game in a mobile data network connection state, and when the user moves to a place (such as a home) where a WiFi network is available and the terminal turns on a WiFi network connection function, the terminal attempts to establish a WiFi network connection within 3s while maintaining the mobile network connection. And if the WiFi network connection is successfully established within 3s, the terminal switches to use the WiFi network to transmit network data and disconnects the mobile data network. In the whole network switching process, network data transmission is not interrupted, the smoothness of game operation is ensured, and the phenomenon of disconnection or blockage is avoided.
To sum up, in the embodiment of the present application, when a network switching request is received during a process of transmitting network data by using a first network connection, a terminal tries to establish a second network connection within a timer duration, and after establishing the second network connection within the timer duration, switches to use the second network connection to transmit the network data, thereby disconnecting the first network connection; compared with the prior art that the current network connection is immediately disconnected and then a new network connection is established, in the embodiment of the application, a buffer period is set before the network connection is disconnected, and the new network connection is tried to be established in the buffer period, so that the network terminal caused by the fact that the current network is immediately disconnected is avoided, the influence of the network switching process on network data transmission is reduced, and the effect of switching the network without awareness is achieved.
In the actual application process, when the application program operated by the foreground is a video playing application program, a browser application program or a news reading application program, because a preloading mechanism exists in the operation process of the application program and the requirement on the network real-time property is low, even if the network switching process is interrupted, the user is not easy to perceive, and the use of the user is not influenced. When the application program running on the foreground is an instant messaging application program or a game application program, because the frequency of network data transmission of the application program is high and the requirement on the real-time performance of the network is high, the interruption in the network switching process is easily detected by a user (usually, the disconnection or the blockage occurs), and the use of the user is influenced. Thus, in one possible embodiment, the terminal enables the network-unaware switching function only when the foreground runs a specific application. The following description will be made by using exemplary embodiments.
Step 401, network data is transmitted over a first network connection.
The step 201 may be referred to in the implementation manner of this step, and this embodiment is not described herein again.
Step 402, when a network switching request is received, detecting whether an application program running in a foreground is a target application program, wherein the target application program comprises at least one of a game application program and an instant messaging application program.
In one possible implementation mode, the terminal acquires a target application program (installed in the terminal) needing to enable the non-inductive network switching function in advance, and stores a target application package name of the target application program. The target application is an application with a network real-time requirement (delay, packet loss rate, etc.) higher than a threshold, for example, the target application is a game application and/or an instant messaging application.
When receiving a network switching request, the terminal acquires an application package name (packageaname) of a foreground application program, detects whether the application package name belongs to a target application package name, determines that the foreground application program belongs to the target application program if the application package name belongs to the target application package name, and executes step 403; otherwise, determining that the foreground application does not belong to the target application.
The foreground application program refers to an application program which is switched from a background to a foreground for running, or an application program which is directly started in the foreground.
Step 403, if the application program operated in the foreground is the target application program, acquiring a network requirement level corresponding to the target application program, where the network requirement level is in a positive correlation with the network real-time requirement.
Because the terminal has the possibility of failure when establishing the second network connection, in order to ensure that the problem of network interruption does not occur to the application program with higher network real-time requirement in the network switching process as much as possible, the terminal configures longer timer duration, that is, configures longer buffer period for the application program with higher real-time requirement.
In a possible implementation manner, the terminal sets a network requirement level for each target application program in advance according to the network real-time requirement of each target application program, wherein the higher the network real-time requirement of the target application program is, the higher the corresponding network requirement level is.
Illustratively, the correspondence between the application and the network demand level is shown in table one.
Watch 1
Figure BDA0001714103970000071
Figure BDA0001714103970000081
And when the application program operated by the foreground is the target application program, the terminal further acquires the network requirement level corresponding to the target application program.
For example, when the terminal determines that the application package name of the foreground application is the target application "xx fight", the terminal further determines that the network demand level corresponding to "xx fight" is 3-level.
And step 404, determining the time length of the timer according to the network demand level, wherein the network demand level and the time length of the timer have positive correlation.
Further, the terminal determines the time length of the timer corresponding to the acquired network demand level according to the acquired network demand level, wherein the higher the network demand level is, the longer the corresponding time length of the timer is, that is, the longer the time for the terminal to attempt to establish the second network connection is.
Illustratively, the correspondence between the network demand level and the timer duration is shown in table two.
Watch two
Network demand level Duration of timer
1 3s
2 4s
3 5s
4 6s
With reference to the example in step 403, the terminal determines that the timer duration is 5 s.
It should be noted that, the above steps 403 and 404 are optional steps, that is, the duration of the timer may be a fixed value, and after the terminal determines that the application running in the foreground is the target application, the terminal directly attempts to establish the second network connection within the duration of the timer. The embodiment of the present application does not limit this.
Step 405, establish the second network connection for the duration of the timer.
And the terminal tries to establish the second network connection within the determined time length of the timer.
Step 406, if the second network connection is established within the time length of the timer, the second network connection is switched to be used for transmitting the network data.
Because the target application program has a high real-time requirement on the network, if the network quality of the second network is poor, the operation quality of the target application program is affected after the network data is switched to the second network for connection, and especially, under the condition that the terminal automatically performs network switching (for example, the terminal which starts the WiFi network connection function automatically switches to the WiFi network after entering the WiFi network coverage area), the user experience is greatly affected.
In order to avoid the above problem, in one possible embodiment, the present step includes the following steps.
If a second network connection is established in the time length of the timer, performing network connection quality test on the second network connection and the first network connection to obtain a test result, wherein the test result comprises at least one of delay and packet loss rate.
In one possible implementation, the terminal periodically accesses the target server through the first network connection while transmitting the network data through the first network connection, so as to obtain a first test result including delay and packet loss rate. Wherein a lower delay and/or a lower packet loss rate indicates a better quality of the network connection.
For example, the terminal periodically pings a target domain name (corresponding to the target server) through the first network connection, so as to calculate the delay and packet loss rate of the first network connection according to the response result of the target server. The embodiment of the present application does not limit the manner of measuring the delay and the packet loss rate.
Correspondingly, after the terminal establishes the second network connection, the network connection quality is measured in a manner similar to the first network connection, so that a second test result is obtained.
And secondly, if the test result indicates that the quality of the second network connection is better than that of the first network connection, switching to use the second network connection to transmit the network data.
In a possible implementation, when the test result indicates that the delay of the second network connection is lower than the delay of the first network connection, and/or indicates that the packet loss rate of the second network connection is lower than the packet loss rate of the first network connection, the terminal determines that the quality of the second network connection is better than the quality of the first network connection, so as to switch to use the second network connection for transmitting the network data.
Optionally, if the test result indicates that the quality of the first network connection is better than the quality of the second network connection, and when the network connection request is automatically triggered by the terminal (network switching is performed manually by a non-user), the terminal continues to transmit network data through the first network connection and continues to monitor the quality of the second network connection. And when the quality of the second network connection is better than that of the first network connection or the target application program finishes the life cycle, the terminal switches to use the second network connection to transmit the network data.
Step 407, disconnect the first network connection.
Step 204 may be referred to in the implementation manner of this step, and this embodiment is not described herein again.
Step 408, if the second network connection is not established within the time length of the timer, the first network connection is disconnected, and the second network connection is reestablished.
Optionally, if the second network connection is not established within the duration of the timer and the network switching request is triggered by the user, the terminal disconnects the first network connection and reestablishes the second network connection.
Optionally, if reestablishing the second network connection fails, or the established second network connection is unavailable, the terminal displays a prompt message to prompt the user that no WiFi network is available currently.
In the above embodiment, the network data transmitted by the target application may include User Datagram Protocol (UDP) data and/or Transmission Control Protocol (TCP) data. The UDP data generally includes data with high requirements for transmission delay, such as control commands in a game, and the TCP data generally includes data with high requirements for transmission reliability, such as login information in a game. Since the transmission of TCP data depends on the TCP connection established between the terminal and the server, re-establishing the TCP connection may cause the connection to be disconnected.
Therefore, in order to further reduce the influence of network handover on the application program, when the application program operated by the foreground is the target application program, and the network handover request is actively triggered by the terminal (when the network handover is not manually performed by the user, it indicates that the intention of network handover is not strong), and the network data transmitted by the target application program contains TCP data and UDP data, when the target application program is in the foreground operation state, the second network connection is switched to transmit UDP data, and the first network connection is continuously used to transmit TCP data. And when the target application program finishes the life cycle or is switched to the background operation, the terminal switches to use the second network connection to transmit the TCP data and disconnects the first network connection.
In a possible implementation manner, the terminal needs to identify the network data of the target application according to a Unique Identifier (UID) of the target application, and identify whether the network data of the target application contains TCP data, where a protocol number of the UDP data is 17, and a protocol number of the TCP data is 6.
When the network data of the target application program is identified to contain TCP data and UDP data, the terminal keeps the first network connection, and switches to use the second network connection to transmit the UDP data and uses the first network connection to transmit the TCP data when the target application program is in a foreground operation state. And when the target application program finishes the life cycle or is switched to the background operation, the terminal switches to use the second network connection to transmit the TCP data and disconnects the first network connection.
In this embodiment, the terminal establishes the network connection dual-path only when the foreground application is a target application with a high requirement on network real-time, so as to implement the non-inductive network switching and avoid resource waste caused by establishing the network connection dual-path for a low network real-time requirement.
In this embodiment, the terminal determines the duration of the timer configured for the target application according to the network requirement level corresponding to the target application, so that the application requiring network real-time performance has a longer network switching buffer period, thereby avoiding data interruption of the application in the network switching process and improving the operation quality of the application.
In addition, in this embodiment, the terminal performs a network quality test on the first network connection and the established second network connection, and switches the second network connection for data transmission when the quality of the second network connection is the quality of the first network connection, thereby avoiding a problem of poor running quality of an application program after switching networks.
In one possible scenario, the terminal fails to establish the second network connection for the timer duration, but the target application transfers a large amount of network data for the timer duration (e.g., when the target application is a gaming application, a large amount of network data needs to be transferred when a group of things is in play). In this case, if the first network connection is directly disconnected, a network interruption will be caused, which affects the normal operation of the target application.
In order to ensure the normal operation of the target application under the above-mentioned conditions, on the basis of fig. 4, as shown in fig. 5, the following steps may be further included after step 405.
Step 409, acquiring a target data volume transmitted through the first network connection within the time length of the timer, wherein the target data volume is the data volume of the network data corresponding to the target application program.
And in the process of trying to establish the second network connection, the terminal counts the data volume of the network data corresponding to the target application program transmitted through the first network connection.
In a possible implementation manner, the terminal identifies the network data of the target application program according to the UID of the target application program, and further counts the data volume of the network data.
For example, the terminal acquires a target data volume of 200 KB.
Step 410, if the second network connection is not established within the timer duration and the target data volume is greater than the data volume threshold, the timer duration is extended.
When the second network connection is not established within the time length of the timer, the terminal further detects whether the target data volume is larger than the data volume threshold value, if so, the target application program is determined to be in a data transmission active state, and in order to avoid the influence of the network switching process on the normal operation of the target application program, the terminal prolongs the time length of the timer (continuously transmits network data through the first network connection and tries to establish the second network connection); if the data transmission rate is less than the preset value, the target application program is in a data transmission inactive state, and the data transmission short-time terminal cannot cause great influence on the program application, so that the terminal directly disconnects the first network connection and reestablishes the second network connection. For example, the threshold data amount may be 150 KB.
Optionally, the data amount thresholds corresponding to different target application programs are different, and this is not limited in this embodiment of the application.
Optionally, the time length of the timer may be extended by a fixed value, for example, by 5s, or by twice; the extension amount of the timer period may also be dynamically determined according to a ratio of the target data amount to the data amount threshold, for example, the extension amount is (target data amount/data amount threshold) × constant. The embodiment of the present application does not limit the specific manner of extending the time length of the timer.
Optionally, if the second network connection is not established within the extended duration of the timer, the terminal disconnects the first network connection and reestablishes the second network connection.
In this embodiment, when the amount of data transmitted by the target application program in the timer duration is large and the second network connection is not established in the timer duration, the terminal extends the timer duration and continues to try to establish the second network connection, thereby avoiding the influence on the operation of the target application program caused by directly disconnecting the first network connection.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 6, a block diagram of a network switching device according to an exemplary embodiment of the present application is shown. The device includes:
a transmission module 610 for transmitting network data through a first network connection;
an establishing module 620, configured to establish a second network connection within a time duration of a timer when a network handover request is received, where the network handover request is used to indicate that a first network is handed over to a second network, and a network connection manner of the first network connection is different from a network connection manner of the second network connection;
a switching module 630, configured to switch to transmit the network data using the second network connection if the second network connection is established within the duration of the timer;
a disconnecting module 640 configured to disconnect the first network connection.
Optionally, the establishing module 620 includes:
the detection unit is used for detecting whether an application program operated in a foreground is a target application program when the network switching request is received, wherein the target application program comprises at least one of a game application program and an instant messaging application program;
and the establishing unit is used for establishing the second network connection within the time length of the timer if the application program operated in the foreground is the target application program.
Optionally, the establishing module 620 further includes:
the acquisition unit is used for acquiring a network demand level corresponding to the target application program, and the network demand level is in positive correlation with the network real-time demand;
the determining unit is used for determining the time length of the timer according to the network demand level, and the network demand level and the time length of the timer are in positive correlation.
Optionally, the apparatus further comprises:
a data volume obtaining module, configured to obtain a target data volume transmitted through the first network connection within the time duration of the timer, where the target data volume is a data volume of network data corresponding to the target application program;
and the prolonging module is used for prolonging the time length of the timer if the second network connection is not established in the time length of the timer and the target data volume is greater than a data volume threshold value.
Optionally, the network connection mode is one of a mobile data network connection and a WiFi network connection.
Optionally, the switching module 630 includes:
the test module is used for carrying out network connection quality test on the second network connection and the first network connection to obtain a test result if the second network connection is established in the timer duration, wherein the test result comprises at least one of delay and packet loss rate;
and the switching unit is used for switching to use the second network connection to transmit the network data if the test result indicates that the quality of the second network connection is better than that of the first network connection.
Optionally, the apparatus further comprises:
and the disconnection reestablishment module is used for disconnecting the first network connection and reestablishing the second network connection if the second network connection is not established within the time length of the timer.
To sum up, in the embodiment of the present application, when a network switching request is received during a process of transmitting network data by using a first network connection, a terminal tries to establish a second network connection within a timer duration, and after establishing the second network connection within the timer duration, switches to use the second network connection to transmit the network data, thereby disconnecting the first network connection; compared with the prior art that the current network connection is immediately disconnected and then a new network connection is established, in the embodiment of the application, a buffer period is set before the network connection is disconnected, and the new network connection is tried to be established in the buffer period, so that the network terminal caused by the fact that the current network is immediately disconnected is avoided, the influence of the network switching process on network data transmission is reduced, and the effect of switching the network without awareness is achieved.
It should be noted that, when the device provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the terminal may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Referring to fig. 7, a block diagram of a terminal according to an exemplary embodiment of the present application is shown. The terminal includes a processor 1010, a memory 1020, and a display 1030.
Processor 1010 may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP. The processor 1010 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
The memory 1020 is connected to the processor 1010 through a bus or other means, and at least one instruction, at least one program, a set of codes, or a set of instructions is stored in the memory 1020, and is loaded and executed by the processor 1010 to implement the user interface display method according to the above embodiments. The memory 1020 may be a volatile memory (or a nonvolatile memory), a non-volatile memory (or a combination thereof). The volatile memory may be a random-access memory (RAM), such as a static random-access memory (SRAM) or a dynamic random-access memory (DRAM). The nonvolatile memory may be a Read Only Memory (ROM), such as a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), and an Electrically Erasable Programmable Read Only Memory (EEPROM). The non-volatile memory may also be a flash memory, a magnetic memory, such as a magnetic tape, a floppy disk, or a hard disk. The non-volatile memory may also be an optical disc.
The display screen 1030 is coupled to the processor 1010 via a bus or other means. The memory 1020 stores at least one instruction that is loaded and executed by the processor 1010 to implement the network switching method as described in the various embodiments above.
The embodiment of the present application further provides a computer-readable medium, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the network handover method according to the above embodiments.
The embodiment of the present application further provides a computer program product, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the network handover method according to the above embodiments.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (9)

1. A method for network handover, the method comprising:
transmitting network data through a first network connection, wherein the network data comprises TCP data and UDP data;
when a network switching request is received, if an application program operated in a foreground is a target application program, establishing a second network connection within the time length of a timer, wherein the network switching request is used for indicating switching from a first network to a second network, the network connection modes of the first network connection and the second network connection are different, and the target application program is an application program with the network real-time requirement higher than a threshold value;
if the second network connection is established in the time length of the timer, switching to use the second network connection to transmit the UDP data and use the first network connection to transmit the TCP data when the target application program is in a foreground running state;
and if the target application program finishes the life cycle or is switched to the background operation, the TCP data is switched and transmitted by using the second network connection, and the first network connection is disconnected.
2. The method of claim 1, wherein before establishing the second network connection for the timer duration, the method further comprises:
acquiring a network demand grade corresponding to the target application program, wherein the network demand grade and the network real-time demand are in positive correlation;
and determining the timer duration according to the network demand level, wherein the network demand level and the timer duration are in positive correlation.
3. The method of claim 1, wherein if the foreground-running application is the target application, after the second network connection is established within the timer duration, the method further comprises:
acquiring a target data volume transmitted through the first network connection within the time length of the timer, wherein the target data volume is the data volume of network data corresponding to the target application program;
and if the second network connection is not established in the timer duration and the target data volume is greater than the data volume threshold, prolonging the timer duration.
4. The method of any of claims 1 to 3, wherein the network connection is one of a mobile data network connection and a wireless fidelity (WiFi) network connection.
5. The method according to any one of claims 1 to 3, wherein if the second network connection is established within the timer duration, switching to use the second network connection to transmit the UDP data and to use the first network connection to transmit the TCP data when the target application is in a foreground operation state comprises:
if the second network connection is established in the timer duration, performing network connection quality test on the second network connection and the first network connection to obtain a test result, wherein the test result comprises at least one of delay and packet loss rate;
and if the test result indicates that the quality of the second network connection is better than that of the first network connection, switching to use the second network connection to transmit the UDP data and use the first network connection to transmit the TCP data when the target application program is in a foreground running state.
6. The method according to any of claims 1 to 3, wherein after establishing the second network connection for the duration of the timer, the method further comprises:
and if the second network connection is not established within the time length of the timer, disconnecting the first network connection and reestablishing the second network connection.
7. A network switching apparatus, the apparatus comprising:
the transmission module is used for transmitting network data through first network connection, wherein the network data comprises TCP data and UDP data;
the system comprises an establishing module, a timer and a switching module, wherein the establishing module is used for establishing a second network connection within the time length of the timer if an application program operated by a foreground is a target application program when a network switching request is received, the network switching request is used for indicating switching from a first network to a second network, the network connection modes of the first network connection and the second network connection are different, and the target application program is an application program with the network real-time requirement higher than a threshold value;
a switching module, configured to switch to transmit the UDP data using the second network connection and transmit the TCP data using the first network connection when the target application is in a foreground operating state if the second network connection is established within the timer duration;
and the disconnection module is used for switching to use the second network connection to transmit the TCP data and disconnecting the first network connection if the target application program finishes the life cycle or is switched to run in a background.
8. A terminal, characterized in that the terminal comprises a processor and a memory, the memory having stored therein at least one instruction, the instruction being loaded and executed by the processor to implement the network switching method according to any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon at least one instruction which is loaded and executed by a processor to implement the network handover method of any one of claims 1 to 6.
CN201810698050.XA 2018-06-29 2018-06-29 Network switching method, device, terminal and storage medium Active CN108834203B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810698050.XA CN108834203B (en) 2018-06-29 2018-06-29 Network switching method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810698050.XA CN108834203B (en) 2018-06-29 2018-06-29 Network switching method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN108834203A CN108834203A (en) 2018-11-16
CN108834203B true CN108834203B (en) 2021-01-26

Family

ID=64134902

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810698050.XA Active CN108834203B (en) 2018-06-29 2018-06-29 Network switching method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN108834203B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112243274B (en) * 2019-07-17 2021-10-22 大唐移动通信设备有限公司 Timing switching processing method and device based on time
CN112449388A (en) * 2019-09-04 2021-03-05 中兴通讯股份有限公司 Network connection control method, device, mobile terminal and storage medium
CN112752319A (en) * 2019-10-31 2021-05-04 中兴通讯股份有限公司 Network switching method, device, terminal and storage medium
CN111277667A (en) * 2020-02-24 2020-06-12 拉扎斯网络科技(上海)有限公司 Data caching method and device, storage medium and electronic equipment
CN111757040B (en) * 2020-06-24 2022-06-07 维沃移动通信有限公司 Communication method and device
CN112206507B (en) * 2020-10-19 2023-02-17 珠海金山数字网络科技有限公司 Protocol processing method and device
CN112312498B (en) * 2020-10-27 2023-04-28 北京小米移动软件有限公司 Method and device for switching network and storage medium
CN112333800A (en) * 2020-11-13 2021-02-05 Oppo广东移动通信有限公司 Network switching method and device, storage medium and electronic equipment
CN114726818B (en) * 2020-12-21 2024-01-23 腾讯科技(深圳)有限公司 Network social method, device, equipment and computer readable storage medium
CN114650573B (en) * 2020-12-21 2023-10-27 深圳市万普拉斯科技有限公司 Network delay processing method and device and mobile terminal
CN113014972B (en) * 2021-01-28 2024-02-27 维沃移动通信有限公司 Screen projection method, device and system
CN113890905B (en) * 2021-06-16 2022-11-22 荣耀终端有限公司 Channel switching method, electronic device and storage medium
CN114339869B (en) * 2022-02-25 2024-04-05 京东科技信息技术有限公司 Network management method, device, electronic equipment and storage medium
CN114828130B (en) * 2022-04-01 2024-05-28 Oppo广东移动通信有限公司 Network switching method of terminal equipment, terminal equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102625398A (en) * 2012-03-07 2012-08-01 北京三星通信技术研究有限公司 Method and equipment for recovering data traffics of high-level applications at time of multi-channel data connection switching
CN102905249A (en) * 2012-07-05 2013-01-30 安徽中兴继远信息技术股份有限公司 Terminal parameter setting method based on communication with wireless network
CN104159231A (en) * 2014-08-19 2014-11-19 北京奇虎科技有限公司 Method for optimizing background flow of client, and client
CN104602309A (en) * 2013-10-30 2015-05-06 中国电信股份有限公司 Wireless network switching guiding method and device
CN106851759A (en) * 2017-03-14 2017-06-13 朱钦 The cut-in method and device of network

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102752825A (en) * 2012-07-19 2012-10-24 德明通讯(上海)有限公司 Seamless switch fusion method for mobile terminal in long term evolution (LTE) network and wireless fidelity (Wi-Fi) hot spot network
US10244418B2 (en) * 2012-12-13 2019-03-26 Devicescape Software, Inc. Systems and methods for quality of experience measurement and wireless network recommendation
CN104754661A (en) * 2013-12-31 2015-07-01 中兴通讯股份有限公司 Method for achieving seamless switching between cellular network and WiFi network, network device and user equipment
ES2716728T3 (en) * 2014-04-25 2019-06-14 Intel Ip Corp User equipment and methods for start of transfer
CN104202782A (en) * 2014-09-23 2014-12-10 酷派软件技术(深圳)有限公司 Network switching method, network switching device and terminal
US9363743B2 (en) * 2014-10-10 2016-06-07 Blackberry Limited Utilizing Wi-Fi country code to assist cellular network selection
CN105828395A (en) * 2015-07-28 2016-08-03 维沃移动通信有限公司 Method and device of WiFi adaptive selection and connection
CN105828455A (en) * 2016-01-28 2016-08-03 努比亚技术有限公司 Network connection device and method
CN107371208B (en) * 2016-05-13 2022-04-29 中兴通讯股份有限公司 Switching method and device
CN106358225B (en) * 2016-09-20 2017-08-11 广东欧珀移动通信有限公司 A kind of processing method of network data, device and mobile terminal
CN107135525A (en) * 2017-06-21 2017-09-05 天津光电通信技术有限公司 A kind of method that WiFi automatically switches with cellular mo-bile data network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102625398A (en) * 2012-03-07 2012-08-01 北京三星通信技术研究有限公司 Method and equipment for recovering data traffics of high-level applications at time of multi-channel data connection switching
CN102905249A (en) * 2012-07-05 2013-01-30 安徽中兴继远信息技术股份有限公司 Terminal parameter setting method based on communication with wireless network
CN104602309A (en) * 2013-10-30 2015-05-06 中国电信股份有限公司 Wireless network switching guiding method and device
CN104159231A (en) * 2014-08-19 2014-11-19 北京奇虎科技有限公司 Method for optimizing background flow of client, and client
CN106851759A (en) * 2017-03-14 2017-06-13 朱钦 The cut-in method and device of network

Also Published As

Publication number Publication date
CN108834203A (en) 2018-11-16

Similar Documents

Publication Publication Date Title
CN108834203B (en) Network switching method, device, terminal and storage medium
CN108449771B (en) Network switching method, device, terminal and storage medium
CN110300404B (en) Network control method and mobile terminal
CN106102143B (en) Application processing method and device
US9237460B2 (en) Traffic control method and device
CN110474975B (en) Heartbeat processing method and device of application program, electronic equipment and storage medium
WO2022143520A1 (en) Cell switching method and apparatus, and user equipment
EP3687132A1 (en) Network access method and device
JP6961708B2 (en) Network connection method and equipment
EP2915370B1 (en) Enhanced extended access class barring
CN112997528B (en) Network switching method and related equipment
WO2014063487A1 (en) Traffic control method and device
CN113938990B (en) Equipment management method and communication device
CN111356156B (en) Measurement control method, device, terminal equipment and computer storage medium
CN111669799A (en) Network connection method and device and electronic equipment
KR20220116425A (en) Data cache mechanism through dual SIP phones
WO2015051848A1 (en) Method, system and apparatus for user abandonment verification
CN115767649A (en) Instant messaging method, instant messaging device, electronic equipment and storage medium
CN108141901B (en) Method and terminal for controlling service connection
CN110521235A (en) A kind of signal measurement method and relevant device
CN112399515B (en) Communication processing method and device
US11943127B2 (en) Network-based control method for power consumption of applications, terminal and storage medium
CN114125942A (en) Network resource management method, device, terminal and storage medium
CN114650616B (en) Control method and device of network mode
WO2020124388A1 (en) Cell interference detection method and device, mobile terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant