Method and device for transmitting data between devices

By selecting the transmission method based on the network connection information between devices and adopting the Token encryption mechanism, the problem of slow file transfer speed and interruption between devices is solved, and efficient and secure data transmission and breakpoint retransmission are achieved.

CN114039735BActive Publication Date: 2024-12-31GUANGZHOU KINGSOFT MOBILE TECH +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111389721.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-19
Publication Date
2024-12-31
Estimated Expiration
2041-11-19

AI Technical Summary

Technical Problem

The existing file transfer method between devices is slow, time-consuming and inefficient, and needs to be retransmitted during the transmission process, which affects efficiency.

Method used

Determine the target transmission method based on the network connection information between devices, select point-to-point transmission within the same domain or transit through the server, use the Token mechanism to encrypt the data, and perform breakpoint transmission during the transmission interruption.

Benefits of technology

It improves the efficiency of data transmission between devices, ensures the security of the transmission process, and does not need to repeatedly transmit some completed data after interruption, significantly improving the transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114039735B_ABST
    Figure CN114039735B_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for transmitting data between devices, the method comprising: determining a second device for receiving first target data; determining a target transmission mode according to network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission mode; wherein the first device is a device for authentication based on a first account, and the second device is a device for authentication based on a second account; the first account and the second account are associated accounts. The present application provides a method and apparatus for transmitting data between devices, for improving the efficiency of data transmission between devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data transmission between devices, and in particular to a method and apparatus for transmitting data between devices. Background Art

[0002] With the progress of society and the development of technology, more and more users are using multiple terminal devices to access the Internet, and there is an increasing demand for data sharing functions between devices, especially file transfer between different devices.

[0003] In the related art, when users need to transfer files between different devices, they usually do so through portable hard disks or Bluetooth. The speed of file transfer using hard disks is greatly affected by hardware devices. When using Bluetooth or other methods to transfer files, the transfer speed is slow, the time consumption is long, the transfer efficiency is low, and the transfer process cannot be interrupted, otherwise the transfer needs to be repeated. Summary of the invention

[0004] The purpose of this application is to provide a method and apparatus for transmitting data between devices, so as to improve the efficiency of data transmission between devices.

[0005] The present application provides a method for transmitting data between devices, including:

[0006] Determine a second device for receiving first target data; determine a target transmission method based on network connection information between the first device and the second device, and transmit the first target data to the second device through the target transmission method; wherein the first device is a device that performs authentication based on a first account, and the second device is a device that performs authentication based on a second account; and the first account and the second account are associated accounts.

[0007] Optionally, determining the target transmission mode based on the network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission mode, includes: when the network connection information indicates that the second device and the first device are in the same network domain, establishing a first communication connection with the second device, and transmitting the first target data to the second device through the first communication connection; the first communication connection is a network connection in a network domain environment; otherwise, the first device transmits the first target data to the second device through a second communication connection established with a server.

[0008] Optionally, before determining the second device for receiving the first target data, the method also includes: after the first device successfully authenticates the server through the first account, establishing the second communication connection with the server; wherein the second communication connection is used for data transmission with the server.

[0009] Optionally, determining the second device for receiving the first target data includes: obtaining a list of devices that have logged into the second account from the server; and determining the second device for receiving the first target data from the device list.

[0010] Optionally, it is characterized in that when the network connection information indicates that the second device and the first device are in the same network domain, a first communication connection with the second device is established, including: obtaining a first network parameter of the network domain in which the second device is located; based on the first network parameter, judging the network connection status with the second device in the network domain environment in which the first device is located; and when there is a network access between the first device and the second device in the network domain environment, establishing a first communication connection with the second device.

[0011] Optionally, after establishing the second communication connection with the server, the method further includes: sending a first target information acquisition request to the server based on the first account; wherein the first target information acquisition request is used to obtain a first Token and a first encryption key corresponding to the first Token; the first encryption key is used to encrypt the first target data during data transmission.

[0012] Optionally, before transmitting the first target data to the second device via the target transmission mode, the method also includes: sending the first Token to the second device, so that the second device obtains the first encryption key from the server based on the first Token, and decrypts the encrypted first target data according to the first encryption key; transmitting the first target data to the second device via the target transmission mode includes: encrypting the first target data based on the first encryption key, and sending the encrypted first target data to the second device via the target transmission mode.

[0013] Optionally, before sending the first Token to the second device, the method further includes: determining whether the first Token is within the validity period based on the current time of the server; and sending the first Token to the second device if the first Token is within the validity period.

[0014] Optionally, after sending the first Token to the second device, the method further includes: upon receiving a first Token expiration message sent by the second device, sending a second target information acquisition request to the server based on the first account; wherein the second target information acquisition request is used to obtain a new Token and encryption key.

[0015] Optionally, after establishing the second communication connection with the server, the method further includes: sending a second network parameter of the network domain in which the first device is located to the server; wherein the second network parameter is used by the second device to determine whether there is a network path with the first device in the network domain environment based on the second network parameter, and to establish a third communication connection with the first device when there is a network path between the second device and the first device in the network domain environment; the third communication connection is a network connection in the network domain environment.

[0016] Optionally, after sending the second network parameters of the network domain where the first device is located to the server, the method also includes: receiving a second Token sent by the second device; based on the second Token, obtaining a second encryption key corresponding to the second Token from the server; wherein the second encryption key is used to decrypt the encrypted data transmitted by the second device to the first device through the third communication connection.

[0017] Optionally, after receiving the second Token sent by the second device, the method also includes: determining the validity of the second Token based on the current time of the server; obtaining a second encryption key corresponding to the second Token from the server based on the second Token, including: when the second Token is within the validity period, obtaining the second encryption key corresponding to the second Token from the server based on the second Token; otherwise, sending a second Token expiration message to the second device; wherein the second Token expiration message is used to instruct the second device to obtain a Token from the server again.

[0018] Optionally, after establishing the second communication connection with the server, the method further includes: receiving a message queue sent by the server; generating a receiving order according to the sending order of messages in the message queue, and obtaining from the server the data to be transmitted corresponding to the messages in the message queue according to the receiving order and the data identifiers of the data to be transmitted in the server corresponding to the messages in the message queue; wherein the message queue is generated by the server based on the sending time of the data contained in the second target data sent by the second device when the first device is in an offline state.

