CN113301129A - Data transmission method and device - Google Patents
Data transmission method and device Download PDFInfo
- Publication number
- CN113301129A CN113301129A CN202110513608.4A CN202110513608A CN113301129A CN 113301129 A CN113301129 A CN 113301129A CN 202110513608 A CN202110513608 A CN 202110513608A CN 113301129 A CN113301129 A CN 113301129A
- Authority
- CN
- China
- Prior art keywords
- node
- data
- nodes
- target module
- preset
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Computer And Data Communications (AREA)
Abstract
The application discloses a data transmission method and a device, wherein the method comprises the following steps: the method comprises the steps that a first node in a plurality of nodes representing the same target module integrated in a plurality of applications in the terminal equipment can find out other nodes in the plurality of nodes of the terminal equipment and the node type of the first node; when the first node is a primary node, the data sent by the secondary node can be received, and the data are forwarded to the server of the target module when the data meet the preset conditions, and/or the data sent by the server of the target module are received and distributed to the secondary node; when the first node is a secondary node, the data can be sent to the primary node, so that the primary node reports the data to the server of the target module when the data meets a preset condition, and/or receives the data from the server of the target module, which is distributed by the primary node. The method and the device can realize the purpose of multiplexing the network resources and the equipment resources, thereby reducing the consumption of the network resources and the equipment resources and further reducing the resource waste.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data transmission method and apparatus.
Background
In the development process of an Application (APP) of a terminal device, a situation that multiple applications integrate the same module, such as integrating the same data statistics module, information push module, information flow module, etc., is often encountered.
Although these modules integrated in different applications are on the same terminal device, they all work independently with the respective application. For example, the same information pushing module in each application needs to maintain a long connection with the server corresponding to the module to receive information pushed by the server, and the same data statistics module in each application reports the basic information of the terminal device to the server corresponding to the module once, and so on.
Obviously, the way in which the same modules integrated in different applications of the same device work independently of each other causes waste of resources, and needs to be improved.
Disclosure of Invention
The embodiment of the application provides a data transmission method and device, so as to reduce resource waste.
In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a first node in a terminal device, where the terminal device includes multiple nodes, the multiple nodes represent a same target module integrated in multiple applications in the terminal device, and the first node is any one of the multiple nodes, where the method includes:
determining a second node on the terminal equipment in a first preset mode, wherein the second node is a node except the first node in the plurality of nodes;
determining a node type of the first node through a second preset mode, wherein the node type comprises one of a primary node and a secondary node;
when the first node is a primary node, executing a first step, wherein the first step comprises the following steps: receiving data sent by a secondary node, and forwarding the data to the server of the target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one of the second nodes;
when the first node is a secondary node, performing a second step, the second step comprising: sending data to a main node, so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the primary node is the second node, and the primary node is determined according to the second preset mode.
In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to a server of a target module, and the method includes:
receiving data reported by a primary node in terminal equipment, wherein the data come from a secondary node in the terminal equipment and are reported by the primary node when the data meet a preset condition;
and/or the presence of a gas in the gas,
sending data to a primary node in a terminal device so that the primary node distributes the data to a secondary node in the terminal device;
the terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
In a third aspect, an embodiment of the present application further provides a data transmission apparatus, which is applied to a first node in a terminal device, where the terminal device includes multiple nodes, the multiple nodes represent a same target module integrated in multiple applications in the terminal device, and the first node is any one of the multiple nodes, where the apparatus includes:
a node determining module, configured to determine a second node on the terminal device in a first preset manner, where the second node is a node other than the first node in the plurality of nodes;
a node type determining module, configured to determine a node type of the first node in a second preset manner, where the node type includes one of a primary node and a secondary node;
a first data transmission module, configured to execute a first step when the first node is a primary node, where the first step includes: receiving data sent by a secondary node, and forwarding the data to the server of the target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one of the second nodes;
a second data transmission module, configured to execute a second step when the first node is a secondary node, where the second step includes: sending data to a main node, so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the primary node is the second node, and the primary node is determined according to the second preset mode.
In a fourth aspect, an embodiment of the present application further provides a data transmission apparatus, which is applied to a server of a target module, where the apparatus includes: at least one of a data receiving module and a data issuing module;
the data receiving module is used for receiving data reported by a primary node in terminal equipment, wherein the data come from a secondary node in the terminal equipment and are reported by the primary node when the data meet preset conditions;
the data issuing module is used for issuing data to a primary node in the terminal equipment so that the primary node can distribute the data to a secondary node in the terminal equipment;
the terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
In a fifth aspect, an embodiment of the present application further provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first or second aspect.
In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method according to the first aspect or the second aspect.
In the at least one technical solution adopted in the embodiment of the present application, since the same module in multiple applications integrated on the same terminal device is regarded as multiple nodes, any one of the nodes may discover other nodes through a first preset mode, and coordinate a primary node from the multiple nodes through a second preset mode, and the other nodes are secondary nodes, a local cooperative network is finally formed, and the primary node collects data of the secondary nodes and reports the data to the server of the module when the data meets preset conditions, or the primary node receives data sent by the server of the module and distributes the data to the secondary nodes, so as to achieve the purpose of multiplexing network resources and device resources, thereby reducing consumption of network resources and device resources, and reducing resource waste.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a data transmission method according to an embodiment of the present application.
Fig. 2 is a detailed flowchart of step 102 in a data transmission method according to the embodiment shown in fig. 1.
Fig. 3 is a schematic diagram of a data transmission scheme in the related art.
Fig. 4 is a schematic diagram of a data transmission method according to an embodiment of the present application.
Fig. 5 is another schematic flow chart of a data transmission method according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a data transmission device according to an embodiment of the present application.
Fig. 7 is another schematic structural diagram of a data transmission device according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, 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 application.
In order to solve the problem of resource waste caused by mutually independent work of the same module in different applications of the same device in the related art, embodiments of the present application provide a data transmission method and apparatus applied to a terminal device, and a data transmission method and apparatus applied to a server. The execution main body of the method and the device applied to the terminal device may be a module integrated in an application in the terminal device, and the method and the device are controlled and implemented by accessing a new Software Development Kit (SDK).
It should be noted that, in the embodiments provided in the present application, for convenience of description, a certain same module (hereinafter, referred to as a target module) integrated in different applications on the same terminal device may be regarded as a node, and specifically, the module integrated in one application may be regarded as one node, and the modules integrated in a plurality of applications may be regarded as a plurality of nodes. For example, the target module may be an SDK provided by a certain service provider, such as an aurora push module pushed by a third-party cloud push platform.
A data transmission method applied to a terminal device side according to an embodiment of the present application is described below.
As shown in fig. 1, a data transmission method provided in this embodiment of the present application may be specifically applied to a first node in a terminal device, where the terminal device includes multiple nodes, the multiple nodes represent a same target module integrated in multiple applications in the terminal device, and the first node is any one of the multiple nodes, and the method may include the following steps:
step 101, determining a second node on the terminal device through a first preset mode, wherein the second node is a node except the first node in a plurality of nodes included in the terminal device.
Assuming that the same target module is integrated into multiple (e.g., N) applications in the terminal device, it may be determined that the terminal device includes N nodes, where the first node is any one of the N nodes, and the second nodes are the rest of the N nodes except the first node, and the number of the second nodes is N-1.
The above step 101 may be understood as a step in which a first node in a terminal device discovers a second node on the terminal device. In a specific implementation, there are many ways for the first node to discover the second node, that is, there are many ways for the first node to discover the second node, which are described below.
First, determining the second node on the terminal device in the first preset manner may include: the second node in the terminal device can be determined by accessing the designated file on the terminal device, wherein the designated file records all applications integrated with the same target module in the terminal device, and all second nodes on the terminal device can be queried by accessing the file.
Secondly, since the functional module integrated in the application will be described in the manifest file of the application, determining the second node on the terminal device in the first preset manner may include: inquiring the list files of other applications except the application where the first node is located (the application integrated with the first node) on the terminal equipment; and if the manifest file of one of the other applications contains preset content, determining that the target module is integrated in the application, and determining the target module integrated in the application as a second node on the terminal equipment, wherein the preset content is related to the target module.
Specifically, in the second manner, the preset content may be exposed to the outside in a manifest file of an application integrated with the target module in advance, and then the first node may determine the second node by querying whether the manifest file of the other applications installed in the terminal device includes the preset content. More specifically, a preset component, such as Service or Activity, exposed to the outside may be declared in a manifest file of an application integrated with a target module in advance, and Service is generally selected because Service does not need a visual interface, an intent filter (intetfilter) is configured in the preset component, and identification information of the target module is set in a filtering condition of the intent filter. That is to say, the preset content may specifically include a preset component exposed to the outside, a deliberate image filter is configured in the preset component, and the filtering condition of the intentional image filter is provided with the identification information of the target module. An example of code declaring externally exposed Service in a manifest file of an application integrated with a target module is as follows:
it is understood that after the first node finds out the second node on the terminal device, it is understood that a local cooperative network formed by one first node and N-1 second nodes (N nodes in total) is formed locally on the terminal device.
Step 102, determining a node type of the first node through a second preset mode, wherein the node type comprises one of a primary node and a secondary node.
The step 102 may be understood as a process of distinguishing primary and secondary nodes in a local cooperative network formed by N nodes in the terminal device, where at the same time, only one primary node is usually present, and the rest are secondary nodes. But as the primary node processes die, the primary node changes.
In a specific implementation, there are many ways to determine the node type of the first node, that is, the second preset way may be many, and two ways are also listed below.
First, the node type of the first node may be determined by a pre-agreed rule, for example, the rule may be: the target module in the application started firstly in the plurality of applications integrated with the target module in the terminal equipment is used as a primary node, and the rest nodes are used as secondary nodes. Correspondingly, determining the node type of the first node through the second preset mode may include: and determining the starting time of the target application, if the starting time is earlier than the starting time of the rest applications integrated with the target modules in the terminal equipment, determining the first node as a primary node, and otherwise, determining the first node as a secondary node.
Second, the node type of the first node may be determined by whether a designated port in the terminal device can be successfully connected. That is, the determining the node type of the first node in the second preset manner may include: sending a connection request to a designated port on the terminal equipment and determining whether the connection is successful; if the connection fails, determining that the first node is a main node, and monitoring the designated port; and if the connection is successful, determining the first node as a secondary node. This procedure can also be seen as an initialization procedure of the first node (target module integrated in the application), which is explained in detail below with reference to fig. 2.
As shown in fig. 2, the initialization process of the first node may include:
step 201, start.
Step 202, sending a connection request to a designated port on the terminal equipment, and determining whether the connection is successful; if the connection is successful, step 203 is executed, otherwise, step 205 or step 206 is executed.
For example, at the beginning of initialization, the first node may attempt to connect to a port P assigned locally to the end device, the port P being defined in advance by a specific value, for example, an android device, since the 0-1023 bit system reserves ports, the port range that can be selected is 1024-.
Step 203, determining the first node as a secondary node, and then proceeding to step 204.
And step 204, establishing a preset connection with the main node.
If the connection is successful, it means that the designated port has service monitoring, only the main node will monitor the designated port, and the designated port can be monitored by only one service, so that it means that there is a main node currently, a preset connection (for example, a local Socket connection is established) is established with the main node through the designated port to communicate with the main node, and the specific communication content will be described in detail below.
Step 205, reconnecting the designated port, and judging whether the connection times reach preset times; if so, go to step 206, otherwise, go back to step 202.
And step 206, determining the first node as a main node, and monitoring the designated port.
If the connection fails, it means that the designated port is not monitored, meaning that there is no primary node currently, the first node determines itself as the primary node, and starts monitoring the designated port. That is, when the first node is determined to be the secondary node, the method shown in fig. 1 may further include, before performing the following second step: and establishing a preset connection with the main node through the designated port so as to communicate with the main node, wherein the designated port is monitored by the main node.
It is appreciated that, through step 102, the first node may determine its own role in the local collaborative network, thereby facilitating a reduction in waste of network and device resources in subsequent data transmissions.
Step 103, when the first node is a main node, executing a first step, wherein the first step comprises: receiving data sent by a secondary node, and forwarding the data to a server of a target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one said second node.
And 104, when the first node is a secondary node, executing a second step, wherein the second step comprises the following steps: sending data to the main node so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the main node is the second node, and the main node is determined according to the second preset mode.
The preset condition comprises that the server which reports to the target module is new data which is not reported. Alternatively, the primary node only reports data to the server of the target module that is changed/unknown to the server of the target module. Therefore, the repeated reporting of the same data to the server of the target module can be avoided, and the occupation of network resources and equipment resources is reduced.
The above step 103 and the above step 104 are intended to illustrate that, after the roles of the nodes in the local cooperative network in the terminal device are allocated, the secondary node transmits the data that needs to be reported to the server of the target module to the primary node, and the primary node summarizes and filters the data from the secondary node (filters out the data that does not meet the preset condition) and then transmits the data to the server of the target module, so as to achieve the multiplexing of network resources and device resources, thereby avoiding the waste of network resources and device resources; when the server of the target module has data to be issued to each node, the data is issued to the primary node first, and then the data is distributed to the secondary nodes by the primary node instead of being issued to each node one by one, so that multiplexing of network resources and equipment resources can be achieved, and waste of the network resources and the equipment resources is avoided.
As an example, the data that the secondary node or the primary node needs to report to the server of the target module may include, but is not limited to, one or more of the name of the application package, the version information of the application, and the version information of the target module corresponding to the node. It can be understood that the version information of the application and the version information of the target module do not change frequently, so that the reporting to the server is not required to be repeated.
Optionally, when the primary node reports the data from the secondary node to the server, the primary node may also report identification information of an application in which the secondary node is located, so that the server can distinguish from which application the received data originates.
As an example, the data sent by the server may include, in addition to the service data, node information, where the node information may include, but is not limited to, application identification information of the node, such as an application package name, so that the primary node distributes the data to the corresponding secondary node.
Alternatively, when the current primary node (first node or a second node) is dead, its connection with the secondary node is disconnected, and there is no primary node in the local cooperative network, and any node in the local cooperative network may re-perform step 102 to determine the primary node. Specifically, as an example, the initialization procedure shown in fig. 2 may be executed to attempt to connect to the primary node, and attempt to become the primary node after the connection fails. In the initialization procedure shown in fig. 2, only one node will successfully become the primary node because the designated port is fixed and only one service is allowed to be bound to the designated port at the same time.
The following describes an effect of a data transmission method provided by the embodiment of the present application with reference to fig. 3 and fig. 4. Fig. 3 is a diagram illustrating a transmission effect of a data transmission scheme in the related art. Fig. 4 is a schematic diagram of a transmission effect of a data transmission method according to an embodiment of the present application.
Assuming that the application 1, the application 2, the application 3 and the application 4 on the same terminal device are all integrated with a target module, taking the target module as an aurora push module disclosed by a third party as an example, all applications in an Android mobile phone can access the module to realize information push capability. Then, as shown in fig. 3, in the related art, when the application 1, the application 2, the application 3, and the application 4 integrated with the target module are initialized, long connections are established with the server of the module to ensure that the push message is issued in time, for example, the connection 1, the connection 2, the connection, and the connection 4 are respectively established with the server of the target module, and the message issued by the server of the target module is received in time. After the data transmission scheme provided by the embodiment of the present application is applied, as shown in fig. 4, the application 1, the application 2, the application 3, and the application 4 no longer communicate with the server of the target module independently, the application 1, the application 2, the application 3, and the application 4 may form a local cooperative network, and a primary node (a target module integrated in the application 3) in the local cooperative network communicates with the server of the target module to receive a message pushed by the server, and a secondary node communicates with the primary node to obtain the message pushed by the server, and the secondary node does not communicate with the server of the target module.
The data transmission method provided by the embodiment of the application realizes the coordination and scheduling mechanism of the nodes, is a general supporting scheme, and can realize the data sharing and sharing among specific nodes by combining with specific service scenes. For example, when the target module is the data statistics SDK, by applying the scheme, a plurality of applications of the data statistics SDK can be integrated on the terminal device, only one application is needed to connect the server and report the basic information of the device, and other applications do not need to connect the server and report the repeated information, so that the traffic cost and the computing resource can be saved. For another example, when the target module is the message pushing SDK, after the scheme is applied, multiple applications of the message pushing SDK can be integrated on the terminal device, only one application needs to connect to the server to inform the server of information of all nodes on the device, and then the server directly issues the information to the primary node when the server needs to issue the information to any node on the device, and then the primary node issues the information to the secondary node through local connection between the primary node and the secondary node, so that all the nodes are not required to keep long connection with the server, and therefore, server resources and flow cost can be saved.
In summary, in the data transmission method provided in this embodiment of the present application, a same module in multiple applications integrated on a same terminal device is regarded as multiple nodes, where any node may discover other nodes in a first preset manner, and coordinate a primary node from the multiple nodes in a second preset manner, and the other nodes are secondary nodes, so as to finally form a local cooperative network, and the primary node collects data of the secondary nodes and reports the data to a server of the module when the data meets a preset condition, or the primary node receives data sent by the server of the module and distributes the data to the secondary nodes, so as to achieve the purpose of multiplexing network resources and device resources, thereby reducing consumption of network resources and device resources, and reducing resource waste.
Optionally, as shown in fig. 5, the data transmission scheme applied to the terminal device side according to the embodiment of the present application may further include, after step 102, the following steps:
step 105, when the first node is determined to be the primary node, determining an inactive secondary node based on the connection information of the secondary node and the first node.
After finding out all the second nodes on the terminal device and upon determining itself as the primary node, the first node may determine all the second nodes as secondary nodes, and by comparing information of secondary nodes having established a connection with the first node, find out secondary nodes not connected with the first node and determine them as inactive secondary nodes.
For example, the secondary node is awakened by binding the externally exposed Service component of the first node with the Service component of the inactive node.
Optionally, after step 106, the inactive secondary node is waited for to go online. For example, waiting for an inactive secondary node to establish a connection with the first node.
It can be understood that, with the embodiment shown in fig. 5, the terminal device may wake up the inactive secondary node in the local cooperative network, so that the inactive secondary node establishes a connection with the primary node, thereby receiving data distributed by the primary node on behalf of the server of the target module in time, or reporting relevant data that has changed to the server of the target module in time.
Corresponding to the above data transmission method applied to the terminal device side, the embodiment of the present application further provides a data transmission method applied to a server of a target module, which is introduced below.
Another embodiment of the present application provides a data transmission method, which is applicable to a server of a target module, and may include: receiving data reported by a primary node in terminal equipment, wherein the data come from a secondary node in the terminal equipment and are reported by the primary node when the data meet a preset condition; and/or issuing data to a primary node in the terminal equipment so that the primary node distributes the data to a secondary node in the terminal equipment.
The terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
According to the data transmission method provided by the embodiment of the application, the server of the target module does not need to communicate with each node in the terminal equipment, but only communicates with the primary node, receives the data of the secondary node meeting the preset conditions reported by the primary node, or issues the data needing to be distributed to the secondary node to the primary node and then forwards the data to the secondary node by the primary node, so that the purposes of multiplexing the server and network resources can be achieved, the server resources and flow cost can be saved, and the resource waste is avoided.
Corresponding to the above method embodiment, the present application further provides a data transmission device, which is introduced below.
As shown in fig. 6, a data transmission apparatus 600 provided in this embodiment of the present application may be applied to a first node in a terminal device, where the terminal device includes a plurality of nodes, the plurality of nodes represent a same target module integrated in a plurality of applications in the terminal device, and the first node is any one of the plurality of nodes, and the apparatus 600 may include: a node determination module 601, a node type determination module 602, a first data transmission module 603, and a second data transmission module 604.
A node determining module 601, configured to determine, in a first preset manner, a second node on the terminal device, where the second node is a node, except for the first node, in the multiple nodes.
As an example, the node determining module 601 is specifically configured to query manifest files of other applications on the terminal device except for an application where the first node is located (an application integrated with the first node); and if the manifest file of one of the other applications contains preset content, determining that the target module is integrated in the application, and determining the target module integrated in the application as a second node on the terminal equipment, wherein the preset content is related to the target module.
A node type determining module 602, configured to determine a node type of the first node in a second preset manner, where the node type includes one of a primary node and a secondary node.
As an example, the node type determining module 602 is specifically configured to send a connection request to a specified port on the terminal device, and determine whether the connection is successful; if the connection fails, determining that the first node is a main node, and monitoring the designated port; and if the connection is successful, determining the first node as a secondary node.
A first data transmission module 603, configured to, when the first node is a primary node, perform a first step, where the first step includes: receiving data sent by a secondary node, and forwarding the data to the server of the target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one of the second nodes.
A second data transmission module 604, configured to perform a second step when the first node is a secondary node, where the second step includes: sending data to a main node, so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the primary node is the second node, and the primary node is determined according to the second preset mode.
The preset condition comprises that the server which reports to the target module is new data which is not reported. Alternatively, the primary node only reports data to the server of the target module that is changed/unknown to the server of the target module. Therefore, the repeated reporting of the same data to the server of the target module can be avoided, and the occupation of network resources and equipment resources is reduced.
As an example, the data that the secondary node or the primary node needs to report to the server of the target module may include, but is not limited to, one or more of the name of the application package, the version information of the application, and the version information of the target module corresponding to the node. It can be understood that the version information of the application and the version information of the target module do not change frequently, so that the reporting to the server is not required to be repeated.
Optionally, the first data transmission module 603 may be further configured to, when the primary node reports the data from the secondary node to the server, report the identification information of the application where the secondary node is located at the same time, so that the server distinguishes from which application the received data originates.
As an example, the data sent by the server may include, in addition to the service data, node information, where the node information may include, but is not limited to, application identification information of the node, such as an application package name, so that the primary node distributes the data to the corresponding secondary node.
In the data transmission apparatus provided in the embodiment of the present application, a same module in multiple applications integrated on a same terminal device is regarded as multiple nodes, where any node may discover other nodes through a first preset manner, and coordinate a primary node from the multiple nodes through a second preset manner, and the other nodes are secondary nodes, so as to finally form a local cooperative network, and the primary node collects data of the secondary nodes and reports the data to a server of the module when the data meets a preset condition, or the primary node receives data sent by the server of the module and distributes the data to the secondary nodes, so as to achieve the purpose of multiplexing network resources and device resources, thereby reducing consumption of network resources and device resources, and reducing resource waste.
Optionally, as shown in fig. 7, in another embodiment, a data transmission apparatus 600 provided in the present application may further include: an inactive node determination module 605 and an inactive node wakeup module 606.
An inactive node determination module 605, when it is determined that the first node is a primary node, determines an inactive secondary node based on connection information of secondary nodes with the first node.
And an inactive node awakening module 606 for awakening the inactive secondary node by binding the preset component exposed to the outside by the first node and the preset component of the inactive secondary node.
It can be understood that, with the embodiment shown in fig. 7, the terminal device may wake up the inactive secondary node in the local cooperative network, so that the inactive secondary node establishes a connection with the primary node, thereby receiving data distributed by the primary node on behalf of the server of the target module in time, or reporting relevant data that has changed to the server of the target module in time.
Another embodiment of the present application also provides a data transmission apparatus, which may apply a server of a target module, and the apparatus may include: at least one of a data receiving module and a data issuing module.
The data receiving module is configured to receive data reported by a primary node in a terminal device, where the data comes from a secondary node in the terminal device, and the data is reported by the primary node when the data meets a preset condition.
The data issuing module is used for issuing data to a primary node in the terminal equipment so that the primary node can distribute the data to a secondary node in the terminal equipment.
The terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
According to the data transmission device provided by the embodiment of the application, the server of the target module does not need to communicate with each node in the terminal equipment, but only communicates with the primary node, receives the data of the secondary node meeting the preset conditions reported by the primary node, or issues the data needing to be distributed to the secondary node to the primary node and then forwards the data to the secondary node by the primary node, so that the purposes of multiplexing the server and network resources can be achieved, the server resources and flow cost can be saved, and the resource waste is avoided.
It should be noted that, since the device embodiments are executed in a manner similar to the method embodiments, the device embodiments are described in a simplified manner, and reference is made to the method embodiments for relevant points.
Fig. 8 shows a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 8, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the data transmission device on the logic level. And the processor is used for executing the program stored in the memory and is specifically used for executing the data transmission method provided by the embodiment of the application.
The method performed by the data transmission apparatus according to the embodiment shown in fig. 1 of the present application may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, where the one or more programs include instructions, which when executed by an electronic device including a plurality of application programs, can cause the electronic device to execute the method performed by the data transmission apparatus in the embodiment shown in fig. 1, and is specifically configured to execute the data transmission method provided in the embodiment of the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that all the embodiments in the present application are described in a related manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A data transmission method, applied to a first node in a terminal device, where the terminal device includes multiple nodes, the multiple nodes represent a same target module integrated in multiple applications in the terminal device, and the first node is any one of the multiple nodes, where the method includes:
determining a second node on the terminal equipment in a first preset mode, wherein the second node is a node except the first node in the plurality of nodes;
determining a node type of the first node through a second preset mode, wherein the node type comprises one of a primary node and a secondary node;
when the first node is a primary node, executing a first step, wherein the first step comprises the following steps: receiving data sent by a secondary node, and forwarding the data to the server of the target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one of the second nodes;
when the first node is a secondary node, performing a second step, the second step comprising: sending data to a main node, so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the primary node is the second node, and the primary node is determined according to the second preset mode.
2. The method of claim 1, wherein the determining the second node on the terminal device in the first preset manner comprises:
inquiring the list files of other applications on the terminal equipment except the application where the first node is located;
and if the manifest file of one of the other applications contains preset content, determining that the target module is integrated in the application, and determining the target module integrated in the application as a second node on the terminal equipment, wherein the preset content is related to the target module.
3. The method of claim 2,
the preset content specifically comprises a preset component exposed to the outside, a conscious graph filter is configured in the preset component, and identification information of the target module is set in the filtering condition of the intent graph filter.
4. The method according to claim 1, wherein the determining the node type of the first node by the second preset manner includes:
sending a connection request to a designated port on the terminal equipment, and determining whether the connection is successful;
if the connection fails, determining that the first node is a main node, and monitoring the designated port;
and if the connection is successful, determining the first node as a secondary node.
5. The method of claim 4, wherein when the first node is determined to be a secondary node, prior to performing the second step, the method further comprises:
and establishing a preset connection with the main node through the designated port so as to communicate with the main node, wherein the designated port is monitored by the main node.
6. The method of claim 5, wherein when the first node is determined to be a primary node, the method further comprises:
determining an inactive secondary node based on connection information of the secondary node with the first node;
awakening the inactive secondary node by binding a preset component exposed to the outside by the first node and a preset component of the inactive secondary node.
7. The method according to any one of claims 1 to 6,
the preset condition comprises that the server which reports to the target module is new data which is not reported.
8. A data transmission method applied to a server of a target module, the method comprising:
receiving data reported by a primary node in terminal equipment, wherein the data come from a secondary node in the terminal equipment and are reported by the primary node when the data meet a preset condition;
and/or the presence of a gas in the gas,
sending data to a primary node in a terminal device so that the primary node distributes the data to a secondary node in the terminal device;
the terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
9. A data transmission apparatus, applied to a first node in a terminal device, where the terminal device includes a plurality of nodes, the plurality of nodes represent a same target module integrated in a plurality of applications in the terminal device, and the first node is any one of the plurality of nodes, the apparatus comprising:
a node determining module, configured to determine a second node on the terminal device in a first preset manner, where the second node is a node other than the first node in the plurality of nodes;
a node type determining module, configured to determine a node type of the first node in a second preset manner, where the node type includes one of a primary node and a secondary node;
a first data transmission module, configured to execute a first step when the first node is a primary node, where the first step includes: receiving data sent by a secondary node, and forwarding the data to the server of the target module when the data meet preset conditions, and/or receiving data sent by the server of the target module and distributing the data to the secondary node; wherein the secondary node comprises at least one of the second nodes;
a second data transmission module, configured to execute a second step when the first node is a secondary node, where the second step includes: sending data to a main node, so that the main node reports the data to a server of the target module when the data meets a preset condition, and/or receiving the data from the server of the target module, which is distributed by the main node; the primary node is the second node, and the primary node is determined according to the second preset mode.
10. A data transmission apparatus, applied to a server of a target module, the apparatus comprising: at least one of a data receiving module and a data issuing module;
the data receiving module is used for receiving data reported by a primary node in terminal equipment, wherein the data come from a secondary node in the terminal equipment and are reported by the primary node when the data meet preset conditions;
the data issuing module is used for issuing data to a primary node in the terminal equipment so that the primary node can distribute the data to a secondary node in the terminal equipment;
the terminal device comprises a plurality of nodes, the plurality of nodes represent the target module integrated in a plurality of applications in the terminal device, the primary node is one of the plurality of nodes, the secondary nodes are the rest of the plurality of nodes, and the primary node is determined based on a second preset mode.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110513608.4A CN113301129B (en) | 2021-05-11 | 2021-05-11 | Data transmission method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110513608.4A CN113301129B (en) | 2021-05-11 | 2021-05-11 | Data transmission method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113301129A true CN113301129A (en) | 2021-08-24 |
CN113301129B CN113301129B (en) | 2023-04-28 |
Family
ID=77321429
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110513608.4A Active CN113301129B (en) | 2021-05-11 | 2021-05-11 | Data transmission method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113301129B (en) |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102594881A (en) * | 2012-02-08 | 2012-07-18 | 中兴通讯股份有限公司 | Virtual machine load balancing method, management modules and virtual machine cluster system |
US20160373343A1 (en) * | 2014-03-05 | 2016-12-22 | Huawei Technologies Co., Ltd. | Access node device for forwarding data packets |
CN106330787A (en) * | 2015-06-30 | 2017-01-11 | 联想(北京)有限公司 | Data packet transmission method, devices and system |
US20170126436A1 (en) * | 2015-11-02 | 2017-05-04 | International Business Machines Corporation | Distributed virtual gateway appliance |
CN107659664A (en) * | 2017-10-30 | 2018-02-02 | 珠海格力电器股份有限公司 | Message transmission method, device and system |
CN108156236A (en) * | 2017-12-22 | 2018-06-12 | 平安养老保险股份有限公司 | Service request processing method, device, computer equipment and storage medium |
CN109298937A (en) * | 2018-09-19 | 2019-02-01 | 中国联合网络通信集团有限公司 | Document analysis method and the network equipment |
CN110175178A (en) * | 2018-11-01 | 2019-08-27 | 华为终端有限公司 | A kind of method of data processing, node device and system |
US20190332813A1 (en) * | 2016-12-20 | 2019-10-31 | Sony Mobile Communications Inc. | Modular system for controlling usability of a device |
CN111260396A (en) * | 2020-01-13 | 2020-06-09 | 腾讯科技(深圳)有限公司 | Advertisement preloading method and device, electronic equipment and storage medium |
CN111405021A (en) * | 2020-03-10 | 2020-07-10 | 中国建设银行股份有限公司 | Data transmission method, device, equipment and storage medium of peer-to-peer node |
CN111580993A (en) * | 2020-05-11 | 2020-08-25 | 广州虎牙信息科技有限公司 | Data processing method and device, electronic equipment and storage medium |
CN111953785A (en) * | 2020-08-14 | 2020-11-17 | 中国工商银行股份有限公司 | Data transmission method, system and server |
-
2021
- 2021-05-11 CN CN202110513608.4A patent/CN113301129B/en active Active
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102594881A (en) * | 2012-02-08 | 2012-07-18 | 中兴通讯股份有限公司 | Virtual machine load balancing method, management modules and virtual machine cluster system |
US20160373343A1 (en) * | 2014-03-05 | 2016-12-22 | Huawei Technologies Co., Ltd. | Access node device for forwarding data packets |
CN106330787A (en) * | 2015-06-30 | 2017-01-11 | 联想(北京)有限公司 | Data packet transmission method, devices and system |
US20170126436A1 (en) * | 2015-11-02 | 2017-05-04 | International Business Machines Corporation | Distributed virtual gateway appliance |
US20190332813A1 (en) * | 2016-12-20 | 2019-10-31 | Sony Mobile Communications Inc. | Modular system for controlling usability of a device |
CN107659664A (en) * | 2017-10-30 | 2018-02-02 | 珠海格力电器股份有限公司 | Message transmission method, device and system |
CN108156236A (en) * | 2017-12-22 | 2018-06-12 | 平安养老保险股份有限公司 | Service request processing method, device, computer equipment and storage medium |
CN109298937A (en) * | 2018-09-19 | 2019-02-01 | 中国联合网络通信集团有限公司 | Document analysis method and the network equipment |
CN110175178A (en) * | 2018-11-01 | 2019-08-27 | 华为终端有限公司 | A kind of method of data processing, node device and system |
CN111260396A (en) * | 2020-01-13 | 2020-06-09 | 腾讯科技(深圳)有限公司 | Advertisement preloading method and device, electronic equipment and storage medium |
CN111405021A (en) * | 2020-03-10 | 2020-07-10 | 中国建设银行股份有限公司 | Data transmission method, device, equipment and storage medium of peer-to-peer node |
CN111580993A (en) * | 2020-05-11 | 2020-08-25 | 广州虎牙信息科技有限公司 | Data processing method and device, electronic equipment and storage medium |
CN111953785A (en) * | 2020-08-14 | 2020-11-17 | 中国工商银行股份有限公司 | Data transmission method, system and server |
Non-Patent Citations (2)
Title |
---|
WANGQUAN YE; YING LI; WENDONG LI; FUJUN QI; RONGER ZHENG: "Shore-based terminal of OUC-Raman instrument node for seafloor cabled observatory network", 《2016 10TH INTERNATIONAL CONFERENCE ON SENSING TECHNOLOGY (ICST)》 * |
顾振德: "面向IoT终端的海量TCP连接管理集群系统的设计与实现", 《中国优秀硕士学文论文全文数据库》 * |
Also Published As
Publication number | Publication date |
---|---|
CN113301129B (en) | 2023-04-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112055091B (en) | Vehicle-mounted micro-service architecture, and communication method and device of vehicle-mounted module | |
CN108401037B (en) | Binding method, device and system of user terminal and equipment | |
CN113746928B (en) | Cross-cloud service calling method, device and system | |
CN109871498B (en) | Rear-end interface response method and device, electronic equipment and storage medium | |
CN111212099A (en) | Micro-service management method and device | |
JP2022517973A (en) | User identification card authentication method, devices, electronic devices and storage media | |
CN111093160B (en) | Calling method, equipment and system | |
CN113498110B (en) | Service message transmission method and related equipment | |
CN110809045B (en) | Data communication method and related equipment thereof | |
CN112788518B (en) | Location service processing method and related equipment | |
CN103914335A (en) | Invoking method, equipment and system for background service | |
CN113301129A (en) | Data transmission method and device | |
US9705742B2 (en) | Method and apparatus for enabling M2M service and H2H service to coexist | |
CN112787828B (en) | Application flow statistical method and device and mobile electronic device | |
CN104144414A (en) | Information intercepting method and device | |
CN111930542A (en) | Data acquisition method and device, electronic equipment and computer readable storage medium | |
CN110784510A (en) | Method for accessing target service node to bus and information interaction method of service node | |
CN111475230A (en) | Application function configuration method and device and electronic equipment | |
CN112148320A (en) | Application program upgrading method, device, equipment and storage medium | |
CN114189893B (en) | O-RAN capability opening method, communication system, device and storage medium | |
CN111385167B (en) | Network connection recovery method, device, computer device and storage medium | |
CN112653609B (en) | VPN identification application method, device, terminal and storage medium | |
CN111294374B (en) | Heterogeneous equipment starting system, method and device and electronic equipment | |
CN114222255A (en) | Method and device for device ad hoc network, electronic device and storage medium | |
CN114726711A (en) | Method and system for cooperative processing service between devices |
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 |