CN114125023A - Data connection determining method and device, storage medium and electronic device - Google Patents

Data connection determining method and device, storage medium and electronic device Download PDF

Info

Publication number
CN114125023A
CN114125023A CN202111340525.6A CN202111340525A CN114125023A CN 114125023 A CN114125023 A CN 114125023A CN 202111340525 A CN202111340525 A CN 202111340525A CN 114125023 A CN114125023 A CN 114125023A
Authority
CN
China
Prior art keywords
cloud server
data
data connection
connection
data packet
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.)
Granted
Application number
CN202111340525.6A
Other languages
Chinese (zh)
Other versions
CN114125023B (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.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202111340525.6A priority Critical patent/CN114125023B/en
Publication of CN114125023A publication Critical patent/CN114125023A/en
Application granted granted Critical
Publication of CN114125023B publication Critical patent/CN114125023B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/148Migration or transfer of sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/14Reselecting a network or an air interface
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/10Small scale networks; Flat hierarchical networks
    • H04W84/12WLAN [Wireless Local Area Networks]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention discloses a method and a device for determining data connection, a storage medium and an electronic device, wherein the method comprises the following steps: determining a first data connection for data transmission with a cloud server at a first time when a target operation is detected on a target application, wherein the target operation comprises at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal; sending a first data packet to the cloud server through the first data connection; the method comprises the steps of determining that a first data connection is available under the condition that a second data packet is received through the first data connection within preset time, and carrying out data transmission with a cloud server through the first data connection at a second time, wherein the second data packet is a data packet sent by the cloud server after the first data packet is received, and the first time is earlier than the second time.

Description

Data connection determining method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for determining data connection, a storage medium, and an electronic apparatus.
Background
When people use mobile terminals such as mobile phones, most of the applications are used simultaneously, that is, the applications are often switched among different applications, and if the applications have long connections with the server, in the prior art, the applications do not know whether the long connections established with the server before are available after returning to the foreground from the background, so the applications need to reconnect the server and establish new connections with the server.
Further, as society develops, more and more networks are available for mobile terminals, i.e., mobile terminals may frequently switch between different networks. If the application has a long connection with the server, in the prior art, the application does not know whether the long connection established with the server before is available after switching the network, so the application also needs to reconnect the server to establish a new connection with the server.
However, if the application returns to the foreground again after going from the foreground to the background of the mobile terminal, or the network switching is triggered due to the network jitter, the long connection established between the application and the server is likely to be available, so if the application re-establishes a new connection with the server each time the application switches from the network to the background or returns to the foreground from the background, the resource waste of the server is caused, and the experience of the user is affected.
Aiming at the problem of server resource waste caused by the fact that a new long connection is required to be established with a server after the application is switched to a network or switched from a background to a foreground of a mobile terminal every time in the related art, an effective solution is not provided at present.
Accordingly, there is a need for improvement in the related art to overcome the disadvantages of the related art.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining data connection, a storage medium and an electronic device, which are used for at least solving the problem that a new long connection needs to be established with a server after the application is switched to a network or switched from a mobile terminal background to a foreground every time, so that the resource waste of the server is caused.
According to an aspect of the embodiments of the present invention, there is provided a method for determining a data connection, including: determining a first data connection for data transmission with a cloud server at a first time when a target operation is detected on a target application, wherein the target operation comprises at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal; sending a first data packet to the cloud server through the first data connection; the method comprises the steps of determining that a first data connection is available under the condition that a second data packet is received through the first data connection within preset time, and carrying out data transmission with a cloud server through the first data connection at a second time, wherein the second data packet is a data packet sent by the cloud server after the first data packet is received, and the first time is earlier than the second time.
Further, sending a first data packet to the cloud server through the first data connection includes: acquiring the target number of first data packets set by a target object; and sending the first data packets of the target number to the cloud server through the first data connection.
Further, sending a first data packet to the cloud server through the first data connection includes: determining a target communication protocol for sending a first data packet to the cloud server; and sending a first data packet to the cloud server by using the target communication protocol on the first data connection.
Further, after sending a preset number of first data packets to the cloud server through the first data connection, the method further includes: under the condition that a second data packet is not received through the first data connection within preset time, disconnecting the first data connection established with the cloud server; and sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server.
Further, sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server, including: sending a connection request to a cloud server through a hypertext transfer protocol, wherein the connection request has verification information; acquiring data connection information sent by the cloud server, wherein the data connection information is information sent by the cloud server under the condition that the verification information is verified to be passed; the data connection information includes: a port number; and establishing a second data connection for data transmission with the cloud server, wherein the second data connection is used for data transmission with the cloud server at the second time.
Further, acquiring data connection information sent by the cloud server includes: acquiring encrypted data connection information sent by the cloud server; and decrypting the encrypted data connection information to obtain the data connection information.
Further, before determining a first data connection for data transmission with a cloud server at a first time, the method further comprises: detecting a target operation by one of: monitoring the network state of the mobile terminal, and determining that a target operation is detected under the condition that the network state of the mobile terminal is switched from a first mobile network to a second mobile network, or the mobile terminal is switched from a mobile network to a wireless fidelity (WIFI) network, or the mobile terminal is switched from the WIFI network to the mobile network, wherein the mobile network comprises: the first mobile network, the second mobile network; and determining that the target operation is detected under the condition that the target application is monitored to be switched from the background of the mobile terminal to the foreground of the mobile terminal.
According to another aspect of the embodiments of the present invention, there is also provided a device for determining data connection, including: a first determining module, configured to determine, when a target operation is detected on a target application, a first data connection for data transmission with a cloud server at a first time, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal; the sending module is used for sending a first data packet to the cloud server through the first data connection; the second determining module is used for determining that the first data connection is available under the condition that a second data packet is received through the first data connection within preset time, and performing data transmission with the cloud server through the first data connection at second time, wherein the second data packet is a data packet sent by the cloud server after the first data packet is received, and the first time is earlier than the second time.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for determining a data connection when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for determining the data connection through the computer program.
According to the method and the device, after a target application detects that a network is switched or a mobile terminal is switched from a background to a foreground, a first data packet is sent to a cloud server through a first data connection established with the cloud server at a first time; and determining that the first data connection is available under the condition that a second data packet responded by the cloud server is received through the first data connection within the preset time, and performing data transmission with the cloud server through the first data connection at the second time. By adopting the technical scheme, the problem of server resource waste caused by the fact that a new long connection is required to be established with the server after the application is switched to a network or switched to a foreground from a mobile terminal background every time is solved. And further, under the condition that the long connection established with the server is available, data transmission is carried out with the server through the original long connection, a new long connection is not established, and resources of the server are saved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a computer terminal of a data connection determination method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of determining a data connection according to an embodiment of the invention;
FIG. 3 is a schematic diagram of long and short connections according to an embodiment of the present invention;
FIG. 4 is a timing diagram of a method of determining a data connection according to an embodiment of the invention;
FIG. 5 is a block diagram (one) of the structure of a data connection determining apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram (ii) of the configuration of the data connection determination apparatus according to the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method embodiments provided in the embodiments of the present application may be executed in a computer terminal or a similar computing device. Taking the example of the method running on a computer terminal, fig. 1 is a hardware structure block diagram of the computer terminal of the method for determining data connection according to the embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more processors 102 (only one is shown in fig. 1), wherein the processors 102 may include, but are not limited to, a Microprocessor (MPU) or a Programmable Logic Device (PLD), and a memory 104 for storing data, and in an exemplary embodiment, the computer terminal may further include a transmission device 106 for communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration with equivalent functionality to that shown in FIG. 1 or with more functionality than that shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the data connection determining method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In order to solve the technical problem of the present application, a method for determining a data connection is provided in this embodiment, and fig. 2 is a flowchart of a method for determining a data connection according to an embodiment of the present invention, where the flowchart includes the following steps:
step S202, determining a first data connection for data transmission with a cloud server at a first time when a target operation is detected on a target application, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
it should be noted that the first time is before the target application detects the target operation, specifically, the first time is before the target application does not switch the network, or the last time the target application is in the foreground of the mobile terminal. The first data connection is a long connection established between the target application and the cloud server at the first time.
To better understand the long connection, fig. 3 is a schematic diagram of a long and short connection according to an embodiment of the present invention, as shown in (a) of fig. 3, after the target application sends data, the target application may continue to send data using the connection without closing the connection. As shown in fig. 3 (b), the target application closes the connection after sending data once, and then reestablishes a new connection when sending data next time.
Step S204, a first data packet is sent to the cloud server through the first data connection;
it should be noted that the sending of the first data packet by the target application to the cloud server is for performing heartbeat detection, so as to determine whether the first data connection is available.
Step S206, determining that the first data connection is available when a second data packet is received through the first data connection within a preset time, and performing data transmission with the cloud server through the first data connection at a second time, where the second data packet is a data packet sent by the cloud server after receiving the first data packet, and the first time is earlier than the second time.
It should be noted that the preset time is determined after a plurality of experiments. In one exemplary embodiment, the preset time is 2 s.
In one exemplary embodiment, the above steps may be applied to a target application.
Through the steps, after a target application detects that a network is switched or a mobile terminal is switched from a background to a foreground, a first data packet is sent to a cloud server through a first data connection established with the cloud server at a first time; and determining that the first data connection is available under the condition that a second data packet responded by the cloud server is received through the first data connection within the preset time, and performing data transmission with the cloud server through the first data connection at the second time. By adopting the technical scheme, the problem of server resource waste caused by the fact that a new long connection is required to be established with the server after the application is switched to a network or switched to a foreground from a mobile terminal background every time is solved. And further, under the condition that the long connection established with the server is available, data transmission is carried out with the server through the original long connection, a new long connection is not established, and resources of the server are saved.
In an optional embodiment, sending the first data packet to the cloud server through the first data connection may be implemented by: acquiring the target number of first data packets set by a target object; and sending the first data packets of the target number to the cloud server through the first data connection.
It should be noted that, if the target application sends a first data packet to the cloud server through the first data connection and receives a second data packet sent by the cloud server within 2s, the first data connection is proved to be available. There may be situations where the first data connection is available but the second data packet sent by the cloud server is not received within 2 s. Two reasons for this phenomenon are mainly given, (1) due to network instability, a first data packet sent to a cloud server by a target application is lost in the sending process; (2) due to network delay, the target application receives the second data packet sent by the cloud server after 2 s. In order to solve the problem that the first data packets are lost in the process of sending the first data packets, a plurality of first data packets need to be sequentially sent to the cloud server through the first data connection, and as long as a second data packet sent by one cloud server is received within 2s after the data packets are sent, the first data connection is considered to be available. It should be noted that as long as the second data packet sent by the cloud server is not received within the preset time, the first data connection is disconnected regardless of whether the first data connection is available, and a new second data connection is established with the cloud server again.
Optionally, when the first data packet is sent to the cloud server through the first data connection, a target communication protocol for sending the first data packet to the cloud server needs to be determined, and then the target communication protocol is used to send the first data packet to the cloud server on the first data connection.
It should be noted that there are various communication protocols between the target application and the cloud server, including but not limited to TCP and UDP. And the target application needs to determine the target communication protocol from the communication protocols. In an exemplary embodiment, the target communication protocol is TCP, and the target application sends the first data packet to the cloud server using TCP over the first data connection.
Further, if a second data packet is not received through the first data connection within a preset time, disconnecting the first data connection established with the cloud server; and sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server.
That is to say, if the target application does not receive the second data packet sent by the cloud server within the preset time, it is considered that the first data connection is unavailable, and further, a connection request needs to be sent to the cloud server to request to establish the second data connection for data transmission with the cloud server.
In an optional embodiment, sending a connection request to the cloud server to establish a second data connection for data transmission with the cloud server may be implemented by: sending a connection request to a cloud server through a hypertext transfer protocol, wherein the connection request has verification information; acquiring data connection information sent by the cloud server, wherein the data connection information is information sent by the cloud server under the condition that the verification information is verified to be passed; the data connection information includes: a port number; and establishing a second data connection for data transmission with the cloud server, wherein the second data connection is used for data transmission with the cloud server at the second time.
That is to say, the target application can send a connection request to the cloud server through the hypertext transfer protocol, the cloud server can verify the connection request, and only when the connection request passes the verification, the data connection information is sent to the target application, and after the target application receives the data connection information, the second data connection can be established with the server according to the data connection information. It should be noted that the data connection information includes, but is not limited to, a port number.
In an optional embodiment, the target application acquires the encrypted data connection information sent by the cloud server, and then the target application needs to decrypt the encrypted data connection information to obtain the data connection information. It should be noted that the encryption algorithm may be an asymmetric encryption algorithm.
Further, the target application may detect the target operation by one of the following: monitoring the network state of the mobile terminal, and determining that a target operation is detected under the condition that the network state of the mobile terminal is switched from a first mobile network to a second mobile network, or the mobile terminal is switched from a mobile network to a wireless fidelity (WIFI) network, or the mobile terminal is switched from the WIFI network to the mobile network, wherein the mobile network comprises: the first mobile network, the second mobile network; and determining that the target operation is detected under the condition that the target application is monitored to be switched from the background of the mobile terminal to the foreground of the mobile terminal.
It is to be understood that the above-described embodiments are only a few, but not all, embodiments of the present invention. In order to better understand the method for determining the data connection, the following describes the above process with reference to an embodiment, but the method is not limited to the technical solution of the embodiment of the present invention, and specifically:
in an alternative embodiment, fig. 4 is a timing diagram of a method for determining a data connection according to an embodiment of the present invention, specifically, after an APP switches from a background of a mobile terminal to a foreground or switches to a network, on the basis of an original long connection (equivalent to a first data connection in the foregoing embodiment), a heartbeat detection (equivalent to sending a first data packet) is actively initiated to a server, and availability of a current connection is determined according to a heartbeat detection result, specifically, if the APP does not receive a response from a cloud server within a preset time, the original connection is considered to be unavailable. It should be noted that the APP may initiate multiple heartbeat probes (which is equivalent to sending a preset number of first data packets in the foregoing embodiment), and the heartbeat probes may be protocols such as TCP or UDP, and are not limited to the TCP manner in fig. 4.
In addition, according to the technical scheme of the embodiment of the invention, the long connection frequency between the target application and the cloud server can be reduced, so that the server resource is saved, and the failure caused by reconnection is reduced.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a data connection determining apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and details are not repeated for what has been described. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware or a combination of software and hardware are also possible and contemplated.
Fig. 5 is a block diagram (a) of a data connection determining apparatus according to an embodiment of the present invention, the apparatus including:
a first determining module 52, configured to determine, in a case that a target operation is detected on a target application, a first data connection for data transmission with a cloud server at a first time, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
a sending module 54, configured to send a first data packet to the cloud server through the first data connection;
a second determining module 56, configured to determine that the first data connection is available when a second data packet is received through the first data connection within a preset time, and perform data transmission with the cloud server through the first data connection at a second time, where the second data packet is a data packet sent by the cloud server after receiving the first data packet, and the first time is earlier than the second time.
Through the steps, after a target application detects that a network is switched or a mobile terminal is switched from a background to a foreground, a first data packet is sent to a cloud server through a first data connection established with the cloud server at a first time; and determining that the first data connection is available under the condition that a second data packet responded by the cloud server is received through the first data connection within the preset time, and performing data transmission with the cloud server through the first data connection at the second time. By adopting the technical scheme, the problem of server resource waste caused by the fact that a new long connection is required to be established with the server after the application is switched to a network or switched to a foreground from a mobile terminal background every time is solved. And further, under the condition that the long connection established with the server is available, data transmission is carried out with the server through the original long connection, a new long connection is not established, and resources of the server are saved.
Optionally, the sending module 54 is further configured to obtain a target number of the first data packets set by the target object; and sending the first data packets of the target number to the cloud server through the first data connection.
It should be noted that, if the target application sends a first data packet to the cloud server through the first data connection and receives a second data packet sent by the cloud server within 2s, the first data connection is proved to be available. There may be situations where the first data connection is available but the second data packet sent by the cloud server is not received within 2 s. Two reasons for this phenomenon are mainly given, (1) due to network instability, a first data packet sent to a cloud server by a target application is lost in the sending process; (2) due to network delay, the target application receives the second data packet sent by the cloud server after 2 s. In order to solve the problem that the first data packets are lost in the process of sending the first data packets, a plurality of first data packets need to be sequentially sent to the cloud server through the first data connection, and as long as a second data packet sent by one cloud server is received within 2s after the data packets are sent, the first data connection is considered to be available. It should be noted that as long as the second data packet sent by the cloud server is not received within the preset time, the first data connection is disconnected regardless of whether the first data connection is available, and a new second data connection is established with the cloud server again.
Optionally, the sending module 54 is further configured to determine a target communication protocol for sending the first data packet to the cloud server; and sending a first data packet to the cloud server by using the target communication protocol on the first data connection.
Fig. 6 is a block diagram (ii) of the structure of a data connection determining apparatus according to an embodiment of the present invention, the apparatus including: a module 58 is established.
Optionally, the establishing module 58 is further configured to disconnect the first data connection established with the cloud server when a second data packet is not received through the first data connection within a preset time; and sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server.
Optionally, the establishing module 58 is further configured to send a connection request to the cloud server through a hypertext transfer protocol, where the connection request includes verification information; acquiring data connection information sent by the cloud server, wherein the data connection information is information sent by the cloud server under the condition that the verification information is verified to be passed; the data connection information includes: a port number; and establishing a second data connection for data transmission with the cloud server, wherein the second data connection is used for data transmission with the cloud server at the second time.
Optionally, the establishing module 58 is further configured to obtain encrypted data connection information sent by the cloud server; and decrypting the encrypted data connection information to obtain the data connection information.
Optionally, the first determining module 52 is further configured to detect the target operation by one of the following methods: monitoring the network state of the mobile terminal, and determining that a target operation is detected under the condition that the network state of the mobile terminal is switched from a first mobile network to a second mobile network, or the mobile terminal is switched from a mobile network to a wireless fidelity (WIFI) network, or the mobile terminal is switched from the WIFI network to the mobile network, wherein the mobile network comprises: the first mobile network, the second mobile network; and determining that the target operation is detected under the condition that the target application is monitored to be switched from the background of the mobile terminal to the foreground of the mobile terminal.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, determining a first data connection for data transmission with the cloud server at a first time when a target operation is detected on the target application, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
s2, sending a first data packet to the cloud server through the first data connection;
s3, determining that the first data connection is available when a second data packet is received through the first data connection within a preset time, and performing data transmission with the cloud server through the first data connection at a second time, where the second data packet is a data packet sent by the cloud server after receiving the first data packet, and the first time is earlier than the second time.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, determining a first data connection for data transmission with the cloud server at a first time when a target operation is detected on the target application, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
s2, sending a first data packet to the cloud server through the first data connection;
s3, determining that the first data connection is available when a second data packet is received through the first data connection within a preset time, and performing data transmission with the cloud server through the first data connection at a second time, where the second data packet is a data packet sent by the cloud server after receiving the first data packet, and the first time is earlier than the second time.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for determining a data connection, comprising:
determining a first data connection for data transmission with a cloud server at a first time when a target operation is detected on a target application, wherein the target operation comprises at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
sending a first data packet to the cloud server through the first data connection;
the method comprises the steps of determining that a first data connection is available under the condition that a second data packet is received through the first data connection within preset time, and carrying out data transmission with a cloud server through the first data connection at a second time, wherein the second data packet is a data packet sent by the cloud server after the first data packet is received, and the first time is earlier than the second time.
2. The method of claim 1, wherein sending a first data packet to the cloud server over the first data connection comprises:
acquiring the target number of first data packets set by a target object;
and sending the first data packets of the target number to the cloud server through the first data connection.
3. The method of claim 1, wherein sending a first data packet to the cloud server over the first data connection comprises:
determining a target communication protocol for sending a first data packet to the cloud server;
and sending a first data packet to the cloud server by using the target communication protocol on the first data connection.
4. The method of claim 1, wherein after sending a predetermined number of first packets to the cloud server over the first data connection, the method further comprises:
under the condition that a second data packet is not received through the first data connection within preset time, disconnecting the first data connection established with the cloud server;
and sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server.
5. The method of claim 4, wherein sending a connection request to a cloud server to establish a second data connection for data transmission with the cloud server comprises:
sending a connection request to a cloud server through a hypertext transfer protocol, wherein the connection request has verification information;
acquiring data connection information sent by the cloud server, wherein the data connection information is information sent by the cloud server under the condition that the verification information is verified to be passed; the data connection information includes: a port number;
and establishing a second data connection for data transmission with the cloud server, wherein the second data connection is used for data transmission with the cloud server at the second time.
6. The method of claim 5, wherein obtaining the data connection information sent by the cloud server comprises:
acquiring encrypted data connection information sent by the cloud server;
and decrypting the encrypted data connection information to obtain the data connection information.
7. The method of claim 1, wherein prior to determining the first data connection for data transmission with the cloud server at the first time, the method further comprises:
detecting a target operation by one of:
monitoring the network state of the mobile terminal, and determining that a target operation is detected under the condition that the network state of the mobile terminal is switched from a first mobile network to a second mobile network, or the mobile terminal is switched from a mobile network to a wireless fidelity (WIFI) network, or the mobile terminal is switched from the WIFI network to the mobile network, wherein the mobile network comprises: the first mobile network, the second mobile network;
and determining that the target operation is detected under the condition that the target application is monitored to be switched from the background of the mobile terminal to the foreground of the mobile terminal.
8. An apparatus for determining a data connection, comprising:
a first determining module, configured to determine, when a target operation is detected on a target application, a first data connection for data transmission with a cloud server at a first time, where the target operation includes at least one of: switching network operation, namely switching from a background of a mobile terminal to a foreground of the mobile terminal;
the sending module is used for sending a first data packet to the cloud server through the first data connection;
the second determining module is used for determining that the first data connection is available under the condition that a second data packet is received through the first data connection within preset time, and performing data transmission with the cloud server through the first data connection at second time, wherein the second data packet is a data packet sent by the cloud server after the first data packet is received, and the first time is earlier than the second time.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202111340525.6A 2021-11-12 2021-11-12 Method and device for determining data connection, storage medium and electronic device Active CN114125023B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111340525.6A CN114125023B (en) 2021-11-12 2021-11-12 Method and device for determining data connection, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111340525.6A CN114125023B (en) 2021-11-12 2021-11-12 Method and device for determining data connection, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN114125023A true CN114125023A (en) 2022-03-01
CN114125023B CN114125023B (en) 2024-03-22

Family

ID=80379273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111340525.6A Active CN114125023B (en) 2021-11-12 2021-11-12 Method and device for determining data connection, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114125023B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022074A (en) * 2022-06-24 2022-09-06 中国电信股份有限公司 User authentication and authorization method, device, medium and equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015188761A1 (en) * 2014-06-12 2015-12-17 Tencent Technology (Shenzhen) Company Limited Traffic acquiring method and apparatus based on operating system
CN105893129A (en) * 2016-03-30 2016-08-24 北京小米移动软件有限公司 Processing method and device for application programs in terminal
CN106941713A (en) * 2017-05-16 2017-07-11 努比亚技术有限公司 It is a kind of to reduce the method and its device of mobile terminal power consumption
CN107635261A (en) * 2017-09-18 2018-01-26 维沃移动通信有限公司 The method for handover control and mobile terminal of a kind of network
CN107645529A (en) * 2016-07-21 2018-01-30 腾讯科技(深圳)有限公司 Heartbeat packet transmission method and device
CN108040091A (en) * 2017-11-27 2018-05-15 腾讯数码(天津)有限公司 Data processing method, device and storage medium
CN110312286A (en) * 2018-03-27 2019-10-08 华为技术有限公司 Method for switching network, communication device and communication equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015188761A1 (en) * 2014-06-12 2015-12-17 Tencent Technology (Shenzhen) Company Limited Traffic acquiring method and apparatus based on operating system
CN105893129A (en) * 2016-03-30 2016-08-24 北京小米移动软件有限公司 Processing method and device for application programs in terminal
CN107645529A (en) * 2016-07-21 2018-01-30 腾讯科技(深圳)有限公司 Heartbeat packet transmission method and device
CN106941713A (en) * 2017-05-16 2017-07-11 努比亚技术有限公司 It is a kind of to reduce the method and its device of mobile terminal power consumption
CN107635261A (en) * 2017-09-18 2018-01-26 维沃移动通信有限公司 The method for handover control and mobile terminal of a kind of network
CN108040091A (en) * 2017-11-27 2018-05-15 腾讯数码(天津)有限公司 Data processing method, device and storage medium
CN110312286A (en) * 2018-03-27 2019-10-08 华为技术有限公司 Method for switching network, communication device and communication equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022074A (en) * 2022-06-24 2022-09-06 中国电信股份有限公司 User authentication and authorization method, device, medium and equipment

Also Published As

Publication number Publication date
CN114125023B (en) 2024-03-22

Similar Documents

Publication Publication Date Title
CN107864228B (en) Connection establishment method and system in content distribution network
RU2759180C2 (en) Anr configuration method, terminal device, base station and base network device
CN110611723B (en) Scheduling method and device of service resources
US8774211B2 (en) Autonomous network access congestion and collision control
CA3006394C (en) Status detection method and wireless network node
US20180091581A1 (en) Method of switching download mode, control method thereof and control system thereof
US10084679B2 (en) Standalone network probing using available network connections
CN106255226B (en) Network connection processing method and device
WO2014194783A1 (en) Method and apparatus for detecting target networks coverage
KR20180047172A (en) Method and Apparatus for Controlling Congestion in Communication Systems with Services
CN109150659B (en) Processor and BFD message transmission method
CN112398689A (en) Network recovery method and device, storage medium and electronic equipment
CN113453292B (en) Method for establishing connection, communication device and system
US11178030B2 (en) Mobile internet fallback/switchover and restore mechanism
CN114125023B (en) Method and device for determining data connection, storage medium and electronic device
CN112165408A (en) Test method and device for simulating client serial deployment environment
CN111884875A (en) Offline device determination method and device
CN110769019B (en) Session processing method, device, system, storage medium and computing equipment
CN108055172B (en) Bidirectional forwarding detection method and device
CN110166518B (en) Session information transmission method, device, storage medium and electronic device
EP3145242A1 (en) Method for access terminal to switch monitoring frequency point, and access terminal
WO2017219667A1 (en) Method, device, and system for modifying mss
US9967190B2 (en) Session link control method and apparatus, and computer storage medium
CN110417679B (en) Method, device and system for avoiding bypass blocking
CN112751706A (en) Target data transmission method and device

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