[0019] Optionally, transmitting the first target data to the second device through the target transmission mode includes: sending data information of the first target data to a server, and receiving block information of the first target data sent by the server based on the data information; the block information includes: the number of data blocks corresponding to the first target data and the number corresponding to each data block; based on the block information, dividing the first target data into at least one data block; the number of the at least one data block is the same as the number of data blocks; in the event of a transmission interruption during the process of the first device transmitting the first target data to the server, obtaining the number corresponding to the target data block that has not been transmitted in the at least one data block; after the first device re-establishes the communication connection with the server, re-sending the target data block to the server according to the number corresponding to the target data block.

[0020] The present application also provides a device for transmitting data between devices, including:

[0021] A determination module is used to determine a second device for receiving first target data; a data transmission module is used to determine a target transmission method based on network connection information between the first device and the second device, and transmit the first target data to the second device through the target transmission method; wherein the first device is a device that performs authentication based on a first account, and the second device is a device that performs authentication based on a second account; and the first account and the second account are associated accounts.

[0022] Optionally, the data transmission module is specifically used to establish a first communication connection with the second device and transmit the first target data to the second device through the first communication connection when the network connection information indicates that the second device and the first device are in the same network domain; the first communication connection is a network connection in a network domain environment; otherwise, the first device transmits the first target data to the second device through a second communication connection established with the server.

[0023] Optionally, the device also includes: a communication connection module; the communication connection module is used to establish the second communication connection with the server after the first device successfully authenticates the server through the first account; wherein the second communication connection is used for data transmission between the server.

[0024] Optionally, the device further includes: an acquisition module; the acquisition module is used to acquire a list of devices that have logged into the second account from the server; the determination module is specifically used to determine the second device that receives the first target data from the device list.

[0025] Optionally, the acquisition module is also used to acquire a first network parameter of the network domain in which the second device is located; the communication connection module is specifically used to determine the network connection status with the second device in the network domain environment based on the first network parameter; the communication connection module is also specifically used to establish a first communication connection with the second device when there is a network access between the first device and the second device in the network domain environment.

[0026] Optionally, the device also includes: a sending module; the sending module is used to send a first target information acquisition request to the server based on the first account; wherein the first target information acquisition request is used to obtain a first Token and a first encryption key corresponding to the first Token; the first encryption key is used to encrypt the first target data during data transmission.

[0027] Optionally, the sending module is also used to send the first Token to the second device, so that the second device obtains the first encryption key from the server based on the first Token, and decrypts the encrypted first target data according to the first encryption key; the data transmission module is specifically used to encrypt the first target data based on the first encryption key, and send the encrypted first target data to the second device through the target transmission method.

[0028] Optionally, the determination module is further used to determine whether the first Token is within the validity period based on the current time of the server; the sending module is further used to send the first Token to the second device when the first Token is within the validity period.

[0029] Optionally, the sending module is also used to send a second target information acquisition request to the server based on the first account when the receiving module receives a first Token expiration message sent by the second device; wherein the second target information acquisition request is used to obtain a new Token and encryption key.

[0030] Optionally, the sending module is also used to send a second network parameter of the network domain where the first device is located to the server; wherein the second network parameter is used by the second device to determine whether there is a network path with the first device in the network domain environment based on the second network parameter, and to establish a third communication connection with the first device when there is a network path between the second device and the first device in the network domain environment; the third communication connection is a network connection in the network domain environment.

[0031] Optionally, the receiving module is also used to receive a second Token sent by the second device; the acquisition module is also used to obtain a second encryption key corresponding to the second Token from the server based on the second Token; wherein the second encryption key is used to decrypt encrypted data transmitted by the second device to the first device through the third communication connection.

[0032] Optionally, the determination module is also used to determine the validity of the second Token based on the current time of the server; the acquisition module is specifically used to obtain a second encryption key corresponding to the second Token from the server based on the second Token when the second Token is within the validity period; otherwise, send a second Token expiration message to the second device; wherein the second Token expiration message is used to instruct the second device to obtain the Token from the server again.

[0033] Optionally, the receiving module is used to receive a message queue sent by the server; the receiving module is also used to generate a receiving order according to the sending order of messages in the message queue, and obtain the data to be transmitted corresponding to the messages in the message queue from the server according to the receiving order and the data identifiers of the data to be transmitted corresponding to the messages in the message queue in the server; wherein the message queue is generated by the server based on the sending time of each data contained in the second target data sent by the second device when the first device is in an offline state.

[0034] Optionally, the device also includes: a file segmentation module; the sending module is also used to send data information of the first target data to the server; the receiving module is also used to receive block information of the first target data sent by the server based on the data information; the block information includes: the number of data blocks corresponding to the first target data and the number corresponding to each data block; the file segmentation module is used to segment the first target data into at least one data block based on the block information; the number of the at least one data block is the same as the number of data blocks; the acquisition module is also used to obtain the number corresponding to the target data block that has not been transmitted in the at least one data block when a transmission interruption occurs during the process of the first device transmitting the first target data to the server; the sending module is also used to re-send the target data block to the server according to the number corresponding to the target data block after the first device and the server re-establish a communication connection.

[0035] The present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of any of the above-mentioned methods for transmitting data between devices.

[0036] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method for transmitting data between devices as described above are implemented.

[0037] The present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for transmitting data between devices as described in any one of the above are implemented.

[0038] The present application provides a method and apparatus for transmitting data between devices. After the first device determines the second device for receiving the first target data, the first device determines the target transmission mode according to the network connection information between the first device and the second device, and transmits the first target data to the second device through the target transmission mode. When data is transmitted between devices, a more appropriate data transmission mode can be selected based on the network connection information of the devices to improve the efficiency of data transmission between devices. Moreover, when a transmission is interrupted and retransmission is performed, the transmission can be resumed based on the number of the data block that has not been completed corresponding to the first target data, without the need to repeatedly transmit the data block that has been transmitted, which greatly improves the transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 It is a flowchart of a method for transmitting data between devices provided by the present application;

[0041] Figure 2 This is one of the flowcharts provided by this application for verifying whether the devices are in the same network domain;

[0042] Figure 3 This is the second flowchart of the present application for verifying whether the devices are in the same network domain;

