Data transmission method, apparatus, device, and medium
By comparing intermediate files between the target file server and the source client during file transfer, the function of resuming interrupted transfers is realized, which solves the problems of high cost and data leakage in existing technologies and provides a secure and efficient file transfer solution.
Patent Information
- Application Number
- CN202310779511.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-06-28
AI Technical Summary
Existing technologies require rewriting the transmission protocol on the file storage side when implementing file transfer resuming, resulting in high costs and the risk of data leakage.
By comparing the intermediate file obtained from the target file server with the intermediate file sent by the source client, if they match, the server sends continuation data to generate the new file, thus avoiding changes to the file server's transmission function.
It enables breakpoint resume functionality without requiring file server data migration, reducing costs and avoiding the risk of data leakage.
Smart Images

Figure CN116668433B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a data transmission method and device, equipment and medium. BACKGROUND
[0002] In the process of file transmission, in the case that network failure occurs and causes a certain file transmission to fail, the breakpoint resume transmission technology can be used to continue the transmission of the untransmitted part of data after the part of data of the file that has been completed transmission when the network is restored, instead of retransmitting the entire file from the beginning.
[0003] In the related art, the breakpoint resume transmission function needs to rewrite the file transmission function of the file storage end. If the breakpoint resume transmission function is added on the basis of the file storage end that has been put into use, all data in the file storage end needs to be migrated, which consumes a large cost and increases the risk of data leakage. SUMMARY
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data transmission method, device, equipment and medium.
[0005] The present disclosure provides a data transmission method, comprising:
[0006] In the case that the resume request sent by the source client is received, the first intermediate file corresponding to the resume request in the target file server is obtained; wherein the first intermediate file is a file generated by the part of data of the first new file that has been completed transmission, and the resume request is a request to continue the transmission of the first new file;
[0007] The second intermediate file sent by the source client is received; wherein the second intermediate file is a part of the second new file, the second new file and the first new file have the same file path in the source file server listened by the source client, and the data amount of the second intermediate file and the first intermediate file is the same;
[0008] If the first intermediate file and the second intermediate file are consistent, the resume data of the second new file located after the second intermediate file is sent to the target file server, so that the target file server generates the second new file according to the first intermediate file and the resume data.
[0009] The present disclosure further provides a data transmission device, comprising:
[0010] The acquisition module is configured to acquire, in response to receiving a resuming request sent by the source client, a first intermediate file corresponding to the resuming request in the target file server; wherein the first intermediate file is a file generated by part of data of the first new file that has been completely transmitted, and the resuming request is a request for continuing transmission of the first new file;
[0011] The first receiving module is configured to receive a second intermediate file sent by the source client; wherein the second intermediate file is a part of a second new file, the second new file and the first new file have the same file path in a source file server listened to by the source client, and the second intermediate file and the first intermediate file have the same data volume.
[0012] The first sending module is configured to, if the first intermediate file and the second intermediate file are consistent, send, to the target file server, resuming data of the second new file located after the second intermediate file, so that the target file server generates the second new file according to the first intermediate file and the resuming data.
[0013] The electronic device provided in the embodiments of the present disclosure includes a processor, a memory for storing executable instructions of the processor, and the processor is configured to read the executable instructions from the memory and execute the instructions to implement the data transmission method provided in the embodiments of the present disclosure.
[0014] The embodiments of the present disclosure further provide a computer readable storage medium, which stores a computer program for executing the data transmission method provided in the embodiments of the present disclosure.
[0015] The technical solution provided in the embodiments of the present disclosure has the following advantages compared with the prior art: the data transmission solution provided in the embodiments of the present disclosure includes: acquiring, in response to receiving a resuming request sent by the source client, a first intermediate file corresponding to the resuming request in the target file server; wherein the first intermediate file is a file generated by part of data of the first new file that has been completely transmitted, and the resuming request is a request for continuing transmission of the first new file; receiving a second intermediate file sent by the source client; wherein the second intermediate file is a part of a second new file, the second new file and the first new file have the same file path in a source file server listened to by the source client, and the second intermediate file and the first intermediate file have the same data volume; and if the first intermediate file and the second intermediate file are consistent, sending, to the target file server, resuming data of the second new file located after the second intermediate file, so that the target file server generates the second new file according to the first intermediate file and the resuming data.
[0016] By adopting the technical scheme, the target client obtains the first intermediate file which has been landed in the target file server, and receives the partial file (i.e., the second intermediate file) of the second new file which has the same file path as the first intermediate file (i.e., the first new file), the data amount of the first intermediate file and the second intermediate file is the same, and the first intermediate file and the second intermediate file are comparable, the target client determines that the new file does not change by determining that the first intermediate file and the second intermediate file are consistent, and thus can continue the file transmission based on the first intermediate file received before, so that the breakpoint resume function is realized by adding the source client and the target client without changing the file transmission function of the file server itself, and since the transmission function of the file server itself is not changed, the data migration of the file server is not needed for the update of the transmission function, and data leakage in the data migration process is avoided. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, further serve to explain the principles of the disclosure.
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, brief introductions will be given to the drawings needed to be used in the embodiments or prior art descriptions. Obviously, for those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative labor.
[0019] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present disclosure;
[0020] Figure 2 A topological structure diagram of data transmission provided by an embodiment of the present disclosure;
[0021] Figure 3 A flowchart of another data transmission method provided by an embodiment of the present disclosure;
[0022] Figure 4 A flowchart of still another data transmission method provided by an embodiment of the present disclosure;
[0023] Figure 5 A flowchart of a data transmission method applied to a source client provided by an embodiment of the present disclosure;
[0024] Figure 6 A flowchart of a data transmission method applied to a target client provided by an embodiment of the present disclosure;
[0025] Figure 7 A structural diagram of a data transmission device provided by an embodiment of the present disclosure;
[0026] Figure 8 A structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] In order to enable a more clear understanding of the above-mentioned purposes, features and advantages of the present disclosure, the solutions 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.
[0028] In the following description, a large number of specific details are set forth in order to facilitate a thorough understanding of the present disclosure, but the present disclosure can also be implemented in other manners different from those described herein; obviously, the embodiments described in the specification are only a part of the embodiments of the present disclosure, and not all the embodiments.
[0029] In the process of file transmission, in the case that network failure occurs and causes a certain file transmission to fail, the breakpoint resume technology can be used to continue the transmission of the untransmitted part of data after the part of data of the file that has been completed transmission when the network is restored, instead of retransmitting the entire file from the beginning.
[0030] In the related art, different file storage ends can realize file transmission through a file transfer protocol (FTP), a server message block (SMB), a network file system (NFS) or the like.
[0031] However, based on the above file protocol transmission, when the breakpoint resume function is implemented, the file transmission part in the above transmission protocol needs to be rewritten. If the breakpoint resume function is added on the basis of a file storage end (for example, a file server) that has been put into use, all the data in the file storage end needs to be migrated, which consumes a large cost and increases the risk of data leakage.
[0032] In order to solve the above-mentioned problems, an embodiment of the present disclosure provides a data transmission method, which will be introduced below in combination with specific embodiments.
[0033] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present disclosure is shown in the figure, the method can be executed by a data transmission device or a target client, wherein the device can be implemented by software and / or hardware, and can be integrated in an electronic device, such as a server, a terminal or the like. Figure 1 The data transmission method includes the following steps.
[0034] Step 101: Upon receiving a resume request from the source client, obtain the first intermediate file corresponding to the resume request from the target file server; wherein, the first intermediate file is a file generated from the portion of data that has been transferred in the first newly added file, and the resume request is a request to continue the transfer of the first newly added file.
[0035] The client, also known as the user terminal, can be installed on an electronic device outside the file server. This client is a program that corresponds to the file server and provides file download resume functionality. The source (src) client corresponds to the source file server that generates the new file; this source client can monitor changes to the source file server. The destination (dest) client corresponds to the target file server that requires file synchronization; this destination client can transfer newly generated files to the target file server.
[0036] A file server, also known as an archive server, provides basic file processing functions such as file storage, file sending, and file receiving. It can transfer files using one or more file transfer protocols, including FTP, SMB, and NFS. It's important to note that these protocols only support basic file functions like file transfer, file download, and file directory listing; they are limited to advanced functions such as file-based calculations. To implement resume functionality on a file server using these protocols, the protocols themselves need to be customized.
[0037] The source file server can be the file server that generates the new file, and the target file server can be a file server that requires file synchronization. Understandably, when a new file is generated on the source file server, that new file needs to be synchronized to the target file server.
[0038] Figure 2 This is a schematic diagram of a data transmission topology provided in an embodiment of the present disclosure, such as... Figure 2 As shown, file transfer occurs between the source file server and the source client via a first link channel, which can be a link channel established based on the Transmission Control Protocol (TCP). File transfer occurs between the target file server and the target client via a second link channel, which can also be a link channel established based on the Transmission Control Protocol (TCP). Data transmission occurs between the source client and the target client via a cross-domain channel, also known as a cross-domain gateway channel.
[0039] In an alternative embodiment, the data transmission between the inner network and the outer network can be achieved by Figure 2 The topology shown in the figure can be used to achieve data transmission between the inner network and the outer network. Specifically, the source client is a client located in the inner network, and the target client is a client located in the outer network; or the target client is a client located in the inner network, and the source client is a client located in the outer network; and the source client and the target client perform data transmission through the cross-domain channel.
[0040] The inner network can be understood as an internal network, which is also called a local area network. The inner network can be a network composed of electronic devices in a predetermined area or pre-set electronic devices. The outer network can be understood as an external network, which is also called a wide area network, public network, etc. The source client and the target client can be clients located in the inner network and the outer network, respectively. The cross-domain channel can be a data channel for data transmission between clients that do not meet the same origin measurement. The type of cross-domain channel is not limited in this embodiment.
[0041] Next, the file transmission method based on the above target client, source client, target file server, and source file server will be described. In this embodiment, the resume request can be a request generated and sent by the source client to continue transmitting the first new file after the network interruption during the process of transmitting the first new file from the source client to the target file server. The network interruption can include interruption of the cross-domain channel between the source client and the target client, and / or interruption of the second link channel between the target client and the target server.
[0042] The first new file can be a file added to the source file server corresponding to the source client. The type and size of the first new file are not limited in this embodiment. The first new file is transmitted from the source file server to the target file server through the source client and the target client. The first intermediate file can be a temporary file generated during the process of transmitting the first new file to the target file server. The first intermediate file can be understood as a temporary file generated in the target file server during the process of downloading the first new file, before the first new file is completely downloaded.
[0043] In the embodiments of the present disclosure, the source client monitors whether a file update occurs in the source file server. If it is detected that a first newly added file is newly added in the source file server, the source client acquires the first newly added file, and sends the first newly added file to the target file server through the target client. During the transmission of the first newly added file, the first newly added file is landed in the target file server as a first intermediate file determined in real time according to partial data of the first newly added file that has completed transmission. If a network interruption occurs, the first newly added file that has not completed complete download is stored in the target file server, and the first newly added file that has not completed complete download is the first intermediate file.
[0044] After the network is restored, in order to complete the download of the newly added file, the source client takes the name of the first intermediate file that has not completed transmission as a resume file name, generates a resume request according to the resume file name, and sends the resume request to the target client. After the target client receives the resume request, the target client acquires the first intermediate file in the target file server according to the resume request.
[0045] In some embodiments of the present disclosure, acquiring the first intermediate file corresponding to the resume request in the target file server includes: determining the resume file name carried by the resume request; generating a file acquisition request containing the resume file name, and sending the file acquisition request to the target file server, so that the target file server determines the first intermediate file consistent with the resume file name and sends the first intermediate file to the target client; and receiving the first intermediate file sent by the target file server.
[0046] The resume file name can be the file name of the first newly added file, and the resume file name can not include an extension. The file acquisition request can be a request for acquiring a file with a file name consistent with the resume file name.
[0047] It can be understood that, since the first intermediate file is generated under the condition that the first newly added file has not completed complete transmission, the first intermediate file and the first newly added file can have the same file name except for an extension. For example, the name of the first intermediate file can be big.dest.zip, where.dest.zip is an extension; and the name of the first newly added file can be big.zip, where.zip is an extension. It can be seen that the file names of the first intermediate file and the first newly added file are both big.
[0048] In the embodiment, the target client parses the resuming request to obtain the resuming file name contained in the resuming request. Further, the target client generates a file obtaining request according to the resuming file name, and sends the file obtaining request to the target file server. After receiving the file obtaining request, the target file server parses the file obtaining request to obtain the resuming file name, concatenates the download extension name representing that the file has not been completely downloaded after the resuming file name to obtain the target file name, searches the target file server according to the target file name to obtain the first intermediate file with the file name and the extension name consistent with the target file name, and sends the first intermediate file to the target client. The target client receives the first intermediate file sent by the target file server.
[0049] In step 102, the second intermediate file sent by the source client is received; the second intermediate file is a partial file of the second new file, the second new file and the first new file have the same file path in the source file server listened by the source client, and the data amount of the second intermediate file is the same as that of the first intermediate file.
[0050] In the embodiment, the source client determines the second new file with the same file path as the first new file in the source file server, and sends the second new file to the target client. The source client can send the complete second new file to the target client, and correspondingly, the target client can receive the complete second new file and obtain the second intermediate file with the same data amount as the first intermediate file by starting from the beginning of the second new file. Alternatively, the source client can send part of the data of the second new file to the target client, and correspondingly, the target client receives the partial file of the second new file and obtains the second intermediate file with the same data amount as the first intermediate file by starting from the beginning of the partial file of the second new file.
[0051] The second intermediate file can be a temporary file generated in the process of transmitting the second new file. The second intermediate file can be understood as a temporary file generated when the second new file is not completely downloaded in the process of downloading the second new file. The file path can be an absolute path of the file, and the file path can include a folder path, a file name, and an extension.
[0052] In the embodiment, the source client determines the second new file with the same file path as the first new file in the source file server, and sends the second new file to the target client. The source client can send the complete second new file to the target client, and correspondingly, the target client can receive the complete second new file and obtain the second intermediate file with the same data amount as the first intermediate file by starting from the beginning of the second new file. Alternatively, the source client can send part of the data of the second new file to the target client, and correspondingly, the target client receives the partial file of the second new file and obtains the second intermediate file with the same data amount as the first intermediate file by starting from the beginning of the partial file of the second new file.
[0053] In some embodiments of the present disclosure, receiving the second intermediate file sent by the source client comprises: receiving second file data sent by the source client, and generating a second candidate file based on the second file data; wherein the second file data is data used for transmitting the second new file; and the second intermediate file is obtained by cutting off the first character of the second candidate file to obtain a file with a data amount consistent with the first data amount.
[0054] In some embodiments of the present disclosure, the second file data can be understood as data used for transmitting the second new file in the form of a data stream.
[0055] In the present embodiment, the data amount of the file determined by the network data amount statistics is not accurate. In order to make the target client obtain the second intermediate file with the same first data amount as the first intermediate file, the source client can send the second new file to the target client in the form of second file data, and the total data amount of the second file data is greater than the first data amount, and the total data amount of the second file data is less than or equal to the data amount of the second new file. The target client receives the second file data in real time, and generates a second candidate file based on the received second file data. It can be understood that the data amount of the second file data is greater than the first data amount, so the data amount of the second candidate file determined based on the second file data is greater than the first data amount. Further, the second intermediate file is obtained by cutting off the first character of the second candidate file to obtain a file with the same data amount as the first data amount. The second intermediate file has the same data amount as the first intermediate file.
[0056] In the above scheme, by first obtaining the second candidate file and then cutting off the second candidate file, the second intermediate file with the same data amount as the first intermediate file is obtained. Compared with the method of determining the data amount of the file by transmitting the bytes through the network, the data amount of the intermediate file determined by the method is more accurate, which creates a foundation for the subsequent comparison of the intermediate file, improves the probability of subsequent data transmission based on the first intermediate file, and improves the user experience.
[0057] In step 103, if the first intermediate file and the second intermediate file are consistent, the source file server sends the second new file to the target file server. The data after the second intermediate file is transmitted to the target file server to generate the second new file based on the first intermediate file and the data.
[0058] In some embodiments of the present disclosure, the second new file can be understood as a file that is not stored in the target file server and needs to be transmitted to the target file server. The second new file can be understood as a file that is not stored in the target file server and needs to be transmitted to the target file server.
[0059] In the embodiment, the target client can determine whether the first intermediate file and the second intermediate file are consistent through bit-by-bit comparison of bytes or a preset checking algorithm, and the like. If the first intermediate file and the second intermediate file are consistent, it indicates that the data part corresponding to the first intermediate file in the second new file has not changed, and the transmission of the second new file can continue based on the existing first intermediate file in the target file server. The target client can receive the resuming data of the second new file sent by the source client, and send the resuming data to the target file server.
[0060] After receiving the resuming data, the target file server continues the download processing of the first intermediate file according to the resuming data, until all the resuming data is received, and the resuming data completes the download processing of the first intermediate file, to obtain the second new file, thereby realizing the file synchronization between the target file server and the source file server.
[0061] In some embodiments of the present disclosure, the first intermediate file and the second intermediate file are consistent, including: calculating a first check value of the first intermediate file according to a preset checking algorithm; calculating a second check value of the second intermediate file according to the preset checking algorithm; and if the first check value and the second check value are consistent, determining that the first intermediate file and the second intermediate file are consistent.
[0062] The preset checking algorithm can be an algorithm for calculating a check sum that is preset, and there are various preset checking algorithms, which are not limited in the embodiment. For example, the preset checking algorithm can include any one of a message digest algorithm (MD5) and a national cryptographic algorithm 3.
[0063] In the embodiment, the target client calculates the first intermediate file by using the preset checking algorithm to obtain a first check value, and calculates the second intermediate file by using the preset checking algorithm to obtain a second check value. If the first check value and the second check value are the same, it indicates that the first intermediate file and the second intermediate file represented by the first check value and the second check value, respectively, are the same.
[0064] In the above scheme, the first intermediate file and the second intermediate file are efficiently determined to be the same through the check value. Moreover, the check value is the check value of part of the new file, which avoids calculating the check value of the complete new file, reduces the check bit number of the check value, and improves the efficiency of data transmission.
[0065] The data transmission method provided by the embodiments of the present disclosure comprises: in the case that a resuming request sent by a source client is received, obtaining a first intermediate file corresponding to the resuming request in a target file server; wherein the first intermediate file is a file generated by the part of data of a first new file that has been completely transmitted, and the resuming request is a request for continuing the transmission of the first new file; receiving a second intermediate file sent by the source client; wherein the second intermediate file is a part of a second new file, the second new file and the first new file have the same file path in a source file server listened by the source client, and the data amount of the second intermediate file is the same as that of the first intermediate file; if the first intermediate file and the second intermediate file are consistent, sending the resuming data of the second new file located after the second intermediate file to the target file server, so that the target file server generates the second new file according to the first intermediate file and the resuming data.
[0066] By using the above technical solution, the target client obtains the first intermediate file that has been landed in the target file server, and receives the part of the second new file (i.e., the second intermediate file) that has the same file path as the complete file (i.e., the first new file) of the first intermediate file, the data amount of the first intermediate file and the second intermediate file is the same, and they are comparable, the target client determines that the new file has not changed by determining that the first intermediate file and the second intermediate file are consistent, and thus can continue the file transmission based on the first intermediate file received before, so that the breakpoint resuming function is realized by increasing the source client and the target client without changing the file transmission function of the file server itself, and since the transmission function of the file server itself is not changed, the data migration of the file server is not needed for the update of the transmission function, and the data leakage in the data migration process is avoided.
[0067] In some embodiments of the present disclosure, the data transmission method further comprises: if the first intermediate file and the second intermediate file are not consistent, sending a file deletion instruction of the first intermediate file to the target file server, so that the target file server deletes the first intermediate file in the target file server in the case that the file deletion instruction is received; sending the second intermediate file to the target file server; receiving the resuming data sent by the source client, and sending the resuming data to the target file server.
[0068] The file deletion instruction can be an instruction for indicating the file deletion.
[0069] In this embodiment, the target client can determine whether the first intermediate file and the second intermediate file are consistent through methods such as bit-by-bit comparison of bytes and preset verification algorithms. Taking the preset verification algorithm as an example, if the first verification value of the first intermediate file determined by the preset verification algorithm is different from the second verification value of the second intermediate file determined by the preset verification algorithm, it indicates that the first intermediate file and the second intermediate file are different. Therefore, it is difficult to resume file transfer based on the first intermediate file in the current target file server.
[0070] Furthermore, the target client sends a deletion command for the first intermediate file to the target server. Upon receiving the deletion command, the target server deletes the corresponding first intermediate file and sends a confirmation deletion command to the target client. After receiving the confirmation deletion command, the target client sends a second intermediate file to the target file server, and then sends the resume data received from the source server. The target file server receives the second intermediate file and the resume data, and generates a second newly added file based on these data.
[0071] In the above scheme, if it is determined that the first intermediate file and the second intermediate file are different, it is not possible to resume the interrupted transmission of the second newly added file based on the first intermediate file that already exists in the target file server. Therefore, the first intermediate file in the target file server is deleted, and the second intermediate file and the resume transmission data are sent to the target file server to transmit the second newly added file to the target file server, thereby realizing file synchronization between the source file server and the target file server.
[0072] Figure 3 This is a flowchart illustrating another data transmission method provided in an embodiment of the present disclosure, as shown below. Figure 3 As shown, before obtaining the first intermediate file corresponding to the resume request in the target file server, the data transfer method further includes:
[0073] Step 301: Receive the first file data sent by the source client; wherein, the source client is used to listen for whether a new file has been added to the source file server, the first new file is the file added by the source file server, and the first file data is the data used to transmit the first new file.
[0074] The first file data can be understood as the data transmitted in the form of a data stream to the first newly added file.
[0075] In this embodiment, the source client listens to whether a new file has been added to the source file server. If the source client finds that the source file server has added a first new file, it initiates a synchronization connection to the target client. Through this synchronization connection, a cross-domain channel can be established between the source client and the target client.
[0076] After the cross-domain channel is successfully established, the source client sends a first file read request for the newly added file to the source file server. Upon receiving this first file read request, the source file server transmits the first file data corresponding to the newly added file to the target client in the form of a data stream through the cross-domain channel. The target client then receives this first file data.
[0077] Step 302: Send the first file data to the target file server so that the target server receives the first file data and generates the first intermediate file based on the first file data.
[0078] After receiving the first file data, the target client sends a first file storage request corresponding to the first file data to the target file server. This first file storage request instructs the target file server to receive and store the first file data. After receiving the first file storage request, the target file server returns a first storage confirmation instruction to the target client. This first storage confirmation instruction confirms that the target file server can receive and store the first file data.
[0079] After receiving the first confirmation command, the target client sends the first file data received from the source client to the target file server. Upon receiving this first file data, the target file server generates a first intermediate file based on it. It should be noted that the target client and the target file server are not the same electronic device.
[0080] In the above scheme, a portion of the first newly added file (i.e., the first intermediate file) is transmitted to the target file server through the first file data, laying the foundation for subsequent breakpoint resume transmission.
[0081] The data transmission method in this embodiment will be further illustrated by a specific example below.
[0082] Figure 4 This is a flowchart illustrating another data transmission method provided in an embodiment of the present disclosure, as shown below. Figure 4 As shown, the method includes:
[0083] Step 401: The source client listens to the source file server and discovers that a new file has been added to the source file server. The source client then initiates a synchronization connection with the target client.
[0084] Among them, a cross-domain channel can be established between the source client and the target client through synchronous linking.
[0085] Step 402: After the cross-domain channel is successfully established, the source client sends a first file read request to the source file server to obtain the first file data of the first newly added file, and then transmits the first file data to the target client through the cross-domain channel.
[0086] Step 403: After receiving the first file data, the target client sends a first file persistence request to the target file server to synchronize the first file data to the target file server.
[0087] Step 404: Due to network interruption, the transmission of the first file data was interrupted, and the first intermediate file was stored on the target file server.
[0088] Among them, network connection interruption includes one or more of the following: cross-domain channel interruption between the source client and the target client, and link channel interruption between the target client and the target file server.
[0089] When the cross-domain channel between the source client and the target client is interrupted, the source client can detect the network interruption. However, since the target client cannot return results when the cross-domain channel is interrupted, the source client cannot determine the amount of data in the first intermediate file that has been stored on the target file server.
[0090] If the link between the target client and the target file server is interrupted, the target client can return the statistical data of the first intermediate file determined by network byte statistics to the source client. However, this statistical data cannot accurately represent the actual first data volume of the first intermediate file. Therefore, the source client still has difficulty determining the data volume of the first intermediate file that has been stored on the target file server.
[0091] As can be seen, in the two network interruption scenarios mentioned above, the source client cannot confirm the amount of data in the first intermediate file that has been downloaded. Compared with related technologies, where the amount of data in some transmitted files is known, and replay attacks can be carried out based on the known amount of data, in this embodiment, since the amount of data is not known, replay attacks based on the known amount of file data are avoided.
[0092] Step 405: After the network is restored, the source client sends a resume request to the target client and performs the establishment of cross-domain channel and link channel.
[0093] After the network is restored, the source client automatically initiates a retry of the transmission of the second newly added file and resumes the interrupted transmission.
[0094] Step 406: After receiving the resume request, the target client obtains the first intermediate file that has been stored on the target file server and performs verification and comparison between the first intermediate file and the second intermediate file transmitted by the source client.
[0095] The checksum includes, but is not limited to, any one of MD5 or Chinese national cryptographic standard 3.
[0096] Step 407: If the checksums of the first intermediate file and the second intermediate file are the same, the target client sends the resume data to the target file server; if the checksums of the first intermediate file and the second intermediate file are different, the second newly added file is ignored or the first intermediate file is overwritten according to the default configuration of the target client.
[0097] Figure 5 This is a flowchart illustrating a data transmission method applied to a source client, as provided in an embodiment of this disclosure. Figure 5 As shown, the method includes:
[0098] Step 501: The source client sends the first newly added file.
[0099] Step 502: Check if the cross-domain channel was successfully established. If yes, proceed to step 503; otherwise, proceed to step 506.
[0100] Specifically, whether the source client successfully established a cross-domain channel between the source client and the target client.
[0101] Step 503: Check if the file was successfully read via the cross-domain channel. If yes, proceed to step 504; otherwise, proceed to step 505.
[0102] Step 504: Check if file synchronization with the target client was successful. If yes, proceed to step 505; otherwise, proceed to step 501.
[0103] Step 505: Check if the synchronized files pass the check. If yes, proceed to step 507; otherwise, proceed to step 501.
[0104] Step 506: Has the network been restored? If yes, proceed to step 502; otherwise, proceed to step 507.
[0105] Step 507, End.
[0106] Figure 6 This is a flowchart illustrating a data transmission method applied to a target client, as provided in an embodiment of this disclosure. Figure 6 As shown, the method includes:
[0107] Step 601: The target client receives the file.
[0108] Step 602: Check if the transmission protocol was successfully parsed. If yes, proceed to step 603; otherwise, proceed to step 608.
[0109] Step 603: Check if the link channel was successfully established. If yes, proceed to step 604; otherwise, proceed to step 608.
[0110] Step 604: Can file synchronization be performed normally? If yes, proceed to step 607; otherwise, proceed to step 605.
[0111] Step 605: Does the file verification / comparison pass? If yes, proceed to step 607; otherwise, proceed to step 606.
[0112] Step 606: Should the file be overwritten? If yes, proceed to step 607; otherwise, proceed to step 609. If the file is not overwritten, the newly added file can be ignored.
[0113] Step 607: Check if file synchronization was successful. If yes, proceed to step 609; otherwise, proceed to step 608.
[0114] Step 608, file synchronization failed.
[0115] Step 609: Complete file processing.
[0116] Step 610: Return the result to the source client.
[0117] For example, a source client might initiate synchronization of a file named big.zip to a target client. The size of big.zip is assumed to be 4 gigabytes. During the synchronization of big.zip, a cross-domain channel failure may occur between the source and target clients, or a link failure may occur between the target client and the target file server, leading to synchronization failure. In this case, the source client cannot accurately obtain the size of the first intermediate file big.dest.zip that the target client has transferred to the target file server and stored there; let's assume the size of big.dest.zip is N gigabytes (0... <N≤4)。
[0118] Upon detecting a synchronization failure, the source client initiates a retry. It still sends the entire 4GB content of big.zip. After receiving the new synchronization data, the target client first retrieves the content of big.dest.zip from the target file server and calculates its first checksum. Then, based on the size of big.dest.zip, it calculates the second checksum for the data in the new synchronization data that is the same size as big.dest.zip (i.e., the second intermediate data). It should be noted that this second intermediate data is checked over the network and is not immediately stored on the target file server.
[0119] If the first checksum and the second checksum match, it is assumed that big.zip has not been modified, and the first intermediate file is appended to the target file server until synchronization is complete.
[0120] If the first and second checksums do not match, it may be because the user has modified big.zip or big.zip has been mistakenly modified. You can configure whether to force overwrite the second newly added file or prevent it from being written again.
[0121] The above solution requires minimal adjustments to the original system architecture of the file server; it also enables cross-domain resume capability; furthermore, it provides a secure file verification mechanism, improving the security of newly added files.
[0122] Figure 7 This is a schematic diagram of a data transmission device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an electronic device or applied to a target client, such as... Figure 7 As shown, the device includes:
[0123] The acquisition module 701 is used to acquire the first intermediate file corresponding to the resume request in the target file server when a resume request is received from the source client; wherein the first intermediate file is a file generated from the part of the data that has been transferred in the first newly added file, and the resume request is a request to continue the transfer of the first newly added file.
[0124] The first receiving module 702 is used to receive the second intermediate file sent by the source client; wherein the second intermediate file is a part of the second newly added file, the second newly added file and the first newly added file have the same file path in the source file server monitored by the source client, and the second intermediate file and the first intermediate file have the same amount of data;
[0125] The first sending module 703 is configured to send the follow-up data in the second newly added file located after the second intermediate file to the target file server if the first intermediate file and the second intermediate file are identical, so that the target file server generates the second newly added file based on the first intermediate file and the follow-up data.
[0126] Optionally, the acquisition module 701 is used for:
[0127] Determine the filename of the resume file carried in the resume request;
[0128] Generate a file retrieval request containing the resume file name, and send the file retrieval request to the target file server, so that the target file server determines the first intermediate file that matches the resume file name and sends the first intermediate file to the target client;
[0129] Receive the first intermediate file sent by the target file server.
[0130] Optionally, the first receiving module 702 is used for:
[0131] The system receives second file data sent by the source client and generates a second candidate file based on the second file data; wherein the second file data is data used to transmit the second newly added file.
[0132] The second intermediate file is obtained by extracting files from the second candidate file whose data volume is consistent with that of the first intermediate file; wherein, the first data volume represents the storage space occupied by the first intermediate file.
[0133] Optionally, the first transmitting module 703 is used for:
[0134] The first verification value of the first intermediate file is calculated according to the preset verification algorithm;
[0135] The second verification value of the second intermediate file is calculated according to the preset verification algorithm;
[0136] If the first check value and the second check value are the same, then it is determined that the first intermediate file and the second intermediate file are the same.
[0137] Optionally, the device further includes:
[0138] The second sending module is configured to send a file deletion instruction for the first intermediate file to the target file server if the first intermediate file and the second intermediate file are inconsistent, so that the target file server deletes the first intermediate file in the target file server upon receiving the file deletion instruction;
[0139] The third sending module is used to send the second intermediate file to the target file server;
[0140] The second receiving module is used to receive the resume data sent by the source client and send the resume data to the target file server.
[0141] Optionally, the device further includes:
[0142] The third receiving module is used to receive first file data sent by the source client before obtaining the first intermediate file corresponding to the resume request in the target file server; wherein, the source client is used to listen for whether a new file has appeared on the source file server, the first new file is a file added by the source file server, and the first file data is data used to transmit the first new file;
[0143] The fourth sending module is used to send the first file data to the target file server, so that the target server receives the first file data and generates the first intermediate file based on the first file data.
[0144] Optionally, the source client is a client located on an intranet, and the target client is a client located on an extranet; or, the target client is a client located on the intranet, and the source client is a client located on the extranet; the source client and the target client transmit data through a cross-domain channel.
[0145] The data transmission apparatus provided in this disclosure can execute the data transmission method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method.
[0146] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Figure 8 As shown, the electronic device 800 includes one or more processors 801 and memory 802.
[0147] The processor 801 may be a central processing unit (CPU) or other form of processing unit with data transfer capability and / or instruction execution capability, and may control other components in the electronic device 800 to perform desired functions.
[0148] The memory 802 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 801 may execute the program instructions to implement the data transmission method of the embodiments of this disclosure described above and / or other desired functions. Various contents such as input signals, signal components, and noise components may also be stored in the computer-readable storage medium.
[0149] In one example, the electronic device 800 may also include an input device 803 and an output device 804, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0150] In addition, the input device 803 may also include, for example, a keyboard, a mouse, etc.
[0151] The output device 804 can output various information to the outside, including determined distance information, direction information, etc. The output device 804 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0152] Of course, for the sake of simplicity, Figure 8 Only some of the components of the electronic device 800 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 800 may include any other suitable components depending on the specific application.
[0153] In addition to the methods and devices described above, embodiments of this disclosure may also be computer program products, including computer program instructions that, when executed by a processor, cause the processor to perform the data transmission method provided in the embodiments of this disclosure.
[0154] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0155] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions that, when executed by a processor, cause the processor to perform the data transmission method provided in embodiments of this disclosure.
[0156] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0157] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0158] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data transmission method, characterized in that, Applied to the target client, including: Upon receiving a resume request from the source client, the system retrieves the first intermediate file corresponding to the resume request from the target file server; wherein the first intermediate file is a file generated from the portion of data that has been transferred in the first newly added file, and the resume request is a request to continue transferring the first newly added file. Receive a second intermediate file sent by the source client; wherein the second intermediate file is a part of the second newly added file, the second newly added file and the first newly added file have the same file path in the source file server monitored by the source client, and the second intermediate file and the first intermediate file have the same amount of data; If the first intermediate file and the second intermediate file are identical, then the resume data in the second newly added file sent by the source client, which is located after the second intermediate file, is received, and the resume data is sent to the target file server so that the target file server generates the second newly added file based on the first intermediate file and the resume data.
2. The method according to claim 1, characterized in that, The step of obtaining the first intermediate file corresponding to the resume request in the target file server includes: Determine the filename of the resume file carried in the resume request; Generate a file retrieval request containing the resume file name, and send the file retrieval request to the target file server, so that the target file server determines the first intermediate file that matches the resume file name and sends the first intermediate file to the target client; Receive the first intermediate file sent by the target file server.
3. The method according to claim 1, characterized in that, The receipt of the second intermediate file sent by the source client includes: The system receives second file data sent by the source client and generates a second candidate file based on the second file data; wherein the second file data is data used to transmit the second newly added file. The second intermediate file is obtained by extracting files from the second candidate file whose data volume is consistent with that of the first intermediate file; wherein, the first data volume represents the storage space occupied by the first intermediate file.
4. The method according to claim 1, characterized in that, The first intermediate file and the second intermediate file are identical, including: The first verification value of the first intermediate file is calculated according to the preset verification algorithm; The second verification value of the second intermediate file is calculated according to the preset verification algorithm; If the first check value and the second check value are the same, then it is determined that the first intermediate file and the second intermediate file are the same.
5. The method according to claim 1, characterized in that, The method further includes: If the first intermediate file and the second intermediate file are inconsistent, a file deletion instruction for the first intermediate file is sent to the target file server, so that the target file server deletes the first intermediate file in the target file server upon receiving the file deletion instruction; the second intermediate file is sent to the target file server; the resume data sent by the source client is received, and the resume data is sent to the target file server.
6. The method according to claim 1, characterized in that, Before obtaining the first intermediate file corresponding to the resume request in the target file server, the method further includes: The system receives first file data sent by the source client; wherein the source client is used to monitor whether a new file has been added to the source file server, the first new file is a file added by the source file server, and the first file data is data used to transmit the first new file. The first file data is sent to the target file server so that the target server receives the first file data and generates the first intermediate file based on the first file data.
7. The method according to claim 1, characterized in that, The source client is a client located on an intranet, and the target client is a client located on an extranet; or, the target client is a client located on the intranet, and the source client is a client located on the extranet. The source client and the target client transmit data through a cross-domain channel.
8. A data transmission device, characterized in that, include: The acquisition module is used to acquire the first intermediate file corresponding to the resume request in the target file server when a resume request is received from the source client; wherein the first intermediate file is a file generated from the part of the data that has been transferred in the first newly added file, and the resume request is a request to continue the transfer of the first newly added file. The first receiving module is used to receive the second intermediate file sent by the source client; wherein the second intermediate file is a part of the second newly added file, the second newly added file and the first newly added file have the same file path in the source file server monitored by the source client, and the second intermediate file and the first intermediate file have the same amount of data; The first sending module is configured to, if the first intermediate file and the second intermediate file are identical, receive the follow-up data in the second newly added file sent by the source client that is located after the second intermediate file, and send the follow-up data to the target file server, so that the target file server generates the second newly added file based on the first intermediate file and the follow-up data.
9. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the data transmission method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the data transmission method described in any one of claims 1-7.
Citation Information
Patent Citations
Method, device and system for performing data synchronization with Redis server
CN104881494A
File transmission method and device based on big data, equipment and storage medium
CN110881062A