A file transmission method, device and system
By splitting the target file into sub-files and transferring it using the sub-file list, the problem of time-consuming and uncontrollable text file transfer and insufficient network abnormal disaster recovery is solved, efficient and secure file transfer is achieved, and hardware resources are saved.
Patent Information
- Application Number
- CN202010979473.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-17
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-09-17
AI Technical Summary
In the prior art, text file transmission is not controlled, network abnormal disaster recovery is insufficient, storage servers have security risks, and hardware resources are wasted a lot.
By splitting the target file into sub-files for transmission, using the sub-file list to achieve network abnormal disaster recovery, transmitting sub-files based on the HTTP protocol, avoiding the use of storage servers, and improving security through digital signatures.
It reduces file transfer time, improves transmission efficiency, realizes network abnormal disaster recovery, avoids security risks of storage servers, saves hardware resources, and improves file transfer security.
Smart Images

Figure CN113765968B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a file transmission method, device and system. Background Art
[0002] At present, when text files are exchanged between heterogeneous systems, FTP (File Transfer Protocol), SFTP (Secure File Transfer Protocol), SMTP (Simple Mail Transfer Protocol) and other protocols are generally used to complete the transmission and sharing of text files. For example, Internet transaction systems and bank transaction systems generally involve the transmission reconciliation and audit of transaction data. To achieve such transaction data reconciliation and audit between two heterogeneous transaction systems, the transaction parties must define the header, tail, delimiter, field, file name, file storage FTP / SFTP server and other information of the data file. The text file transmission party generates the file according to the agreement and sends it to the storage server for the file receiver to download and parse.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the time consumption of text file transmission is uncontrolled. Generally, transaction reconciliation files are generated in a fixed format. However, depending on the transaction record data, the size of the generated file is uncertain, which leads to uncontrolled file transmission time consumption; the problem of network abnormality disaster recovery during the transmission process. If a network abnormality occurs during the transmission process, all the files that have been transmitted will need to be re-transmitted. At the same time, the file recipient may have started reading these incompletely transmitted files, resulting in incomplete data acquisition by the file recipient; the problem of storage server network security. For the FTP protocol itself and the specific transmission process of FTP, there are security risks in many places. The server IP, port, user name, and password are exposed to the client link, which is vulnerable to hacker attacks; the problem of hardware server resource waste. This method requires the support of the hardware storage server of the FTP / SFTP server, which will cause unnecessary waste of the server. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a file transmission method, device and system. The method, device and system split the target file into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, solve the problem of uncontrolled transmission time consumption, and the file receiver can also download concurrently through multiple threads, further improving the transmission efficiency; the sub-files are transmitted based on the sub-file list, and even if a network transmission abnormality occurs, the file receiver can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network abnormality disaster recovery problem in the sub-file transmission process; the sub-files are transmitted based on the HTTP protocol, and the file storage server is not required, which effectively avoids the network security problem of the storage server and saves hardware resources; the interactive interface between the file receiver and the file provider is verified by digital signature, which improves security.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a file transmission method is provided, comprising:
[0006] receiving a query request from a file recipient, wherein the query request is used to query a target file;
[0007] Sending a sub-file list to the file receiver, the sub-file list including identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file;
[0008] receiving a download request from the file recipient, wherein the download request includes an identifier of a target sub-file;
[0009] The target subfile corresponding to the identifier of the target subfile is sent to the file receiver.
[0010] Optionally, the method also includes splitting the target file according to the following process: obtaining a text data in the target file; determining whether a sub-file exists; if so, writing the text data into the sub-file; if not, creating an empty file, using the empty file as a sub-file, and writing the text data into the sub-file.
[0011] Optionally, before writing the text data into the sub-file, the method further includes: determining that the sub-file satisfies the following writing conditions: the sum of the size of the text data and the size of the sub-file is less than or equal to a preset first threshold; or the total number of text data in the sub-file is less than a preset second threshold.
[0012] Optionally, sending the sub-file list to the file receiver includes: sending the sub-file list to the file receiver based on HTTP protocol;
[0013] Sending the target subfile corresponding to the identifier of the target subfile to the file receiver includes: sending the target subfile corresponding to the identifier of the target subfile to the file receiver based on the HTTP protocol.
[0014] Optionally, the query request includes a first digital signature, and the download request includes a second digital signature;
[0015] Sending the sub-file list to the file recipient includes: verifying the first digital signature, and sending the sub-file list to the file recipient if the first digital signature is verified;
[0016] Sending the target subfile corresponding to the identifier of the target subfile to the file recipient includes: verifying the second digital signature, and sending the target subfile corresponding to the identifier of the target subfile to the file recipient if the second digital signature is verified successfully.
[0017] Optionally, the download request also includes a token of the target sub-file;
[0018] When the second digital signature is verified, sending the target sub-file corresponding to the identifier of the target sub-file to the file recipient includes: when the second digital signature is verified, determining whether the number of times the token of the target sub-file is used is less than or equal to a preset third threshold; if so, sending the target sub-file corresponding to the identifier of the target sub-file to the file recipient.
[0019] Optionally, the method further includes: counting the total number of entries and the total number of columns of text data in the subfile; generating subfile information based on the total number of entries and the total number of columns, and recording the subfile information in the subfile.
[0020] Optionally, before sending the target subfile corresponding to the identifier of the target subfile to the file recipient, the method further includes: encrypting the target subfile.
[0021] To achieve the above object, according to another aspect of an embodiment of the present invention, a file transmission method is provided, comprising:
[0022] Sending a query request to a file provider, wherein the query request is used to query a target file;
[0023] receiving a sub-file list fed back by the file provider, wherein the sub-file list includes identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file;
[0024] Sending a download request to the file provider, wherein the download request includes an identifier of the target sub-file;
[0025] A target sub-file corresponding to the identifier of the target sub-file is received and sent by the file provider.
[0026] Optionally, after receiving the target sub-file, the method further includes: decrypting the target sub-file to obtain a decrypted sub-file; and verifying the integrity of the decrypted sub-file.
[0027] Optionally, verifying the integrity of the decrypted sub-file includes: obtaining sub-file information from the decrypted sub-file, the sub-file information including a first total number of entries and a first total number of columns; counting the number of entries and the number of columns of text data in the decrypted sub-file to obtain a second total number of entries and a second total number of columns; determining whether the first total number of entries is equal to the second total number of entries, and whether the first total number of columns is equal to the second total number of columns; if the first total number of entries is equal to the second total number of entries, and the first total number of columns is equal to the second total number of columns, determining that the decrypted file is complete.
[0028] To achieve the above object, according to another aspect of an embodiment of the present invention, a file transmission method is provided, comprising:
[0029] The file receiving party sends a query request to the file providing party, wherein the query request is used to query the target file;
[0030] The file provider sends a sub-file list to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file;
[0031] The file receiving party sends a download request to the file providing party, wherein the download request includes an identifier of the target sub-file;
[0032] The file provider sends a target sub-file corresponding to the identifier of the target sub-file to the file receiver.
[0033] To achieve the above object, according to another aspect of an embodiment of the present invention, a data transmission device is provided, including:
[0034] A query request receiving module, used to receive a query request from a file receiver, wherein the query request is used to query a target file;
[0035] A list sending module, used to send a sub-file list to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file;
[0036] A download request receiving module, used to receive a download request from the file receiver, wherein the download request includes an identifier of a target sub-file;
[0037] The sub-file sending module is used to send a target sub-file corresponding to the identifier of the target sub-file to the file receiver.
[0038] To achieve the above object, according to another aspect of an embodiment of the present invention, a data transmission device is provided, including:
[0039] A query request sending module, used to send a query request to a file provider, wherein the query request is used to query a target file;
[0040] A list receiving module, configured to receive a sub-file list fed back by the file provider, wherein the sub-file list includes identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file;
[0041] A download request sending module, used to send a download request to the file provider, wherein the download request includes an identifier of a target sub-file;
[0042] The sub-file receiving module is used to receive a target sub-file corresponding to the identifier of the target sub-file sent by the file provider.
[0043] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a file transfer system is provided, the system comprising a file receiving subsystem and a file providing subsystem, wherein the file receiving subsystem sends a query request to the file providing subsystem, the query request is used to query a target file; the file providing subsystem sends a subfile list to the file receiving subsystem, the subfile list includes identifiers of a plurality of subfiles, wherein the plurality of subfiles are obtained by splitting the target file; the file receiving subsystem sends a download request to the file providing subsystem, the download request includes the identifier of the target subfile; the file providing subsystem sends a target subfile corresponding to the identifier of the target subfile to the file receiving subsystem.
[0044] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the file transfer method of an embodiment of the present invention.
[0045] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the file transmission method of the embodiment of the present invention is implemented.
[0046] An embodiment of the above invention has the following advantages or beneficial effects: the target file is split into sub-files for transmission, which reduces the file size, reduces the file transmission time, and improves the transmission efficiency. The file receiver can also download concurrently through multiple threads, further improving the transmission efficiency and solving the problem of uncontrolled transmission time consumption; sub-files are transmitted based on the sub-file list. Even if a network transmission anomaly occurs, the file receiver can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network anomaly disaster recovery problem during the sub-file transmission process; sub-files are transmitted based on the HTTP protocol, and no file storage server is required, which effectively avoids the network security problem of the storage server and saves hardware resources; the interactive interface between the file receiver and the file provider is verified by digital signature, thereby improving security.
[0047] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0049] Figure 1 It is a schematic diagram of the main process of the file transmission method according to an embodiment of the present invention;
[0050] Figure 2 is a schematic diagram of the main process of a file transmission method according to another embodiment of the present invention;
[0051] Figure 3 is a schematic diagram of the main process of a file transmission method according to another embodiment of the present invention;
[0052] Figure 4 is a schematic diagram of the main process of a file transmission method according to another embodiment of the present invention;
[0053] Figure 5 is a schematic diagram of main modules of a file transmission device according to an embodiment of the present invention;
[0054] Figure 6 is a schematic diagram of main modules of a file transmission device according to another embodiment of the present invention;
[0055] Figure 7 is a schematic diagram of the architecture of a file transmission system according to an embodiment of the present invention;
[0056] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0057] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0059] Figure 1 FIG. 1 is a schematic diagram of the main process of the file transmission method according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0060] Step S101: receiving a query request from a file recipient, wherein the query request is used to query a target file.
[0061] In an optional embodiment, the query request may include the date of the target file. The file provider can determine the date of the target file that the file recipient wants by the date of the target file.
[0062] Step S102: Sending a sub-file list to the file receiver, the sub-file list including identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file.
[0063] The identifier of the sub-file may be the ID of the sub-file.
[0064] In an optional embodiment, the process of splitting the target file to obtain multiple sub-files is as follows: Figure 2 As shown, including:
[0065] Step S201: obtaining a text data in a target file;
[0066] Step S202: Determine whether the sub-file exists;
[0067] Step S203: If a sub-file exists, determine whether the sub-file meets the write condition;
[0068] Step S204: if the writing condition is met, writing the text data into the sub-file;
[0069] Step S205: If the writing condition is not met, an empty file is created, the empty file is used as a new sub-file, and the text data is written into the new sub-file.
[0070] Step S206: If the sub-file does not exist, create an empty file, use the empty file as a sub-file, and write the text data into the sub-file.
[0071] In this embodiment, the target file can be split according to two strategies: specifying the file size and specifying the number of data items. Among them, the specified file size strategy sets an upper limit (i.e., the first threshold) of the sub-file size, and the size of each split sub-file cannot be greater than the upper limit. The specified data item number strategy sets an upper limit (i.e., the second threshold) of the number of text data items in the sub-file, and the number of text data items in each split sub-file cannot be greater than the upper limit. Among them, the first threshold and the second threshold can be flexibly set according to the scenario, and the present invention is not limited here.
[0072] It is worth noting that when splitting the target file according to the strategy of specifying the file size, the same text data record cannot be written into two sub-files, so before writing the text data into the sub-file, it is necessary to determine whether the sum of the sub-file size and the text data size is greater than the first threshold value. If it is greater, an empty file is created and the text data is written into the empty file. When splitting the target file according to the strategy of specifying the number of data items, it is not necessary to consider the size of the sub-files, but only to ensure that the number of text data items in the sub-files is less than or equal to the second threshold value.
[0073] For step S203, specifically, whether the sub-file meets the requirements of writing into a file can be determined according to the following process:
[0074] Determine whether the sum of the size of the text data and the size of the sub-file is less than or equal to a preset first threshold, and if so, determine that the sub-file meets the write condition; or
[0075] It is determined whether the total number of text data in the sub-file is less than or equal to a preset second threshold value, and if so, it is determined that the sub-file meets the writing condition.
[0076] In this step, the target file is split into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, and solve the problem of uncontrolled transmission time. The file receiver can also download concurrently in multiple threads to further improve the transmission efficiency.
[0077] In an optional embodiment, freemarker and velocity template engine technologies can be used to split the target file based on a template, wherein freemarker is a template engine, a general tool for generating text output based on a template, and velocity is a Java-based template engine. In actual application, the file provider can create an asynchronous task to split the target file every day, and the asynchronous task will only be completed if it is successfully executed. Otherwise, as long as the number of task failures does not reach the upper limit, the task of splitting the target file will be repeated to ensure that the target file is successfully split.
[0078] Step S103: receiving a download request from the file receiver, wherein the download request includes an identifier of a target sub-file, wherein the identifier of the target sub-file may be an ID of the target sub-file.
[0079] Step S104: sending the target sub-file corresponding to the identifier of the target sub-file to the file recipient.
[0080] In an optional embodiment, the file receiver may send multiple download requests to the file provider to download multiple target sub-files, thereby achieving multi-threaded concurrent downloading and improving download efficiency.
[0081] The file transmission method of the embodiment of the present invention splits the target file into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, and solve the problem of uncontrolled transmission time consumption. The file receiver can also download concurrently through multiple threads to further improve the transmission efficiency. Sub-files are transmitted based on the sub-file list. Even if a network transmission anomaly occurs, the file receiver can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network anomaly disaster recovery problem during the sub-file transmission process.
[0082] In an optional embodiment, the file receiver and the file provider interact based on the HTTP protocol, that is, the file receiver sends a query request and a download request to the file provider based on the HTTP protocol, and the file provider sends a sub-file list and a target sub-file to the file receiver based on the HTTP protocol. The HTTP protocol (Hyper Text Transfer Protocol) is a simple request-response protocol that specifies what kind of message a client may send to a server and what kind of response it may get.
[0083] In an optional embodiment, the query request includes a first digital signature, and the download request includes a second digital signature. The digital signature can also be figuratively called a data fingerprint, which is a digital string generated by the sender of the information. This digital string is also a valid proof of the authenticity of the information sent by the sender of the information.
[0084] In step S102, sending the sub-file list to the file recipient may include: verifying the first digital signature, and sending the sub-file list to the file recipient when the first digital signature is verified successfully.
[0085] In step S104, sending the target subfile corresponding to the identifier of the target subfile to the file recipient includes: verifying the second digital signature, and sending the target subfile corresponding to the identifier of the target subfile to the file recipient when the second digital signature is verified.
[0086] The second digital signature may be the same as or different from the first digital signature.
[0087] In this embodiment, the file provider and the file receiver agree on an algorithm for calculating the digital signature. The file receiver calculates the digital signature according to the agreed algorithm and transmits it to the file provider. The file provider calculates the digital signature according to the agreed algorithm. If the calculated signature is consistent with the received digital signature, the digital signature verification passes, otherwise the verification fails. As an example, the MD5 algorithm is used to calculate the digital signature in this embodiment. The MD5 algorithm can be used as a method of electronic signature. Using the MD5 algorithm, a unique "digital fingerprint" can be generated for any file (regardless of its size, format, or quantity). With the help of this "digital fingerprint", it can be known whether the file has been modified.
[0088] In an optional embodiment, the above-mentioned download request also includes a token of the target sub-file. In this embodiment, the token has a usage limit, and the token becomes invalid when it exceeds a certain number of times, thereby improving the security of sub-file transmission. Therefore, after the file provider verifies the second digital signature, it is necessary to determine the number of times the token of the target sub-file in the download request is used. Specifically, when the second digital signature is verified, it is determined whether the number of times the token of the target sub-file is used is less than or equal to a preset third threshold; if so, the target sub-file corresponding to the target sub-file ID is sent to the file receiver, and the number of times the token of the target sub-file is used is updated. Among them, the third threshold can be flexibly set according to the scenario, and the present invention does not limit it here.
[0089] In an optional embodiment, if the usage count of the token of the target sub-file is greater than a preset third threshold, the file provider may feedback excess information to the file recipient to prompt the file recipient that the usage count of the token is greater than the preset third threshold and the target sub-file cannot be downloaded.
[0090] In an optional embodiment, the method further comprises:
[0091] Count the total number of entries and columns of text data in the subfile;
[0092] The sub-file information is generated based on the total number of entries and the total number of columns, and the sub-file information is recorded in the sub-file.
[0093] The total number of columns of text data in the sub-file may be counted by counting the number of fields of the text data in the sub-file.
[0094] In this embodiment, when the file receiver receives the target sub-file, it can verify the integrity of the target sub-file according to the total number of entries and the total number of columns in the target sub-file.
[0095] In an optional embodiment, before sending the target subfile to the file receiver, the target subfile needs to be encrypted to improve the security of the target subfile. When sending the subfile list to the file receiver, a key can also be sent so that the file receiver can use the key to decrypt the encrypted target subfile. Specifically, the public key and private key of the RSA algorithm can be used to encrypt and decrypt the target subfile. The principle of the RSA algorithm is: according to number theory, it is relatively simple to find two large prime numbers, but it is extremely difficult to factorize their product, so the product can be made public as an encryption key.
[0096] In an optional embodiment, after encrypting the target sub-file, the file provider may also compress the encrypted target sub-file to reduce the size of the target sub-file and improve transmission efficiency.
[0097] Figure 3 FIG. 1 is a schematic diagram of the main process of the file transmission method according to an embodiment of the present invention. Figure 3 As shown, the method includes:
[0098] Step S301: sending a query request to a file provider, wherein the query request is used to query a target file;
[0099] Step S302: receiving a sub-file list fed back by the file provider, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file;
[0100] Step S303: Sending a download request to the file provider, wherein the download request includes an identifier of the target sub-file;
[0101] Step S304: receiving a target sub-file corresponding to the identifier of the target sub-file sent by the file provider.
[0102] The technical details described in detail in this embodiment can be referred to Figure 1 The present invention will not be described in detail in detail with reference to the embodiments shown.
[0103] In an optional embodiment, after receiving the target subfile, the method further includes:
[0104] Decrypting the target sub-file to obtain a decrypted sub-file;
[0105] The integrity of the decrypted sub-file is verified.
[0106] When feeding back the sub-file list, the file provider may also feed back a private key for decryption, and the file receiver decrypts the target sub-file according to the private key.
[0107] The integrity of the decrypted sub-file can be verified according to the following process:
[0108] Acquire subfile information from the decrypted subfile, the subfile information including a first total number of entries and a first total number of columns;
[0109] Counting the number of entries and columns of the text data in the decrypted sub-file to obtain a second total number of entries and a second total number of columns;
[0110] Determine whether the first total number of entries is equal to the second total number of entries, and whether the first total number of columns is equal to the second total number of columns;
[0111] If the first total number of entries is equal to the second total number of entries, and the first total number of columns is equal to the second total number of columns, it is determined that the decrypted file is complete.
[0112] The file transmission method of this embodiment splits the target file into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, and solve the problem of uncontrolled transmission time consumption. The file receiver can also download concurrently through multiple threads to further improve the transmission efficiency. Sub-files are transmitted based on the sub-file list. Even if a network transmission anomaly occurs, the file receiver can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network anomaly disaster recovery problem during the sub-file transmission process. Sub-files are transmitted based on the HTTP protocol, and no file storage server is required, which effectively avoids the network security problem of the storage server and saves hardware resources. The interactive interface between the file receiver and the file provider is verified by digital signature, thereby improving security.
[0113] Figure 4 FIG. 1 is a schematic diagram of the main process of the file transmission method according to an embodiment of the present invention. Figure 4 As shown, the method includes:
[0114] Step S401: The file receiver sends a query request to the file provider, and the query request is used to query the target file. The query request includes a first digital signature, file receiver identification information (such as file receiver number) and the date of the queried file, as shown in Table 1 below:
[0115] Table 1:
[0116]
[0117] Step S402: The file provider verifies the first digital signature, and if the first digital signature is verified, sends a sub-file list to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file. The sub-file list includes the IDs and tokens of the sub-files.
[0118] In an optional embodiment, the information sent by the file provider to the file recipient also includes: response status (including success and failure status), error code (when the corresponding status is success, the error code is 000), error information (error cause), total number of files (can be used to check whether the number of files in the file list is correct) and file summary. Specifically, the information sent by the file provider to the file recipient is shown in Table 2 below:
[0119] Table 2:
[0120]
[0121] Step S403: the file receiving party sends a download request to the file providing party, wherein the download request includes an identifier of the target sub-file, a second digital signature, and a token of the target sub-file.
[0122] The download request also includes an identifier of the file recipient (such as a file recipient number), as shown in the following Table 3:
[0123] Table 3:
[0124]
[0125]
[0126] Step S404: The file provider verifies the second digital signature. If the second digital signature is verified successfully, it is determined whether the number of times the token of the target sub-file is used exceeds a third threshold. If not, the file provider sends the target sub-file corresponding to the identifier of the target sub-file to the file recipient and updates the number of times the token is used.
[0127] In an optional embodiment, when sending the target file corresponding to the target file ID to be downloaded to the file recipient, information as shown in Table 4 may also be sent.
[0128] Table 4:
[0129] Parameter name type illustrate status String Response status: T for success, F for failure errCode String Error Code errMsg String error message
[0130] Figure 5 is a schematic diagram of the main modules of the file transmission device 500 according to an embodiment of the present invention. Figure 5 As shown, the device 500 includes:
[0131] A query request receiving module 501 is used to receive a query request from a file receiver, wherein the query request is used to query a target file;
[0132] A list sending module 502 is used to send a sub-file list to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file;
[0133] A download request receiving module 503, configured to receive a download request from the file receiver, wherein the download request includes an identifier of a target sub-file;
[0134] The subfile sending module 504 is configured to send a target subfile corresponding to the identifier of the target subfile to the file receiver.
[0135] Optionally, the device 500 also includes a splitting module, which is used to: obtain a text data in the target file; determine whether a sub-file exists; if so, write the text data into the sub-file; if not, create an empty file, use the empty file as a sub-file, and write the text data into the sub-file.
[0136] Optionally, the splitting module is also used to: determine that the sub-file meets the following writing conditions: the sum of the size of the text data and the size of the sub-file is less than or equal to a preset first threshold; or the total number of text data in the sub-file is less than a preset second threshold.
[0137] Optionally, the splitting module is further used to: determine whether the sum of the size of the text data and the size of the sub-file is less than or equal to a preset first threshold, and if so, determine that the sub-file meets the writing condition; or
[0138] It is determined whether the total number of text data in the sub-file is less than or equal to a preset second threshold value, and if so, it is determined that the sub-file meets the writing condition.
[0139] Optionally, the list sending module 502 is further used to: send the sub-file list to the file receiver based on the HTTP protocol;
[0140] Optionally, the sub-file sending module 504 is further configured to: send a target sub-file corresponding to the identifier of the target sub-file to the file recipient based on the HTTP protocol.
[0141] Optionally, the query request includes a first digital signature, and the download request includes a second digital signature;
[0142] The list sending module 502 is further used to: verify the first digital signature, and send the sub-file list to the file recipient when the first digital signature is verified;
[0143] The sub-file sending module 504 is further used to verify the second digital signature, and if the second digital signature is verified, send the target sub-file corresponding to the identifier of the target sub-file to the file recipient.
[0144] Optionally, the download request also includes a token of the target sub-file;
[0145] The sub-file sending module 504 is also used to: when the second digital signature verification is passed, determine whether the number of times the token of the target sub-file is used is less than or equal to a preset third threshold; if so, send the target sub-file corresponding to the identifier of the target sub-file to the file recipient.
[0146] Optionally, the device 500 further comprises a statistical module, which is used to: count the total number of text data items and the total number of columns in the subfile; generate subfile information based on the total number of items and the total number of columns, and record the subfile information in the subfile.
[0147] Optionally, the device 500 further includes an encryption module, configured to encrypt the target sub-file.
[0148] The file transmission device of this embodiment splits the target file into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, and solve the problem of uncontrolled transmission time consumption. The file recipient can also download concurrently through multiple threads to further improve the transmission efficiency. Sub-files are transmitted based on the sub-file list. Even if a network transmission anomaly occurs, the file recipient can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network anomaly disaster recovery problem during the sub-file transmission process. Sub-files are transmitted based on the HTTP protocol, and no file storage server is required, which effectively avoids the network security problem of the storage server and saves hardware resources. The interactive interface between the file recipient and the file provider is verified by digital signature, which improves security.
[0149] Figure 6 FIG. 6 is a schematic diagram of main modules of a file transmission device 600 according to another embodiment of the present invention. Figure 6 As shown, the device 600 includes:
[0150] A query request sending module 601 is used to send a query request to a file provider, wherein the query request is used to query a target file;
[0151] A list receiving module 602 is used to receive a sub-file list fed back by the file provider, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file;
[0152] A download request sending module 603, configured to send a download request to the file provider, wherein the download request includes an identifier of a target sub-file;
[0153] The sub-file receiving module 604 is configured to receive a target sub-file corresponding to the identifier of the target sub-file sent by the file provider.
[0154] Optionally, the device 600 further includes a verification module, which is used to: decrypt the target sub-file to obtain a decrypted sub-file; and verify the integrity of the decrypted sub-file.
[0155] Optionally, the verification module is also used to: obtain file information from the decrypted sub-file, the file information including a first total number of entries and a first total number of columns; count the number of entries and the number of columns of text data in the decrypted sub-file to obtain a second total number of entries and a second total number of columns; determine whether the first total number of entries is equal to the second total number of entries, and whether the first total number of columns is equal to the second total number of columns; if the first total number of entries is equal to the second total number of entries, and the first total number of columns is equal to the second total number of columns, then determine that the decrypted file is complete.
[0156] Figure 7 FIG. 7 is a schematic diagram of the architecture of a file transmission system 700 according to an embodiment of the present invention. Figure 7 As shown, the system 700 includes a file receiving subsystem 701 and a file providing subsystem 702, wherein:
[0157] The file receiving subsystem 701 sends a query request to the file providing subsystem 702, wherein the query request is used to query the target file;
[0158] The file providing subsystem 702 sends a subfile list to the file receiving subsystem 701, wherein the subfile list includes identifiers of multiple subfiles, wherein the multiple subfiles are obtained by splitting the target file;
[0159] The file receiving subsystem 701 sends a download request to the file providing subsystem 702, wherein the download request includes an identifier of a target subfile;
[0160] The file providing subsystem 702 sends the target subfile corresponding to the identifier of the target subfile to the file receiving subsystem 701 .
[0161] The above-mentioned device and system can execute the method provided by the embodiment of the present invention, and have the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0162] Figure 8An exemplary system architecture 800 is shown to which the file transmission method or the file transmission device according to the embodiment of the present invention can be applied.
[0163] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0164] The user can use the terminal devices 801, 802, 803 to interact with the server 805 through the network 804 to receive or send messages, etc. Various communication client applications, such as web browser applications, can be installed on the terminal devices 801, 802, 803.
[0165] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to tablet computers, laptop computers, and desktop computers.
[0166] The server 805 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 801, 802, and 803. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information and product information) to the terminal device.
[0167] It should be noted that the file transmission method provided in the embodiment of the present invention is generally executed by the server 805 , and accordingly, the file transmission device is generally disposed in the server 805 .
[0168] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0169] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0170] like Fig. 9As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0171] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.
[0172] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.
[0173] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0175] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute a limitation on the unit itself. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."
[0176] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0177] receiving a query request from a file recipient, wherein the query request is used to query a target file;
[0178] Sending a sub-file list to the file receiver, the sub-file list including identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file;
[0179] receiving a download request from the file recipient, wherein the download request includes an identifier of a target sub-file;
[0180] The target subfile corresponding to the identifier of the target subfile is sent to the file receiver.
[0181] The technical solution of the embodiment of the present invention splits the target file into sub-files for transmission, which can reduce the transmission time, improve the transmission efficiency, solve the problem of uncontrolled transmission time consumption, and the file receiver can also download concurrently through multiple threads to further improve the transmission efficiency; the sub-files are transmitted based on the sub-file list, and even if a network transmission anomaly occurs, the file receiver can re-download and obtain the abnormal sub-file according to the sub-file list, thereby solving the network anomaly disaster recovery problem in the sub-file transmission process; the sub-files are transmitted based on the HTTP protocol, and no file storage server is required, which effectively avoids the network security problem of the storage server and saves hardware resources; the interactive interface between the file receiver and the file provider is verified by digital signature, thereby improving security.
[0182] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A file transmission method, characterized in that: include: receiving a query request from a file recipient, wherein the query request is used to query a target file; Sending a sub-file list and a total number of files to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file; and the total number of files is used to check whether the number of files in the file list is correct; receiving a download request from the file recipient, wherein the download request includes an identifier of a target sub-file; The target subfile corresponding to the identifier of the target subfile is sent to the file receiver.
2. The method according to claim 1, characterized in that The method further comprises splitting the target file according to the following process; Get a text data in the target file; Determine whether the sub-file exists; If it exists, write the text data into the subfile; If it does not exist, an empty file is created, the empty file is used as a sub-file, and the text data is written into the sub-file.
3. The method according to claim 2, characterized in that include: Before writing the text data into the subfile, the method further comprises: Determine that the sub-file meets the following writing conditions: The sum of the size of the text data and the size of the subfile is less than or equal to a preset first threshold; or The total number of text data in the sub-file is less than a preset second threshold.
4. The method according to any one of claims 1 to 3, characterized in that: Sending the sub-file list to the file receiver includes: sending the sub-file list to the file receiver based on the HTTP protocol; Sending the target subfile corresponding to the identifier of the target subfile to the file receiver includes: sending the target subfile corresponding to the identifier of the target subfile to the file receiver based on the HTTP protocol.
5. The method according to claim 4, characterized in that The query request includes a first digital signature, and the download request includes a second digital signature; Sending the sub-file list to the file receiver includes: Verifying the first digital signature, and sending the sub-file list to the file recipient if the first digital signature is verified successfully; Sending the target subfile corresponding to the identifier of the target subfile to the file receiver includes: The second digital signature is verified, and if the second digital signature is verified successfully, a target sub-file corresponding to the identifier of the target sub-file is sent to the file recipient.
6. The method according to claim 5, characterized in that The download request also includes a token of the target sub-file; When the second digital signature is verified successfully, sending the target subfile corresponding to the identifier of the target subfile to the file recipient includes: If the second digital signature is verified successfully, determining whether the number of times the token of the target subfile is used is less than or equal to a preset third threshold; If so, the target subfile corresponding to the identifier of the target subfile is sent to the file recipient, and the number of times the second digital signature is used is updated.
7. The method according to claim 6, characterized in that The method further comprises: Count the total number of entries and columns of text data in the subfile; The sub-file information is generated based on the total number of entries and the total number of columns, and the sub-file information is recorded in the sub-file.
8. The method according to claim 7, characterized in that Before sending the target subfile corresponding to the identifier of the target subfile to the file recipient, the method further includes: encrypting the target subfile.
9. A file transmission method, characterized in that: include: Sending a query request to a file provider, wherein the query request is used to query a target file; receiving a sub-file list and a total number of files fed back by the file provider, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file; and the total number of files is used to check whether the number of files in the file list is correct; Sending a download request to the file provider, wherein the download request includes an identifier of the target sub-file; A target sub-file corresponding to the identifier of the target sub-file is received and sent by the file provider.
10. The method according to claim 9, characterized in that After receiving the target subfile, the method further includes: Decrypting the target sub-file to obtain a decrypted sub-file; The integrity of the decrypted sub-file is verified.
11. The method according to claim 10, characterized in that Verifying the integrity of the decrypted sub-file includes: Acquire subfile information from the decrypted subfile, the subfile information including a first total number of entries and a first total number of columns; Counting the number of entries and columns of the text data in the decrypted sub-file to obtain a second total number of entries and a second total number of columns; Determine whether the first total number of entries is equal to the second total number of entries, and whether the first total number of columns is equal to the second total number of columns; If the first total number of entries is equal to the second total number of entries, and the first total number of columns is equal to the second total number of columns, it is determined that the decrypted subfile is complete.
12. A file transmission method, characterized in that: include: The file receiving party sends a query request to the file providing party, wherein the query request is used to query the target file; The file provider sends a sub-file list and a total number of files to the file receiver, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file; and the total number of files is used to check whether the number of files in the file list is correct; The file receiving party sends a download request to the file providing party, wherein the download request includes an identifier of the target sub-file; The file provider sends a target sub-file corresponding to the identifier of the target sub-file to the file receiver.
13. A data transmission device, characterized in that: include: A query request receiving module, used to receive a query request from a file receiver, wherein the query request is used to query a target file; a list sending module, used for sending a sub-file list and a total number of files to the file receiver, wherein the sub-file list includes identifiers of a plurality of sub-files, wherein the plurality of sub-files are obtained by splitting the target file; and the total number of files is used for checking whether the number of files in the file list is correct; A download request receiving module, used for receiving a download request from the file receiver, wherein the download request includes an identifier of a target sub-file; The sub-file sending module is used to send a target sub-file corresponding to the identifier of the target sub-file to the file receiver.
14. A data transmission device, characterized in that: include: A query request sending module, used to send a query request to a file provider, wherein the query request is used to query a target file; a list receiving module, configured to receive a sub-file list and a total number of files fed back by the file provider, wherein the sub-file list includes identifiers of multiple sub-files, wherein the multiple sub-files are obtained by splitting the target file; and the total number of files is used to check whether the number of files in the file list is correct; A download request sending module, used to send a download request to the file provider, wherein the download request includes an identifier of a target sub-file; The sub-file receiving module is used to receive a target sub-file corresponding to the identifier of the target sub-file sent by the file provider.
15. A file transmission system, characterized in that: The system comprises a file receiving subsystem and a file providing subsystem, wherein: The file receiving subsystem sends a query request to the file providing subsystem, wherein the query request is used to query the target file; The file providing subsystem sends a subfile list and a total number of files to the file receiving subsystem, wherein the subfile list includes identifiers of multiple subfiles, wherein the multiple subfiles are obtained by splitting the target file; and the total number of files is used to check whether the number of files in the file list is correct; The file receiving subsystem sends a download request to the file providing subsystem, wherein the download request includes an identifier of a target subfile; The file providing subsystem sends a target subfile corresponding to the identifier of the target subfile to the file receiving subsystem.
16. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 12.
17. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Multi-sub-stream media transmission system based on HTTP protocol and transmission method thereof
CN101951412A
Video file downloading method and device
CN106686083A