[0043] Figure 4 This is a schematic diagram of the process of obtaining encryption keys between devices provided by this application;

[0044] Figure 5This is a flow chart of the process of obtaining encryption keys between devices after the application fails;

[0045] Figure 6 It is a structural schematic diagram of an apparatus for transmitting data between devices provided by the present application;

[0046] Figure 7 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0049] The method for transmitting data between devices provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0050] like Figure 1 As shown, an embodiment of the present application provides a method for transmitting data between devices, which may include the following steps 101 and 102:

[0051] Step 101: Determine a second device for receiving first target data.

[0052] Among them, the first device is a device that performs authentication based on the first account, and the second device is a device that performs authentication based on the second account; the first account and the second account are associated accounts.

[0053] Exemplarily, the first account and the second account may be the same account or different accounts. When the first account and the second account are the same account, the first device and the second device are devices authenticated based on the same account; when the first account and the second account are different accounts, the first account and the second account may be accounts with an associated relationship. For example, the second account and the first account may be friends, and the friend relationship may be understood as accounts that have been authenticated and communicated, or the second account may be an account authorized by the first account.

[0054] For example, when the first account and the second account are different accounts, after the user logs in the first account on the first device, the second account associated with the first account can be obtained from the server, and then the second device logged in with the second account can be obtained. When the first account and the second account are the same account, after the user logs in the first account on the first device, the second device logged in with the first account can be obtained from the server.

[0055] For example, there are multiple ways to log into an account, including through any login form such as username and password, mobile phone number, WeChat, etc.

[0056] For example, when the user of the first device wants to send the first target data to the second device, the user can select the second device from the device list displayed on the first device. The first device can also determine the second device for receiving the first target data according to a set program.

[0057] Exemplarily, the first target data may be a file, an image, a video, etc.

[0058] Step 102: Determine a target transmission mode according to network connection information between the first device and the second device, and transmit the first target data to the second device through the target transmission mode.

[0059] Exemplarily, the above network connection information is used to indicate whether the first device and the second device are in the same network domain.

[0060] Exemplarily, when the first device and the second device are in the same network domain, transmission may be performed using a first transmission mode; and when the first device and the second device are not in the same network domain, transmission may be performed using a second transmission mode.

[0061] It should be noted that, after the above target transmission mode is determined, the second device may also transmit data to the first device via the target transmission mode.

[0062] Exemplarily, the target transmission mode may be a transmission mode relayed by a server, namely, the first transmission mode, or a mode in which the first device and the second device directly transmit, namely, the second transmission mode.

[0063] For example, the first device may transmit the first target data to the server, and then the server notifies the second device and informs it of the path or identifier of the first target data stored on the server. The second device obtains the first target data from the server based on the path or identifier.

[0064] Exemplarily, if the first device and the second device are in the same network domain, the first device may establish a point-to-point communication connection with the second device, and then transmit the first target data to the second device through the communication connection.

[0065] It is understandable that since devices in the same network domain have the advantages of fast transmission speed, less impact from network fluctuations and no traffic consumption when transmitting data, when the first device and the second device are in the same network domain, point-to-point data transmission can be preferentially used.

[0066] In this way, after determining the second device for receiving the first target data, the first device determines the target transmission mode according to the network connection information between the first device and the second device, and transmits the first target data to the second device through the target transmission mode. When data is transmitted between devices, a more appropriate data transmission mode can be selected based on the network connection information of the devices, so as to improve the efficiency of data transmission between devices.

[0067] Optionally, in an embodiment of the present application, the data transmission method between the first device and the second device may be determined in the following manner.

[0068] Exemplarily, the above step 102 may include the following steps 102a1 and 102a2:

[0069] Step 102a1: when the network connection information indicates that the second device and the first device are in the same network domain, establish a first communication connection with the second device, and transmit first target data to the second device through the first communication connection.

[0070] The first communication connection is a network connection in a network domain environment, that is, a point-to-point communication connection established between the first device and the second device in the same network domain.

[0071] It should be noted that the above network environment may include a specific intranet environment, such as a local area network environment, a network environment formed by a virtual private network (VPN), etc. The communication speed between devices in this network environment is fast, or the communication security is guaranteed.

[0072] Step 102a2: Otherwise, the first target data is transmitted to the second device through the second communication connection established between the first device and the server.

[0073] For example, the first device can obtain network connection information between the first device and the second device, and determine whether the first device and the second device are in the same network domain based on the network connection information. If so, data is transmitted through a point-to-point connection; if not, data is transmitted to the second device through a server relay.

[0074] Exemplarily, the first device may establish a second communication connection with the server through the following steps 103:

[0075] Step 103: After the first device successfully authenticates with the server through the first account, a second communication connection is established with the server.

[0076] The second communication connection is used for data transmission with the server.

[0077] Exemplarily, after successfully logging into the first account and performing authentication, the first device establishes the second communication connection with the server. The second communication connection is used for communication and data transmission between the first device and the server.

[0078] Exemplarily, after establishing the second communication connection with the server, the first device may obtain a list of accounts associated with the first account based on the first account, and select a second account for data transmission.

[0079] It is understandable that the above account list may include accounts associated with the first account, and may also include device information corresponding to each account. The user may make a selection based on the device information or based on the account.

[0080] Exemplarily, the above step 101 may include the following steps 101a1 and 101a2:

[0081] Step 101a1: Obtain a list of devices that have logged into the second account from the server.

[0082] Step 101a2: Determine a second device that receives the first target data from the device list.

[0083] Exemplarily, after determining the second device that receives the first target data, the first device may specifically determine whether the first device and the second device are in the same network domain by following steps 104 to 106:

[0084] Step 104: Obtain a first network parameter of the network domain where the second device is located.

[0085] Step 105: Based on the first network parameter, determine the network connection status with the second device in the network domain environment where the first device is located.

[0086] Step 106: When a network access exists between the first device and the second device in the network domain environment, establish a first communication connection with the second device.

[0087] The first network parameter includes at least one of the following: a network domain Internet protocol (IP) address and a port number of the second device.

[0088] Exemplarily, after determining the second device for receiving the first target data, the first device can obtain the first network parameter of the second device from the server. The first network parameter is sent to the server based on the network domain parameter of the second device after the second device successfully authenticates with the server.

