Cross-device communication method, device, equipment, system and storage medium
By introducing sniffing and communication establishment modules between multiple devices, and using proxy servers to realize cross-device communication, the problem of application communication between different devices is solved, and automated communication link construction and efficient data transmission are realized.
Patent Information
- Application Number
- CN202310748832.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-21
- Publication Date
- 2024-12-24
AI Technical Summary
The prior art cannot effectively realize application communication between different devices, especially in cross-device scenarios, and lacks applicable communication methods.
By introducing sniffing message sending and receiving modules, communication setting modules and application message sending modules into multiple devices, a proxy server is used to sniff, establish a communication link, and transmit application messages to the target device to realize cross-device communication.
Without the need for users to manually deploy communication links, communication is automatically established between devices to realize application communication between different devices, and improve the degree of automation and communication efficiency of network construction.
Smart Images

Figure CN119179585A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a cross-device communication method, apparatus, device, system and storage medium. Background Art
[0002] At present, different functional modules of the same application or different applications communicate on the same device using an inter-process communication method (such as a Qt tunnel communication method). For applications on different devices, it is necessary to propose a cross-device communication method to meet the demand for communication between applications on different devices. Summary of the invention
[0003] In order to solve the above technical problems, the present disclosure provides a cross-device communication method, apparatus, device, system and storage medium.
[0004] In a first aspect, the present disclosure provides a cross-device communication method, which is applied to a first device among multiple devices, and the method includes:
[0005] Sending a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0006] Receiving a sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device, and the at least one second proxy server;
[0007] Based on the sniffing result, establishing communication with the first proxy server and establishing communication with the at least one second proxy server through the first proxy server;
[0008] A first application message of the installed first application is sent to the first proxy server, so that the first proxy server sends the first application message to the second application of the at least one second device through the at least one second proxy server.
[0009] In a second aspect, the present disclosure provides an apparatus for cross-device communication, configured in a first device among multiple devices, the apparatus comprising:
[0010] a sniffing message sending module, configured to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0011] A sniffing result receiving module, used to receive the sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device and the at least one second proxy server;
[0012] a communication establishing module, configured to establish communication with the first proxy server and establish communication with the at least one second proxy server through the first proxy server based on the sniffing result;
[0013] The application message sending module is used to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of the at least one second device through the at least one second proxy server.
[0014] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the device comprising:
[0015] one or more processors;
[0016] a storage device for storing one or more programs,
[0017] When one or more programs are executed by one or more processors, the one or more processors implement the method provided in the first aspect.
[0018] In a fourth aspect, an embodiment of the present disclosure further provides a cross-device communication system, comprising: a first device, at least one second device, a first proxy server local to the first device, and at least one second proxy server local to at least one second device;
[0019] The first device is used to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0020] The first device is used to receive the sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device and the at least one second proxy server;
[0021] The first device is configured to establish communication with the first proxy server based on the sniffing result and to establish communication with the at least one second proxy server through the first proxy server;
[0022] The first device is used to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of the at least one second device through the at least one second proxy server.
[0023] In a fifth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the method provided in the first aspect when the computer program is executed by a processor.
[0024] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0025] A cross-device communication method, apparatus, device, system and storage medium of the disclosed embodiment are applied to a first device among multiple devices, and the method includes: sending a sniffing message to a first proxy server local to the first device, at least one second device and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or not the same proxy server; receiving the sniffing results corresponding to the sniffing messages returned by the first proxy server, at least one second device and at least one second proxy server; establishing communication with the first proxy server and establishing communication with at least one second proxy server through the first proxy server based on the sniffing results; sending a first application message of an installed first application to the first proxy server, so that the first proxy server sends the first application message to the second application of at least one second device through at least one second proxy server. In the above manner, for applications on different devices, one of the devices can automatically establish communication with other devices through sniffing, and communication between applications on different devices can be realized without the user manually deploying communication links between different devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0028] Figure 1 A schematic diagram of the principle of building a cross-device communication system provided by an embodiment of the present disclosure;
[0029] Figure 2A system architecture diagram of a cross-device communication system provided by an embodiment of the present disclosure;
[0030] Figure 3 A schematic diagram of a flow chart of a cross-device communication method provided by an embodiment of the present disclosure;
[0031] Figure 4 A system architecture diagram of another cross-device communication system provided by an embodiment of the present disclosure;
[0032] Figure 5 A schematic diagram of the structure of a cross-device communication apparatus provided in an embodiment of the present disclosure;
[0033] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0034] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0035] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0036] In the prior art, when different applications in the same device or different functional modules of an application communicate, an inter-process communication method (such as Qt tunnel communication method) is used to send commands, and the commands are transmitted point-to-point to achieve communication between applications in the same device.
[0037] When applications on different devices need to communicate, the above inter-process application method cannot be directly applied to the cross-device communication scenario. Therefore, in the face of the cross-device communication scenario, it is necessary to provide a communication method that is applicable to realize the communication between applications on different devices.
[0038] In the context of cross-device communication, an embodiment of the present disclosure provides a cross-device communication system. The cross-device communication system may include: a first device, at least one second device, a first proxy server local to the first device, and at least one second proxy server local to at least one second device;
[0039] The first device is configured to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to the at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0040] The first device is used to receive a sniffing result corresponding to the sniffing message returned by the first proxy server, at least one second device, and at least one second proxy server;
[0041] The first device is used to establish communication with the first proxy server based on the sniffing result and to establish communication with at least one second proxy server through the first proxy server;
[0042] The first device is used to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of at least one second device through at least one second proxy server.
[0043] For ease of understanding, the construction principle of the above cross-device communication system is explained by taking the number of the second device and the second server as 2 as an example. Figure 1 As shown in the schematic diagram of the principle of building a cross-device communication system, first, the first device 100 sends a sniffing message to the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600, then the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600 respectively feedback the sniffing results to the first device 100 based on the sniffing information. At the same time, any two of the first proxy server 200, the second proxy server A400 and the second proxy server B600 can also transmit the sniffing message.
[0044] Then, the first device 100 establishes communication with the first proxy server 200 based on the received sniffing result, and the first device 100 establishes communication with the second proxy server A400 and the second proxy server B600 through the first proxy server 200. At the same time, the second device A300 and the second device B500 can also send sniffing messages and receive the returned sniffing results. Then, the second device A300 establishes communication with the second proxy server A400 based on the sniffing result, and the second device B500 establishes communication with the second proxy server B600 based on the sniffing result ( Figure 1 Not shown), so that it can form Figure 2 The cross-device communication system shown.
[0045] based on Figure 2In the cross-device communication system shown, the first device 100 sends the first application message of the first application to the first proxy server 200, so that the first proxy server 200 sends the first application message to the second application of the second device A300 through the second proxy server A400. At the same time, the first proxy server 200 can also send the first application message to the second application of the second device B500 through the second proxy server B600.
[0046] Optionally, the first proxy server 200, the second proxy server A400, and the second proxy server B600 may be the same proxy server or different proxy servers.
[0047] As a result, multiple devices can automatically build a cross-device communication system through sniffing, without the need for users to manually deploy communication links between different devices, so as to enable communication between applications on different devices in the cross-device communication system.
[0048] Embodiments of the present disclosure provide a cross-device communication method, apparatus, device, system, and storage medium.
[0049] Combine the following Figure 3-Figure 4 The cross-device communication method provided by the embodiment of the present disclosure is described. In the embodiment of the present disclosure, the cross-device communication method can be executed by a first device among multiple devices. The first device may include a device with communication functions such as a tablet computer, a desktop computer, a laptop computer, etc., and may also include a device simulated by a virtual machine or a simulator.
[0050] Figure 3 A flow chart of a cross-device communication method provided by an embodiment of the present disclosure is shown.
[0051] like Figure 3 As shown, the cross-device communication method may include the following steps.
[0052] S310: Send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to the at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server.
[0053] In this embodiment, when it is necessary to communicate between applications on different devices in the same local area network or different local area networks, any one of the multiple devices serves as the first device, and the remaining devices serve as the second devices, respectively. The local proxy server of the first device serves as the first proxy server, and the local proxy server of the second device serves as the second proxy server, and the first proxy server and the second proxy server can be the same proxy server or different proxy servers.
[0054] Continue to see Figure 1 , the first device 100 pre-configures the communication library of each application, and the communication library includes a sniffing component. The first device 100 sends a sniffing message to the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600 respectively through the sniffing component, so that the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600 respond to the sniffing message.
[0055] Similarly, for the second device A300, the communication library of each application is also pre-configured, and the communication library also includes a sniffing component. The second device A300 sends a sniffing message to the second proxy server A400, the second device B500, the second proxy server B600, the first proxy server 200 and the first device 100 respectively through the sniffing component, so that the second proxy server A400, the second device B500, the second proxy server B600, the first proxy server 200 and the first device 100 respond to the sniffing message.
[0056] Similarly, for the second device B500, the communication library of each application is also pre-configured, and the communication library also includes a sniffing component. The second device B500 sends a sniffing message to the second proxy server B600, the second device A300, the second proxy server A400, the first proxy server 200 and the first device 100 respectively through the sniffing component, so that the second proxy server B600, the second device A300, the second proxy server A400, the first proxy server 200 and the first device 100 respond to the sniffing message.
[0057] Typically, the sniffing component can send sniffing messages in broadcast mode, multicast mode, direct mode or promiscuous mode. In this embodiment, any one of the multiple devices can send sniffing information in multicast mode, that is, the sniffing information is a multicast information, and the communication library of each application, the first proxy server and at least one second proxy server are in the same multicast group, then the first device can transmit the sniffing information based on the User Datagram Protocol (UDP, User DatagramProtocol).
[0058] Each of the multiple devices may run multiple applications, the application programs on different devices may be the same or different, and each application may include multiple functional modules.
[0059] S320: Receive sniffing results corresponding to the sniffing messages returned by the first proxy server, at least one second device, and at least one second proxy server.
[0060] Continue to see Figure 1 , the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600 can all respond to the sniffing message based on their own relevant information to determine the sniffing result, and then the first proxy server 200, the second device A300, the second proxy server A400, the second device B500 and the second proxy server B600 feed back the sniffing result to the first device 100 through the original path, and the first device 100 can end the sniffing.
[0061] Similarly, for the sniffing message sent by the second device A300, the second proxy server A400, the second device B500, the second proxy server A400, the first proxy server 200 and the first device 100 can also respond to the sniffing message based on their own relevant information to determine the sniffing result. Then, the second proxy server A400, the second device B500, the second proxy server A400, the first proxy server 200 and the first device 100 feed back the sniffing result to the second device A300 through the original path, and the second device A300 can end the sniffing.
[0062] Similarly, for the sniffing message sent by the second device B500, the second proxy server B600, the second device A300, the second proxy server A400, the first proxy server 200 and the first device 100 can also respond to the sniffing message based on their own relevant information to determine the sniffing result. Then, the second proxy server B600, the second device A300, the second proxy server A400, the first proxy server 200 and the first device 100 feed back the sniffing result to the second device B500 through the original path, and the second device B500 can end the sniffing.
[0063] S330: Based on the sniffing result, establish communication with the first proxy server and establish communication with at least one second proxy server through the first proxy server.
[0064] Continue to see Figure 1 The first device 100 identifies key information for establishing communication from the sniffing result, and establishes communication with the first proxy server 200 based on the key information, and establishes communication with the second proxy server 400A and the second proxy server 600B through the first proxy server 200.
[0065] Similarly, after the second device A300 sends a sniffing message and receives the sniffing result, the second device A300 identifies the key information used to establish communication from the sniffing result, and establishes communication with the second proxy server A400 based on the key information, and establishes communication with the first proxy server 200 and the first device 100 through the second proxy server A400.
[0066] Similarly, after the second device B500 sends a sniffing message and receives the sniffing result, the second device B500 identifies the key information used to establish communication from the sniffing result, and establishes communication with the second proxy server B600 based on the key information, and establishes communication with the first proxy server 200 and the first device 100 through the second proxy server B600.
[0067] In this embodiment, optionally, the first device corresponds to the first identification information, and the sniffing result includes the first service address of the first proxy server, at least one second proxy server corresponds to the second proxy server address, and at least one second device corresponds to the second identification information; accordingly, S330 specifically includes: establishing communication with the first proxy server based on the first service address and the first identification information; establishing communication with at least one second proxy server through the first proxy server based on the first service address, the first identification information, at least one second proxy server address and at least one second identification information.
[0068] The first service address and the second proxy server address can both be understood as Internet Protocol Addresses (IP addresses).
[0069] The first identification information and the second identification information can both be understood as Media Access Control Address (MAC address).
[0070] Specifically, the first device uses the Message Queuing Telemetry Transport (MQTT protocol) and utilizes a preset key to authenticate the obtained IP address and MAC address. If the authentication process passes, communication with the first proxy server is established, and communication with at least one second proxy server is established through the first proxy server, thereby building a cross-device communication system.
[0071] Therefore, any one of the multiple devices can obtain the IP address and MAC address by sending sniffing messages, so as to automatically build a cross-device communication system based on the IP address and MAC address, without the need for manual deployment by the user, thereby improving the degree of automation of network construction.
[0072] S340: Send a first application message of the installed first application to the first proxy server, so that the first proxy server sends the first application message to a second application of at least one second device through at least one second proxy server.
[0073] In this embodiment, continue to see Figure 2 The communication library pre-configured in the first device 100 may also include a message communication component. The first device 100 uses the message communication component to send the first application message of the first application to the first proxy server 200. The first proxy server 200 sends the first application message to the second application of the second device A300 through the second proxy server A400, and the first proxy server 200 sends the first application message to the second application of the second device B500 through the second proxy server B600.
[0074] Similarly, the communication library pre-configured in the second device A300 may also include a message communication component. The second device A300 uses the message communication component to send the second application message of the second application to the second proxy server A400, and the second proxy server A400 sends the second application message to the first application of the first device 100 through the first proxy server 200, and the second proxy server A400 sends the second application message to the second application of the second device B500 through the second proxy server B600.
[0075] Similarly, the communication library pre-configured in the second device B500 may also include a message communication component. The second device B500 uses the message communication component to send the second application message of the second application to the second proxy server B600, and the second proxy server B600 sends the second application message to the first application of the first device 100 through the first proxy server 200, and the second proxy server B600 sends the second application message to the second application of the second device A300 through the second proxy server A400.
[0076] Similarly, the second device A300 and the second device B500 may also utilize the message communication component and transmit the second application message of the second application through the second proxy server A400 and the second proxy server B600.
[0077] Optionally, the message communication component can transmit messages in any of the request response mode (Request / Reply), broadcast subscription mode (Publish / Subscribe) and callback response mode (Map / Callback).
[0078] For example, oral scanning software is run on both the first device and the second device. The oral scanning software includes a scanning service module, an algorithm module, and an authorization module. After this embodiment uses a sniffing method to establish a cross-device communication system, the first device and the second system use the communication system to transmit messages to the same module or different modules in the oral scanning software.
[0079] Thus, one of the multiple devices builds a cross-device communication system by sniffing, so that application messages of any device are sent to other devices based on the communication system, so as to realize communication between application programs on different devices.
[0080] A cross-device communication method of an embodiment of the present disclosure is applied to a first device among multiple devices, and the method includes: sending a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or not the same proxy server; receiving the sniffing results corresponding to the sniffing messages returned by the first proxy server, at least one second device, and at least one second proxy server; based on the sniffing results, establishing communication with the first proxy server and establishing communication with at least one second proxy server through the first proxy server; sending a first application message of an installed first application to the first proxy server, so that the first proxy server sends the first application message to the second application of at least one second device through at least one second proxy server. In the above manner, for applications on different devices, one of the devices can automatically establish communication with other devices by sniffing, and communication between applications on different devices can be achieved without the user manually deploying communication links between different devices.
[0081] In this embodiment, after executing S330, the method may further include: sending first successful connection information or first offline information to the first proxy server, so that the first proxy server sends the first successful connection information to at least one second device through at least one second proxy server; and / or, receiving, through the first proxy server, second successful connection information or second offline information respectively fed back by at least one proxy server.
[0082] The first successful connection information is used to indicate that the first device has successfully established a connection with the first proxy server, and the second successful connection information is used to indicate that at least one second device has successfully established a connection with its corresponding second proxy server.
[0083] The first disconnection information is used to indicate that the first proxy server and the first device are disconnected.
[0084] The second disconnection information is used to indicate that at least one second device and its corresponding second proxy server are disconnected.
[0085] It should be noted that when any one of the multiple devices is disconnected from its corresponding proxy server, in addition to sending a disconnection message, a pre-configured exception handling mechanism can also be triggered to re-establish the connection between the device and its corresponding proxy server based on the IP address of the proxy server and the MAC address of the device.
[0086] Therefore, after the cross-device communication system is successfully assembled, different devices can transmit successful connection information or offline information. While transmitting offline information, any one of the multiple devices can also trigger the exception handling mechanism to re-establish the connection to achieve continuous cross-device communication.
[0087] In another embodiment of the present disclosure, after the first device establishes communication with the first proxy server and establishes communication with at least one second proxy server through the first proxy server, that is, after networking of the cross-device communication system is established, the first device and at least one second device transmit messages to each other. In addition, two applications can also directly transmit files using a network data transmission component or a shared memory component without the need for a proxy server.
[0088] In some embodiments of the present disclosure, the first application message includes at least one of the following: a first service call request of the first application, and first function description information of the first application.
[0089] The first service call request refers to request information of the first device requesting to call at least one second device to process a task.
[0090] The first function description information is used to characterize the performance of the first device in processing tasks. Optionally, the first function description information may carry service information of all services in the first device, location information of the first device, service priority of the first device, and other information.
[0091] In some embodiments, the first application message is a first service call request. Accordingly, before executing S340, the method further includes:
[0092] S331. Receive a second application message of at least one second application fed back by at least one second proxy server;
[0093] S332: Based on the second function description information in the second application message, determine a target processing device for executing the first service call request from at least one second device, and determine a second target application for executing the first service call request from at least one second application of the target processing device;
[0094] Accordingly, S340 specifically includes:
[0095] S341. Send a first service call request to a first proxy server, so that the first proxy server sends the first service call request to a second target application of the target processing device through a second proxy server corresponding to the target processing device.
[0096] The second application message includes at least one of the following: a second service call request of the second application and second function description information of the second application.
[0097] Optionally, the first application message includes identification information of the first device.
[0098] The first service call request refers to request information of the first device requesting to call at least one second device to process a task.
[0099] The second function description information is used to characterize the performance of the second device in processing tasks. Optionally, the second function description information may carry service information of all services in the second device, location information of the second device, service priority of the second device, and other information.
[0100] Optionally, the first device may use the MQTT protocol to receive the second application message fed back by the first device, and the first device may also use the MQTT protocol to send the first service call request to the first proxy server. Similarly, the second device may also use the MQTT protocol to receive the first service call request sent by its corresponding second proxy server.
[0101] In one case, S332 specifically includes: based on the service information of each service carried by the second function description information, selecting a second device with the largest total idle services from at least one second device as the target processing device, and using the second application with the largest number of idle services in the target processing device as the second target application.
[0102] In another case, S332 specifically includes: based on the location information of the second device carried by the second function description information, selecting a second device that is closest to the first device from at least one second device as the target processing device, and randomly selecting a second application containing an idle service from the target processing device as the second target application.
[0103] In another case, S332 specifically includes: based on the service priority and other information carried by the second function description information, selecting a second device with the highest service priority from at least one second device as the target processing device, and randomly selecting a second application containing an idle service from the target processing device as the second target application.
[0104] In other cases, S332 can also determine the target processing device based on at least two of the service information of all services in the second device, the location information of the second device, the service priority of the second device, etc., and randomly select a second application containing idle services as the second target application.
[0105] Therefore, after the first device obtains the second function description information sent by at least one second device, the first device can select the optimal device as the target processing device based on the second function description information, so as to use the target processing device to perform the task, which is conducive to reducing the time consumed in the task execution process.
[0106] Further, after executing S341, the method further includes:
[0107] S350. Receive a first service call response result fed back by the target processing device through the second proxy server and the first proxy server corresponding to the target processing device, wherein the first service call response result is determined after the second target application in the target processing device responds to the first service call request.
[0108] For ease of understanding, based on Figure 4 In the cross-device communication system shown, first, if the first device 100 receives second application messages corresponding to the second application 1, the second application 2, the second application 3, and the second application 4 respectively sent by the second proxy server A400 and the second proxy server B600, the first device 100 determines the target processing device for executing the first service call request from the second proxy server A400 and the second proxy server B600 based on the second function description information in the second application message. If the target processing device is determined to be the second device A300, and the second application 1 is determined to be the second target application from the second device A300, the first device 100 100 sends the first service call request to the first proxy server 200, so that the first proxy server 200 sends the first server request to the second target application (i.e., second application 1) of the target processing device (i.e., second device A300) through the second proxy server A400 corresponding to the target processing device (i.e., second device A300). Then, the second target application (i.e., second application 1) responds to the first service call request. Finally, the target processing device feeds back the first service call response result to the first device 100 through the second proxy server A400 corresponding to the target processing device and the first proxy server 200.
[0109] Optionally, the first service call response result may also be transmitted based on the MQTT protocol.
[0110] As a result, the first device and at least one second device can transmit the second function description information in the second application message and the first service call request in the first application message, as well as transmit the first service call response result, thereby improving the data transmission efficiency between different devices and, at the same time, realizing the management of the data communication process according to the identification information.
[0111] In some other embodiments, the first application message is a first service call request. Accordingly, while executing S340, the method further includes:
[0112] S360: Send the first service call request to the first proxy server, so that the first proxy server forwards the first service call request to the third application in the first device, and enables the third application in the first device to respond to the first service call request to obtain a service call response result;
[0113] S370. Receive, through the first proxy server, a service call response result fed back by the third application.
[0114] For ease of understanding, based on Figure 4 In the cross-device communication system shown, first, the first application in the first device 100 sends a first service call request to the first proxy server 200, so that the first proxy server 200 forwards the first service call request to the third application in the first device 100, and makes the third application in the first device 100 respond to the first service call request to obtain a service call response result, and then, the service call response result fed back by the third application is received through the first proxy server 200.
[0115] Optionally, the first service call request and the service call response result may also be transmitted based on the MQTT protocol.
[0116] Therefore, when two different applications in the same device perform data transmission, they can communicate through the local proxy server to achieve effective communication between different applications in the same device.
[0117] It can be seen that when communicating using the constructed cross-device system, the first device can adaptively select a suitable data transmission method to improve data transmission efficiency.
[0118] In some further embodiments, the first application message is first function description information, and accordingly, S340 specifically includes:
[0119] S341. Send the first function description information to the first proxy server, so that the first proxy server sends the first function description information to the second application of at least one second device through at least one second proxy server;
[0120] After executing S341, the method further includes:
[0121] S380: If at least one second device determines to use the first device as the target processing device based on the first function description information, respond to the second service call request and obtain a second service call response result;
[0122] S390. Feedback the second service call response result to the second application of the at least one second device through the first proxy server and the at least one second proxy server.
[0123] Optionally, the second application message includes identification information of the second device.
[0124] For ease of understanding, based on Figure 4 In the cross-device communication system shown in the figure, first, the first device 100 sends the first function description information to the first proxy server 200, so that the first proxy server 200 sends the first function description information to the second application 1 and the second application 2 of the second device A300 through the second proxy server A400, and the first proxy server 200 sends the first function description information to the second application 3 and the second application 4 of the second device B500 through the second proxy server B600; then, the second application 1, the second application 2 in the second device A300 and the second application 3, the second application 4 in the second device B500 respectively determine whether to use the first device 100 as the target based on the first function description information. processing device; then, if the second application 1 in the second device 300 determines to use the first device 100 as the target processing device, the second application 1 in the second device A300 sends a second application message to the target processing device (i.e., the first device 100) through the second proxy server A400 and the first proxy server 200, and the second application message includes a second service call request of the second application 1 in the second device A300; finally, the target processing device (i.e., the first device 100) responds to the second service call request, obtains a second service call response result, and feeds back the second service call response result to the second application 1 of the second device A300 through the first proxy server 200 and the second proxy server A400.
[0125] It is understandable that, for each second device, it is possible to decide whether to use the first device as the target processing device based on one or more of the service information of all services carried by the first function description information, the location information of the first device carried by the first function description information, the service priority carried by the first function description information, etc. It should be noted that the specific manner in which each second device decides whether to use the first device as the target processing device can be referred to the above embodiment, and will not be described in detail here.
[0126] Therefore, after at least one second device obtains the first function description information sent by the first device, at least one second device can decide whether to use it as the target processing device based on the first function description information, so as to use the target processing device to perform tasks, which is conducive to reducing the time consumed in the task execution process, and at the same time, realizes the management of the data communication process according to the identification information.
[0127] In other embodiments of the present disclosure, two applications in the same device or different devices can also directly transfer files using a network data transmission component or a shared memory component without a proxy server. Then, after S330, the method further includes: sending a first application file of the first application to a second application of at least one second device through the network data transmission component; and / or sending the first application file of the first application to a third application of the first device through the shared memory component.
[0128] The network data transmission component and the shared memory component are pre-configured in the communication library in the first device. The network transmission component has the function of transmitting data point-to-point, and the shared memory component has the function of managing shared memory and providing a shared memory transmission method. Figure 4 , the first device 100 sends the first application file of the first application to the second application 1 or the second application 2 of the second device A300 through the network data transmission component, or the first device 100 sends the first application file of the first application to the second application 3 or the second application 4 of the second device B500 through the network data transmission component. At the same time, the first device 100 also sends the first application file of the first application to the third application of the first device 100 through the shared memory component.
[0129] Similarly, the second device A300 sends the second application file of the second application 1 or the second application 2 to the first application or the third application of the first device 100 through the network data transmission component, or the second device A300 sends the second application file of the second application 1 or the second application 2 to the second application 3 or the second application 4 of the second device B500 through the network data transmission component. At the same time, the second device A300 also sends the second application file of the second application 1 to the second application 2 of the second device A300 through the shared memory component.
[0130] Similarly, the second device B500 sends the second application file of the second application 3 or the second application 4 to the first application or the third application of the first device 100 through the network data transmission component, or the second device B500 sends the second application file of the second application 3 or the second application 4 to the second application 1 or the second application 2 of the second device A300 through the network data transmission component. At the same time, the second device B500 also sends the second application file of the second application 3 to the second application 4 of the second device B500 through the shared memory component.
[0131] Therefore, after establishing a cross-device communication system, any two applications can directly transfer files without relying on a proxy server, thereby improving the efficiency of file transfer between different applications.
[0132] The present disclosure also provides a cross-device communication apparatus for implementing the above-mentioned cross-device communication method. Figure 5 In the embodiment of the present disclosure, the cross-device communication apparatus is configured in a first device among multiple devices. The first device may include a device with communication functions such as a tablet computer, a desktop computer, a laptop computer, etc., and may also include a device simulated by a virtual machine or a simulator.
[0133] Figure 5 A schematic structural diagram of a cross-device communication apparatus provided by an embodiment of the present disclosure is shown.
[0134] like Figure 5 As shown, the cross-device communication apparatus 500 may include:
[0135] a sniffing message sending module 510, configured to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0136] The sniffing result receiving module 520 is used to receive the sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device and the at least one second proxy server;
[0137] A communication establishing module 530, configured to establish communication with the first proxy server and establish communication with the at least one second proxy server through the first proxy server based on the sniffing result;
[0138] The application message sending module 540 is configured to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of the at least one second device through the at least one second proxy server.
[0139] A cross-device communication device according to an embodiment of the present disclosure is configured in a first device among multiple devices, and the device includes: sending a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or not the same proxy server; receiving the sniffing results corresponding to the sniffing messages returned by the first proxy server, at least one second device, and at least one second proxy server; establishing communication with the first proxy server and establishing communication with at least one second proxy server through the first proxy server based on the sniffing results; sending a first application message of an installed first application to the first proxy server, so that the first proxy server sends the first application message to the second application of at least one second device through at least one second proxy server. In the above manner, for applications on different devices, one of the devices can automatically establish communication with other devices by sniffing, and communication between applications on different devices can be achieved without the user manually deploying communication links between different devices.
[0140] In some embodiments of the present disclosure, the first device corresponds to first identification information, the sniffing result includes a first service address of the first proxy server, the at least one second proxy server corresponds to a second proxy server address, and the at least one second device corresponds to second identification information;
[0141] Accordingly, the communication establishment module 530 includes:
[0142] A first establishing unit, configured to establish communication with the first proxy server based on the first service address and the first identification information;
[0143] The second establishing unit is configured to establish communication with the at least one second proxy server through the first proxy server based on the first service address, the first identification information, at least one second proxy server address and at least one second identification information.
[0144] In some embodiments of the present disclosure, the first application message includes at least one of the following: a first service call request of the first application, and first function description information of the first application.
[0145] In some embodiments of the present disclosure, the first application message is the first service invocation request, and the apparatus further includes:
[0146] A first receiving module, configured to receive a second application message of at least one second application fed back by the at least one second proxy server;
[0147] a device determining module, configured to determine, based on the second function description information in the second application message, a target processing device for executing the first service call request from the at least one second device, and determine a second target application for executing the first service call request from the at least one second application of the target processing device;
[0148] Accordingly, the application message sending module 540 is specifically used for:
[0149] The first service call request is sent to the first proxy server, so that the first proxy server sends the first service call request to the second target application of the target processing device through a second proxy server corresponding to the target processing device.
[0150] In some embodiments of the present disclosure, the first application message is the first function description information;
[0151] The second receiving module is used to send the first function description information to the first proxy server, so that the first proxy server sends the first function description information to the second application of the at least one second device through the at least one second proxy server.
[0152] In some embodiments of the present disclosure, the device further includes:
[0153] a response module, configured to respond to the second service call request and obtain a second service call response result if the at least one second device determines to use the first device as a target processing device based on the first functional description information;
[0154] A feedback module is used to feed back the second service call response result to the second application of the at least one second device through the first proxy server and the at least one second proxy server.
[0155] In some embodiments of the present disclosure, the device further includes:
[0156] A first sending module is configured to send a first application file of a first application to a second application of the at least one second device through a network data transmission component; and / or,
[0157] The second sending module is used to send the first application file of the first application to the third application of the first device through the shared memory component.
[0158] It should be noted that Figure 5 The cross-device communication apparatus 500 shown can perform Figure 3-Figure 4 The various steps in the method embodiment shown in the figure are implemented Figure 3-Figure 4 The various processes and effects in the method embodiment shown are not described in detail here.
[0159] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. Figure 6 The electronic device may be any one of a plurality of devices.
[0160] like Figure 6 As shown, the electronic device may include a processor 601 and a memory 602 storing computer program instructions.
[0161] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0162] The memory 602 may include a large capacity memory for information or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 602 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 602 may be inside or outside the integrated gateway device. In a particular embodiment, the memory 602 is a non-volatile solid-state memory. In a particular embodiment, the memory 602 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (Electrically Erasable Programmable ROM, EEPROM), an electrically rewritable ROM (EAROM) or a flash memory, or a combination of two or more of these.
[0163] The processor 601 reads and executes the computer program instructions stored in the memory 602 to perform the steps of the cross-device communication method provided in the embodiment of the present disclosure.
[0164] In one example, the electronic device may further include a transceiver 603 and a bus 604. Figure 6 As shown, the processor 601, the memory 602 and the transceiver 603 are connected via a bus 604 and communicate with each other.
[0165] The bus 604 includes hardware, software, or both. For example, but not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, the bus 604 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0166] The following is an embodiment of a computer-readable storage medium provided in an embodiment of the present disclosure. The computer-readable storage medium and the cross-device communication method of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the computer-readable storage medium, reference can be made to the embodiment of the above-mentioned cross-device communication method.
[0167] This embodiment provides a storage medium containing computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to execute a cross-device communication method, which is applied to a first device among multiple devices. The method includes:
[0168] Sending a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server;
[0169] Receiving a sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device, and the at least one second proxy server;
[0170] Based on the sniffing result, establishing communication with the first proxy server and establishing communication with the at least one second proxy server through the first proxy server;
[0171] A first application message of the installed first application is sent to the first proxy server, so that the first proxy server sends the first application message to the second application of the at least one second device through the at least one second proxy server.
[0172] Of course, the storage medium containing computer executable instructions provided by the embodiment of the present disclosure, whose computer executable instructions are not limited to the above method operations, can also execute related operations in the cross-device communication method provided by any embodiment of the present disclosure.
[0173] Through the above description of the implementation methods, the technical personnel in the relevant field can clearly understand that the present disclosure can be implemented with the help of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer cloud platform (which can be a personal computer, a server, or a network cloud platform, etc.) to execute the cross-device communication method provided by each embodiment of the present disclosure.
[0174] Note that the above are only preferred embodiments of the present disclosure and the technical principles used. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present disclosure. Therefore, although the present disclosure is described in more detail through the above embodiments, the present disclosure is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present disclosure, and the scope of the present disclosure is determined by the scope of the appended claims.
Claims
1. A cross-device communication method, characterized in that: A first device applied to multiple devices includes: Sending a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server; Receiving a sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device, and the at least one second proxy server; Based on the sniffing result, establishing communication with the first proxy server and establishing communication with the at least one second proxy server through the first proxy server; A first application message of the installed first application is sent to the first proxy server, so that the first proxy server sends the first application message to the second application of the at least one second device through the at least one second proxy server.
2. The method according to claim 1, characterized in that The first device corresponds to the first identification information, the sniffing result includes the first service address of the first proxy server, the at least one second proxy server corresponds to the second proxy server address, and the at least one second device corresponds to the second identification information; Correspondingly, establishing communication with the first proxy server based on the sniffing result and establishing communication with the at least one second proxy server through the first proxy server includes: Establishing communication with the first proxy server based on the first service address and the first identification information; Based on the first service address, the first identification information, at least one second proxy server address and at least one second identification information, communication is established between the first proxy server and the at least one second proxy server.
3. The method according to claim 1, characterized in that The first application information includes at least one of the following: a first service call request of the first application and first function description information of the first application.
4. The method according to claim 3, characterized in that The first application message is the first service invocation request, and the method further includes: receiving a second application message of at least one second application fed back by the at least one second proxy server; Based on the second function description information in the second application message, determine a target processing device for executing the first service call request from the at least one second device, and determine a second target application for executing the first service call request from the at least one second application of the target processing device; Correspondingly, sending the first application message of the first application to the first proxy server, so that the first proxy server sends the first application message to the second application of the at least one second device through the at least one second proxy server, includes: The first service call request is sent to the first proxy server, so that the first proxy server sends the first service call request to the second target application of the target processing device through a second proxy server corresponding to the target processing device.
5. The method according to claim 3, characterized in that: The first application message is the first function description information; Correspondingly, sending the first application message of the first application to the first proxy server, so that the first proxy server sends the first application message to the second application of the at least one second device through the at least one second proxy server, includes: The first function description information is sent to the first proxy server, so that the first proxy server sends the first function description information to the second application of the at least one second device through the at least one second proxy server.
6. The method according to claim 5, characterized in that Also includes: If the at least one second device determines to use the first device as a target processing device based on the first functional description information, responding to the second service call request to obtain a second service call response result; The second service call response result is fed back to the second application of the at least one second device through the first proxy server and the at least one second proxy server.
7. The method according to claim 1, characterized in that Also includes: Sending a first application file of the first application to a second application of the at least one second device through a network data transmission component; and / or, The first application file of the first application is sent to the third application of the first device through the shared memory component.
8. A cross-device communication device, characterized in that: A first device configured in a plurality of devices, the apparatus comprising: a sniffing message sending module, configured to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server; A sniffing result receiving module, used to receive the sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device and the at least one second proxy server; a communication establishing module, configured to establish communication with the first proxy server and establish communication with the at least one second proxy server through the first proxy server based on the sniffing result; The application message sending module is used to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of the at least one second device through the at least one second proxy server.
9. An electronic device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the method described in any one of claims 1 to 7.
10. A cross-device communication system, characterized in that: include: a first device, at least one second device, a first proxy server local to the first device, and at least one second proxy server local to at least one second device; The first device is used to send a sniffing message to a first proxy server local to the first device, at least one second device, and at least one second proxy server local to at least one second device, wherein the first proxy server and the second proxy server are the same proxy server or are not the same proxy server; The first device is used to receive the sniffing result corresponding to the sniffing message returned by the first proxy server, the at least one second device and the at least one second proxy server; The first device is configured to establish communication with the first proxy server based on the sniffing result and to establish communication with the at least one second proxy server through the first proxy server; The first device is used to send a first application message of an installed first application to a first proxy server, so that the first proxy server sends the first application message to a second application of the at least one second device through the at least one second proxy server.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the method according to any one of claims 1 to 7.