[0089] Exemplarily, after acquiring the first network parameter, the first device may test whether there is a network path with the second device in the network domain environment according to the first network parameter.

[0090] For example, the first device can obtain the network domain IP address of the second device, and then use the Ping (Packet Internet Groper) command to test whether the first device and the network domain IP address can be connected. If yes, it means that the first device and the second device are in the same network domain and can establish a point-to-point connection. If no, it means that the first device and the second device are not in the same network domain, or they are in the same network domain but cannot be connected.

[0091] Exemplarily, the first device may also test whether the first device and the domain IP address are connectable through a Telnet command according to the domain IP address of the second device and the port number opened by the second device.

[0092] like Figure 2As shown, after device A establishes a message channel with the cloud server, it can register device capabilities with the device service. The device capabilities may include information such as the device's ability to receive offline messages and processor capabilities. Afterwards, the network parameters of device A are sent to the server. The network parameters are mainly the network parameters of the intranet of device A, such as the intranet IP address of device A. The network parameters of device A are mainly used as a basis for the data sender to determine whether it is in the same network domain as device A when device A is the data receiver. Afterwards, device A goes online, and after the message service records the online status, it notifies the devices logged in by other accounts that are associated with the account of device A, and updates the device status.

[0093] Combination Figure 2 ,like Figure 3 As shown, when device B needs to send data to device A, it can obtain the network parameters sent by device A to the server from the server, and based on the network parameters, determine whether it is in the same network domain as device A. If so, data B is transmitted to device A through the cloud server; if not, data B is transmitted directly to device A.

[0094] Optionally, in an embodiment of the present application, after the first device logs into the first account, if it wants to transmit data to the second device through the above-mentioned first transmission method, in order to ensure the security of the data, the data needs to be encrypted.

[0095] Exemplarily, after the above step 103, the method for transmitting data between devices provided in the embodiment of the present application may further include the following step 107:

[0096] Step 107: Based on the first account, a first target information acquisition request is sent to the server.

[0097] The first target information acquisition request is used to acquire a first Token and a first encryption key corresponding to the first Token. The first encryption key is used to encrypt the first target data during data transmission.

[0098] Exemplarily, the first target information may include: a first Token and a first encryption key corresponding to the first Token. The first encryption key is used to encrypt the first target data.

[0099] It is understandable that since all client requests are processed by the server, the number of requests that the server needs to process is huge. Therefore, in order to prevent the client from frequently sending request data to the server during encrypted file transmission, a Token mechanism is introduced in the embodiment of the present application. Token is when the client frequently requests data, the server frequently queries the database for the user name and password and compares them to determine whether the user name and password are correct and make corresponding prompts. In this context, in order to prevent the client from frequently requesting data from the server, Token came into being.

[0100] Token is a string of characters generated by the server, which is used as a token for client requests. After the first login, the server generates a token and returns it to the client. In the future, the client only needs to bring this token to request data, without the need to bring the username and password again. By introducing tokens in the encrypted transmission process, the pressure on the server can be reduced to a certain extent, the frequent query of the database can be reduced, and the server can be made more robust.

[0101] Exemplarily, the first Token is the identity authentication information of the first device, which avoids the first device from frequently requesting authentication from the server and reduces the processing load of the server. At the same time, the first Token can also be used by other devices as the authorization device of the first device to obtain information related to the first device from the server, such as encryption keys.

[0102] Exemplarily, after obtaining the first Token and the first encryption key, the first device can use the encryption key to encrypt the transmitted data. The data receiving end can obtain the encryption key from the server through the first Token to prevent sensitive data from being leaked during transmission.

[0103] Exemplarily, before the above step 102, the method for transmitting data between devices provided in the embodiment of the present application may further include the following step 108:

[0104] Step 108: Send the first Token to the second device, so that the second device obtains the first encryption key from the server based on the first Token, and decrypts the encrypted first target data according to the first encryption key.

[0105] It should be noted that the first device can send the first Token to the second device through the first communication mode and the second communication mode, or send the first Token to the second device through other communication connections established with the second device. In the embodiment of the present application, the method of sending the Token from the first device to the second device is not limited.

[0106] Exemplarily, the above step 102 may specifically include the following step 102b1.

[0107] Step 102b1: Encrypt the first target data based on the first encryption key, and send the encrypted first target data to the second device through the target transmission mode.

[0108] Exemplarily, after the first device sends the first Token to the second device, the first device may send the encrypted first target data to the second device through any one of the first communication connection and the second communication connection according to network conditions.

[0109] Exemplarily, as a receiving end of the encrypted first target data, the second device needs to have the ability to decrypt the encrypted data, and the decryption capability can be obtained by obtaining the corresponding encryption key from the server through the above-mentioned first Token.

[0110] Exemplarily, after obtaining the first Token, the second device can obtain the first encryption key from the server based on the Token and the account of the second device. The first encryption key can also be used to decrypt data encrypted by the first encryption key.

[0111] For example, Figure 4 As shown, when device A sends data to device B for the first time, and device A and device B are in the same network domain. Device A needs to obtain the Token and key from the cloud server based on the logged-in account. After that, the Token is sent to device B through the near-field communication capability established with device B (i.e., the first communication connection mentioned above). After device B receives the Token, it obtains the key corresponding to the Token from the server based on the account logged in by the device (i.e., the first encryption key mentioned above). After successfully obtaining the above-mentioned key, device B informs device A, and the device can use the key to encrypt the data and then transmit it to device B.

[0112] For example, in order to ensure data security, the server usually sets a validity period for each Token. Therefore, before the first device sends the first Token to the second device, it is necessary to verify whether the first Token is within the validity period.

[0113] It is understandable that the corresponding encryption key can only be obtained from the server based on the Token if the Token is within its validity period. Here, the validity period can be understood as setting a time period during which the Token can be used; or the validity period can be understood as setting a time limit between a server or a device.

[0114] Exemplarily, before the above step 108, the method for transmitting data between devices provided in the embodiment of the present application may further include the following steps 109 and 110:

[0115] Step 109: Based on the current time of the server, determine whether the first Token is within the validity period.

[0116] Step 110: When the first Token is within the validity period, send the first Token to the second device.

[0117] Exemplarily, the first device may verify through the server whether the first Token is within the validity period.

[0118] It is understandable that when the first device obtains the first Token from the server, the server records the current time and sets a validity period. During the validity period, the device can obtain the first encryption key through the first Token. The validity period of the first Token is calculated based on the server time. Therefore, it is necessary to determine whether the first Token is within the validity period based on the current time of the server. When the first Token expires, the above-mentioned first encryption key also expires.

[0119] Exemplarily, if the first Token is within the validity period, the first device may send the first Token to the second device for the second device to obtain the first encryption key. When the first Token is within the validity period, the first device does not need to repeatedly obtain the Token.

[0120] For example, if the first device sends the first Token while the first Token is valid, but the second device receives the first Token but the first Token has expired, the second device will return a Token expiration message to prompt the first device to obtain a new Token.

[0121] Exemplarily, after the above step 108, the method for transmitting data between devices provided in the embodiment of the present application may further include the following step 111:

[0122] Step 111: Upon receiving the first Token expiration message sent by the second device, a second target information acquisition request is sent to the server based on the first account.

[0123] The second target information acquisition request is used to obtain a new Token and encryption key.

[0124] Exemplarily, after receiving the Token expiration message sent by the second device, the first device needs to obtain the Token from the server again for subsequent data transmission.

[0125] For example, Figure 5 The figure shows the operation flow chart after the device verification token is invalid. Before sending the token to device B, device A needs to verify whether the token is valid with the server. If the token is valid, the token is sent to device B through the near field communication capability established with device B. After receiving the token, device B also needs to verify the validity of the token with the server to avoid being unable to decrypt the received encrypted data. If the server returns the token past information, device B needs to inform device A that the token has expired, and device A needs to obtain a new token and encryption key from the server again.

[0126] Optionally, in an embodiment of the present application, the first device may not only serve as a data sending end, but also serve as a data receiving end to receive data sent by the second device.

[0127] It should be noted that the above-mentioned first device and second device have the same functions and roles, and the feature description for the first device can be applied to the second device, and the feature description for the second device can also be applied to the first device.

[0128] Exemplarily, when the first device is used as a data receiving end, after the step 103, the method for transmitting data between devices provided in the embodiment of the present application may further include the following step 112:

[0129] Step 112: Send the second network parameter of the network domain where the first device is located to the server.

[0130] The second network parameter is used by the second device to determine whether there is a network path with the first device in the network domain environment based on the second network parameter, and to establish a third communication connection with the first device when there is a network path between the second device and the first device in the network domain environment. The third communication connection is a network connection in the network domain environment.

[0131] Exemplarily, after establishing a communication connection with the server, the first device sends a second network parameter to the server, which is used as a basis for the second device to determine whether it is in the same network domain as the first device when serving as a data receiving end of the second device.

[0132] Exemplarily, after the above step 112, the method for transmitting data between devices provided in the embodiment of the present application may further include the following steps 113 and 114:

[0133] Step 113: Receive a second Token sent by the second device.

[0134] Step 114: Based on the second Token, obtain a second encryption key corresponding to the second Token from the server.

[0135] The second encryption key is used to decrypt encrypted data transmitted by the second device to the first device through the third communication connection.

[0136] Exemplarily, the first device acts as a data receiving end. After being in the same network domain as the second device and establishing a third communication connection, it indicates that the second device needs to send data to the first device. After that, the first device can also receive the second Token sent by the second device.

[0137] Exemplarily, after receiving the second Token, the first device may obtain a second encryption key corresponding to the second Token from the server based on the second Token, and the second encryption key is used to decrypt the second target data sent by the second device.

[0138] Exemplarily, the first device, as a data receiving end, also needs to verify the validity of the second Token with the server after receiving the second Token.

[0139] Exemplarily, after the above step 113, the method for transmitting data between devices provided in the embodiment of the present application may further include the following step 115:

[0140] Step 115: Determine the validity of the second Token based on the current time of the server.

[0141] Exemplarily, the above step 114 may include the following steps 114a and 114b:

[0142] Step 114a: When the second Token is within the validity period, based on the second Token, obtain a second encryption key corresponding to the second Token from the server.

[0143] Step 114b: Otherwise, send a second Token expiration message to the second device.

[0144] The second Token expiration message is used to instruct the second device to obtain a Token from the server again.

[0145] For example, if the second Token is valid, the second encryption key corresponding to the second Token can be obtained from the server. If the second Token has expired, a second Token expiration message needs to be sent to the second device. After receiving the second Token expiration message, the second device obtains a new Token and encryption key from the server again.

[0146] Optionally, in an embodiment of the present application, when the first device acts as a data receiving end and the data received when the first device is in an offline state can be obtained from the server in sequence according to the message queue generated by the server according to the time when the data was sent after the first device comes back online.

[0147] Exemplarily, after the above step 103, the method for transmitting data between devices provided in the embodiment of the present application may further include the following steps 116 and 117,

[0148] Step 116: Receive the message queue sent by the server.

[0149] Step 117: Generate a receiving order according to the sending order of the messages in the message queue, and obtain the data to be transmitted corresponding to the messages in the message queue from the server according to the receiving order and the data identifiers of the data to be transmitted corresponding to the messages in the message queue in the server.

[0150] The message queue is generated by the server based on the sending time of the data contained in the second target data sent by the second device when the first device is in an offline state.

[0151] For example, when the first device is back online, the server sends a message queue generated by the second target data sent by the second device when the first device is offline to the first device. Based on the message queue, the first device can sequentially obtain data corresponding to each message in the message queue from the server.

[0152] Exemplarily, each message in the message queue may include a complete second target data, or may include part of the second target data when the data is relatively large.

[0153] Exemplarily, the second target data may include multiple sub-data, and each message in the message queue may correspond to one sub-data. The first device determines a receiving order according to the sending time of each sub-data in the message queue, and receives each sub-data according to the receiving order.

[0154] Exemplarily, after the second device transmits the second target data to the server, the server stores the second target data and generates a corresponding data identifier. The first device may obtain the second target data from the server based on the data identifier.

[0155] Exemplarily, the above step 117 may include the following steps 117a:

[0156] Step 117a: based on the data identifier of the data to be transmitted corresponding to each message in the message queue in the server, obtain the data to be transmitted from the server.

[0157] Exemplarily, the second target data may be sent by the second device in one data transmission process or in multiple data transmission processes.

[0158] Exemplarily, the server generates the message queue based on the sending time of each data in the second target data sent by the second device. The first device determines the receiving order of each data to be transmitted based on the sending time of each message corresponding to the data to be transmitted in the message queue, and receives the data to be transmitted according to the receiving order.

[0159] Optionally, in an embodiment of the present application, in order to ensure the stability of data transmission, when the client transmits data to the server, the transmitted data is divided into blocks and numbered, so that if the transmission is interrupted due to user or network reasons during the data transmission process and the data transmission is restarted, the data that has not been transmitted can continue to be transmitted without repeatedly transmitting the data that has been transmitted.

[0160] Exemplarily, the above step 102 may include the following steps 102c1 to 102c4:

[0161] Step 102c1: Send data information of the first target data to the server, and receive block information of the first target data sent by the server based on the data information.

[0162] The block information includes: the number of data blocks corresponding to the first target data and the serial number corresponding to each data block.

[0163] Exemplarily, the data information may include the data size and file name of the first target data. The server determines the block information of the first target data according to the data size of the first target data, and the block information may include the number of data blocks, the size of each data block, and the number. Afterwards, the server sends the block information to the first device, and after the first device receives the block information, it blocks the first target data based on the block information.

[0164] Specifically, the server may determine the number of blocks according to the current network connection status with the first device. The better the current network connection status is, the fewer the number of blocks is; the worse the current network connection status is, the more the number of blocks is.

[0165] It can be understood that when the current network connection status is good, the stability of data transmission can be guaranteed, and no errors will occur when transmitting larger files; when the current network connection status is poor, the probability of errors in the transmission process increases. At this time, the size of each data block is reduced, and when an error occurs, the amount of data that needs to be retransmitted is also less.

[0166] Step 102c2: based on the block information, divide the first target data into at least one data block.

[0167] Wherein, the number of at least one data block is the same as the number of data blocks.

[0168] Step 102c3: When a transmission interruption occurs during the process of the first device transmitting the first target data to the server, obtain a number corresponding to an untransmitted target data block in at least one data block.

[0169] Step 102c4: After the first device re-establishes the communication connection with the server, the target data block is re-sent to the server according to the number corresponding to the target data block.

[0170] Exemplarily, when the first device sends the first target data to the server, it will receive the remaining number of data blocks and the remaining size of data blocks sent by the server, which are used to indicate the number of data blocks that have not been transmitted yet and the remaining size of the data blocks that are currently being transmitted. When the remaining number of data blocks and the remaining size of data blocks are both 0, it means that all data blocks in the at least one data block have been transmitted. At this time, the first device can send the transmission completion information to the server. After the server receives the transmission completion information,

[0171] For example, if the transmission process is interrupted due to user or network reasons, then after the transmission channel is re-established, the transmission can be resumed according to the number of the data block.

[0172] Exemplarily, after the first device sends data information of the first target data to the server, it receives the block information of the first target data sent by the server. The block information may include at least one of the following: the data ID corresponding to the first target data, the number of data blocks corresponding to the first target data, and the number corresponding to each data block.

[0173] Exemplarily, when the first device transmits the first target data, it records the numbers corresponding to the data blocks that have been completed transmitted. When the transmission process is interrupted and the transmission is restarted, the incompletely transmitted data blocks can be directly transmitted according to the numbers corresponding to the incompletely transmitted data blocks, without the need to repeatedly transmit the completed data blocks.

[0174] It should be noted that when the first device transmits the first target data to the server, the server will assign a corresponding data ID to the first target data. When the first target data is resumed, the server can splice the retransmitted data block with the previously transmitted data block based on the data ID.

[0175] For example, take device A uploading and downloading files from the server as an example. When device A uploads files, it obtains the file ID, block number, and block size through the start upload interface; the server will determine the number of segments based on the file size. If the file is small, there can be only one segment; device A segments the file according to the number of segments and segment numbers returned by the server. When the file is uploaded, device A calls the end upload interface, so that the server will combine all the segments into one segment; at this time, after device B receives the file message, it can download the file through the download interface. The principle is similar to uploading, and the file is also segmented through the segment download in the interface. When the returned segment number and segment size are both 0, it means that the file download is complete.

[0176] The method for transmitting data between devices provided in the embodiment of the present application can select a faster transmission method from the server transfer transmission method or the near field communication description method based on the network status information between the devices, which solves the technical problems that the existing file transmission methods, transmission devices and transmission systems are affected by hardware equipment factors or have slow transmission speeds. In addition, based on the data encryption and decryption provided in the embodiment of the present application, the security during transmission can be effectively guaranteed. In addition, when the transmission is interrupted and the transmission is restarted, the transmission can be continued based on the number of the data block that has not been completed corresponding to the first target data, without the need to repeatedly transmit the data block that has been completed, which greatly improves the transmission efficiency.

[0177] It should be noted that the execution subject of the method for transmitting data between devices provided in the embodiment of the present application may be an apparatus for transmitting data between devices, or a control module in the apparatus for transmitting data between devices for executing the method for transmitting data between devices. In the embodiment of the present application, the apparatus for transmitting data between devices provided in the embodiment of the present application is described by taking the apparatus for transmitting data between devices executing the method for transmitting data between devices as an example.

[0178] It should be noted that, in the embodiments of the present application, the methods for transmitting data between devices shown in the above-mentioned method drawings are all illustrated by combining one of the drawings in the embodiments of the present application as an example. In specific implementation, the methods for transmitting data between devices shown in the above-mentioned method drawings can also be implemented in combination with any other drawings that can be combined as shown in the above-mentioned embodiments, which will not be repeated here.

[0179] The apparatus for transmitting data between devices provided in the present application is described below. The method for transmitting data between devices described below and the method described above can refer to each other.

[0180] Figure 6 A schematic diagram of the structure of an apparatus for transmitting data between devices provided in an embodiment of the present application is shown as follows. Figure 6As shown, it specifically includes: a determination module 601, used to determine a second device for receiving the first target data; a data transmission module 602, used to determine a target transmission method according to network connection information between the first device and the second device, and transmit the first target data to the second device through the target transmission method; wherein the first device is a device that performs authentication based on the first account, and the second device is a device that performs authentication based on the second account; the first account and the second account are associated accounts.

[0181] Optionally, the data transmission module 602 is specifically used to establish a first communication connection with the second device and transmit first target data to the second device through the first communication connection when the network connection information indicates that the second device and the first device are in the same network domain; the first communication connection is a network connection in a network domain environment; otherwise, the first device transmits the first target data to the second device through a second communication connection established with the server.

[0182] Optionally, the apparatus further includes: a communication connection module 603; the communication connection module 603, the first device establishes a second communication connection with the server after the first account is successfully authenticated with the server; wherein the second communication connection is used for data transmission between the server.

[0183] Optionally, the device further includes: an acquisition module 604; the acquisition module 604 is used to acquire a list of devices that have logged into the second account from the server; and a determination module 601 is specifically used to determine the second device that receives the first target data from the device list.

[0184] Optionally, the acquisition module 604 is also used to obtain the first network parameter of the network domain in which the second device is located; the communication connection module 603 is specifically used to determine the network connection status with the second device in the network domain environment based on the first network parameter; the communication connection module 603 is also specifically used to establish a first communication connection with the second device when there is a network access between the first device and the second device in the network domain environment; wherein the first network parameter includes at least one of the following: the network domain Internet Interconnection Protocol IP address and port number of the second device.

[0185] Optionally, the device also includes: a sending module 605; the sending module 605 is used to send a first target information acquisition request to the server based on the first account; wherein the first target information acquisition request is used to obtain a first Token and a first encryption key corresponding to the first Token; the first encryption key is used to encrypt the first target data during data transmission.

[0186] Optionally, the sending module 605 is also used to send a first Token to a second device, so that the second device obtains a first encryption key from the server based on the first Token, and decrypts the encrypted first target data according to the first encryption key; the data transmission module 602 is specifically used to encrypt the first target data based on the first encryption key, and send the encrypted first target data to the second device via a target transmission method.

[0187] Optionally, the determination module 601 is further used to determine whether the first Token is within the validity period based on the current time of the server; the sending module 605 is further used to send the first Token to the second device if the first Token is within the validity period.

[0188] Optionally, the sending module 605 is also used to send a second target information acquisition request to the server based on the first account when the receiving module 606 receives a first Token expiration message sent by the second device; wherein the second target information acquisition request is used to obtain a new Token and encryption key.

[0189] Optionally, the sending module 605 is also used to send a second network parameter of the network domain in which the first device is located to the server; wherein the second network parameter is used by the second device to determine whether there is a network path with the first device in the network domain environment based on the second network parameter, and to establish a third communication connection with the first device when there is a network path between the second device and the first device in the network domain environment; the third communication connection is a network connection in the network domain environment.

[0190] Optionally, the receiving module 606 is also used to receive a second Token sent by the second device through a third communication connection; the obtaining module 604 is also used to obtain a second encryption key corresponding to the second Token from the server based on the second Token; wherein the second encryption key is used to decrypt encrypted data transmitted by the second device to the first device through the third communication connection.

[0191] Optionally, the determination module 601 is also used to determine the validity of the second Token based on the current time of the server; the acquisition module 604 is specifically used to obtain a second encryption key corresponding to the second Token from the server based on the second Token when the second Token is within the validity period; otherwise, send a second Token expiration message to the second device; wherein the second Token expiration message is used to instruct the second device to obtain the Token from the server again.

[0192] Optionally, the receiving module 606 is used to receive a message queue sent by the server; the receiving module 606 is also used to generate a receiving order according to the sending order of the messages in the message queue, and obtain the data to be transmitted corresponding to the messages in the message queue from the server according to the receiving order and the data identifiers of the data to be transmitted corresponding to the messages in the message queue in the server; wherein the message queue is generated by the server based on the sending time of the data contained in the second target data sent by the second device when the first device is in an offline state.

[0193] Optionally, the device also includes: a file segmentation module 607; a sending module 605, which is also used to send data information of the first target data to the server; a receiving module 606, which is also used to receive the block information of the first target data sent by the server based on the data information; the block information includes: the number of data blocks corresponding to the first target data and the number corresponding to each data block; the file segmentation module 607 is used to segment the first target data into at least one data block based on the block information; the number of at least one data block is the same as the number of data blocks; the acquisition module 604 is also used to obtain the number corresponding to the target data block that has not been transmitted in at least one data block when a transmission interruption occurs during the process of the first device transmitting the first target data to the server; the sending module 605 is also used to re-send the target data block to the server according to the number corresponding to the target data block after the first device and the server re-establish the communication connection.

[0194] The device for transmitting data between devices provided by the present application can select a faster transmission method from a server transfer transmission method or a near field communication transmission method based on the network status information between the devices, thereby solving the technical problems that the existing file transmission methods, transmission devices and transmission systems are affected by hardware factors or have slow transmission speeds. In addition, based on the data encryption and decryption methods provided by the embodiments of the present application, the security during transmission can be effectively guaranteed. Moreover, when the transmission is interrupted and the transmission is restarted, the transmission can be continued based on the number of the data block that has not been completed corresponding to the first target data, without the need to repeatedly transmit the data block that has been completed, which greatly improves the transmission efficiency.

[0195] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute a method for transmitting data between devices, the method comprising: determining a second device for receiving first target data; determining a target transmission mode according to network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission mode; wherein the first device is a device for authentication based on the first account, and the second device is a device for authentication based on the second account; and the first account and the second account are associated accounts.

[0196] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0197] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the method for transmitting data between devices provided by the above methods, and the method includes: determining a second device for receiving first target data; determining a target transmission method based on network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission method; wherein the first device is a device for authentication based on a first account, and the second device is a device for authentication based on a second account; the first account and the second account are associated accounts.

[0198] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned method for transmitting data between devices, the method comprising: determining a second device for receiving first target data; determining a target transmission method based on network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission method; wherein the first device is a device for authentication based on the first account, and the second device is a device for authentication based on the second account; the first account and the second account are associated accounts.

[0199] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0200] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially 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 ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0201] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for transmitting data between devices, applied to a first device, characterized in that: include: determining a second device for receiving the first target data; determining a target transmission mode according to network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission mode; The first device is a device that performs authentication based on a first account, and the second device is a device that performs authentication based on a second account; the first account and the second account are associated accounts; The determining of a second device for receiving the first target data includes: In the case that the first account and the second account are different accounts, after the first device logs in to the first account, the second account associated with the first account is obtained, and based on the second account, a second device logged in with the second account is obtained; The second account is an account authorized by the first account; and the second device is a device selected by the user from a device list displayed on the first device.

2. The method according to claim 1, characterized in that The determining a target transmission mode according to network connection information between the first device and the second device, and transmitting the first target data to the second device through the target transmission mode includes: When the network connection information indicates that the second device and the first device are in the same network domain, establish a first communication connection with the second device, and transmit the first target data to the second device through the first communication connection; the first communication connection is a network connection in a network domain environment; Otherwise, the first device transmits the first target data to the second device through a second communication connection established with the server.

3. The method according to claim 2, characterized in that Before determining the second device for receiving the first target data, the method further includes: After the first account is successfully authenticated with the server, the first device establishes the second communication connection with the server; The second communication connection is used for data transmission with the server.

4. The method according to claim 2, characterized in that: The determining of a second device for receiving the first target data includes: Acquire from the server a list of devices that have logged into the second account; A second device for receiving the first target data is determined from the device list.

5. The method according to claim 2, characterized in that: The establishing a first communication connection with the second device when the network connection information indicates that the second device and the first device are in the same network domain includes: Acquire a first network parameter of the second device in the network domain; Based on the first network parameter, determining a network connection state between the first device and the second device in the network domain environment where the first device is located; When a network access exists between the first device and the second device in a network domain environment, a first communication connection is established with the second device.

6. The method according to claim 3, characterized in that After establishing the second communication connection with the server, the method further includes: Based on the first account, sending a first target information acquisition request to the server; The first target information acquisition request is used to obtain a first Token and a first encryption key corresponding to the first Token; the first encryption key is used to encrypt the first target data during data transmission.

7. The method according to claim 6, characterized in that Before transmitting the first target data to the second device in the target transmission mode, the method further includes: Sending the first Token to the second device, so that the second device obtains the first encryption key from the server based on the first Token, and decrypts the encrypted first target data according to the first encryption key; The transmitting the first target data to the second device by using the target transmission mode includes: The first target data is encrypted based on the first encryption key, and the encrypted first target data is sent to the second device through the target transmission mode.

8. The method according to claim 7, characterized in that Before sending the first Token to the second device, the method further includes: Determine whether the first Token is within a validity period based on the current time of the server; When the first Token is within the validity period, the first Token is sent to the second device.

9. The method according to claim 8, characterized in that After sending the first Token to the second device, the method further includes: Upon receiving the first Token expiration message sent by the second device, sending a second target information acquisition request to the server based on the first account; The second target information acquisition request is used to obtain a new Token and encryption key.

10. The method according to claim 3, characterized in that: After establishing the second communication connection with the server, the method further includes: Sending a second network parameter of the network domain where the first device is located to the server; Among them, the second network parameter is used by the second device to determine whether there is a network path with the first device in the network domain environment, and when the second device and the first device have a network path in the network domain environment, the second device and the first device establish a third communication connection; the third communication connection is a network connection in the network domain environment.

11. The method according to claim 10, characterized in that After sending the second network parameter of the network domain where the first device is located to the server, the method further includes: Receive a second Token sent by the second device; Based on the second Token, obtaining from the server a second encryption key corresponding to the second Token; The second encryption key is used to decrypt encrypted data transmitted by the second device to the first device through the third communication connection.

12. The method according to claim 11, characterized in that After receiving the second Token sent by the second device, the method further includes: Determining the validity of the second Token based on the current time of the server; The acquiring, from the server, a second encryption key corresponding to the second Token based on the second Token, includes: If the second Token is within the validity period, obtaining a second encryption key corresponding to the second Token from the server based on the second Token; otherwise, sending a second Token expiration message to the second device; The second Token expiration message is used to instruct the second device to obtain a Token from the server again.

13. The method according to claim 3, characterized in that After establishing the second communication connection with the server, the method further includes: Receive a message queue sent by the server; Generate a receiving order according to the sending order of the messages in the message queue, and obtain the to-be-transmitted data corresponding to the messages in the message queue from the server according to the receiving order and the data identifier; Among them, the message queue is generated by the server based on the sending time of the data contained in the second target data sent by the second device when the first device is in an offline state; the data identifier is used to indicate the data to be transmitted corresponding to the message in the message queue in the server.

14. The method according to claim 1, characterized in that The transmitting the first target data to the second device by using the target transmission mode includes: Sending data information of the first target data to a server, and receiving block information of the first target data sent by the server based on the data information; the block information includes: the number of data blocks corresponding to the first target data and the serial numbers corresponding to the data blocks; Based on the block information, the first target data is divided into at least one data block; the number of the at least one data block is the same as the number of the data blocks; When a transmission interruption occurs during the process of transmitting the first target data from the first device to the server, obtaining a serial number corresponding to an untransmitted target data block in the at least one data block; After the first device re-establishes the communication connection with the server, the target data block is re-sent to the server according to the serial number corresponding to the target data block.

15. The method according to claim 1, characterized in that Before determining the second device for receiving the first target data, the method further includes: Registering device capabilities with a device service of a server, and sending intranet parameters of the first device to the server; wherein the intranet parameters are used to determine whether the devices are in the same local area network; When the first device is online, the server sends a notification to a second device logged in to the second account, so that the second device updates the device status of the first device.

16. A device for transmitting data between devices, applied to a first device, characterized in that: The device comprises: A determination module, configured to determine a second device for receiving the first target data; a data transmission module, configured to determine a target transmission mode according to network connection information between the first device and the second device, and transmit the first target data to the second device through the target transmission mode; The first device is a device that performs authentication based on a first account, and the second device is a device that performs authentication based on a second account; the first account and the second account are associated accounts; The determining module is specifically configured to, when the first account and the second account are different accounts, obtain the second account associated with the first account after the first device logs in to the first account, and obtain the second device logged in to the second account based on the second account; The second account is an account authorized by the first account; and the second device is a device selected by the user from a device list displayed on the first device.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for transmitting data between devices as claimed in any one of claims 1 to 15 are implemented.

18. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method for transmitting data between devices as described in any one of claims 1 to 15 are implemented.