CN111385354A - File transmission method and device, electronic equipment and nonvolatile storage medium - Google Patents

File transmission method and device, electronic equipment and nonvolatile storage medium Download PDF

Info

Publication number
CN111385354A
CN111385354A CN202010135368.4A CN202010135368A CN111385354A CN 111385354 A CN111385354 A CN 111385354A CN 202010135368 A CN202010135368 A CN 202010135368A CN 111385354 A CN111385354 A CN 111385354A
Authority
CN
China
Prior art keywords
real
file
time file
time
downloading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010135368.4A
Other languages
Chinese (zh)
Inventor
马苏晨
周晓煜
袁梦杰
郝慧涛
韩鹏宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Rajax Network Technology Co Ltd
Original Assignee
Rajax Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rajax Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN202010135368.4A priority Critical patent/CN111385354A/en
Publication of CN111385354A publication Critical patent/CN111385354A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The embodiment of the invention relates to the technical field of communication, and discloses a file transmission method, a file transmission device, electronic equipment and a nonvolatile storage medium. The method comprises the following steps: acquiring codes and check values of real-time file blocks obtained by segmenting a target file, wherein the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks; downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed; and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence. The invention can improve the file transmission efficiency and achieve the purposes of saving flow and time.

Description

File transmission method and device, electronic equipment and nonvolatile storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a file transmission method and apparatus, an electronic device, and a non-volatile storage medium.
Background
At present, a server often needs to transmit files to a terminal for the terminal to use, and common files include software upgrade packages, videos, audios and the like. When the file is large, in order to increase the speed of file transmission, the target file is generally divided into a plurality of file blocks in advance, and then all the file blocks are issued to the receiving terminal; and the receiving terminal randomly downloads each file block and merges all the file blocks after downloading all the file blocks so as to finish the file transmission.
However, the inventor finds that, in the current file transmission mode, as long as downloading of one file block in a file fails, downloading of the whole file fails, so that downloading of a plurality of file blocks included in the file is triggered, and downloading again wastes traffic and downloading time, thereby reducing downloading efficiency.
Disclosure of Invention
The embodiment of the invention aims to provide a file transmission method, a file transmission device, electronic equipment and a nonvolatile storage medium, which can improve the file transmission efficiency and save the flow.
In order to solve the above technical problem, an embodiment of the present invention provides a file transmission method, which is applied to a terminal, and includes: acquiring codes and check values of real-time file blocks obtained by segmenting a target file, wherein the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks; downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed; and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence.
The embodiment of the invention also provides a file transmission method, which is applied to a server and comprises the following steps: acquiring a target file; segmenting a target file according to the performance of a terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block; and sending the real-time file blocks, the codes corresponding to the real-time file blocks and the check values to the terminal according to the coding sequence.
An embodiment of the present invention further provides a file transfer apparatus, including: the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring codes and check values of real-time file blocks obtained by segmenting a target file, the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks; the downloading module is used for downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values and downloading the next real-time file block after the verification is passed; and the merging module is used for merging all real-time file blocks into the target file according to the coding sequence after the downloading and the verification of the last real-time file block are finished.
An embodiment of the present invention further provides a file transfer apparatus, including: the acquisition module is used for acquiring a target file; the segmentation module is used for segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating the downloading sequence to each real-time file block; and the transmission module is used for transmitting the real-time file blocks, the codes corresponding to the real-time file blocks and the check values to the terminal according to the coding sequence.
Embodiments of the present invention further provide an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor executes the program to perform: acquiring codes and check values of real-time file blocks obtained by segmenting a target file, wherein the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks; downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed; and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence.
Embodiments of the present invention further provide an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor executes the program to perform: acquiring a target file; segmenting a target file according to the performance of a terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block; and sending the real-time file blocks, the codes corresponding to the real-time file blocks and the check values to the terminal according to the coding sequence.
Embodiments of the present invention also provide a nonvolatile storage medium storing a computer-readable program for causing a computer to execute the file transfer method applied to a terminal as above.
Embodiments of the present invention also provide a nonvolatile storage medium storing a computer-readable program for causing a computer to execute the file transfer method applied to the server as above.
Compared with the prior art, the implementation mode of the invention has the main differences and the effects that: the size of the real-time file block is determined according to the terminal performance, namely the size of the real-time file block is dynamically adjusted according to the terminal performance, so that the file transmission efficiency can be improved. The server adds codes to each real-time file block, and the terminal downloads the real-time file blocks according to the coding sequence, namely the starting byte position of the next coded real-time file block is continuous with the ending byte position of the last coded real-time file block, so that the rest target files are continuous rather than disconnected, and the size of the real-time file blocks can be better adjusted. Moreover, the current real-time file block is downloaded and the next real-time file block is downloaded after the current real-time file block passes the verification, so that all the downloaded real-time file blocks can be guaranteed to be effective, the failure of downloading the whole target file and the waste of flow caused by the error of a certain real-time file block after the downloading of all the real-time file blocks are avoided, and the flow and the time can be saved.
In addition, the size of the real-time file block is determined according to the performance of the terminal by the following means: and sending the performance updating data of the terminal to the server, so that the server can adjust the size of the real-time file block according to the performance updating data. And the terminal sends the performance updating data to the server, so that the server can adjust the size of the real-time file block in time according to the performance of the terminal.
In addition, before acquiring the coding and check values of the real-time file blocks obtained by segmenting the target file, the method further comprises the following steps: acquiring the total length of a target file; before downloading the next real-time file block, the method further comprises the following steps: acquiring the accumulated length of all downloaded real-time file blocks, and judging whether the accumulated length is equal to the total length or not; if the accumulated length is smaller than the total length, downloading the next real-time file block; if the accumulated length is equal to the total length, it is determined that the downloading of the last real-time file block is completed. Since the size of the real-time file blocks is determined by the terminal capabilities, i.e. the lengths of the real-time file blocks are not uniform. The terminal can conveniently judge when to merge all real-time file blocks by judging the relation between the accumulation length and the total length.
In addition, after the real-time file block is verified according to the verification value, the method further comprises the following steps: and if the verification fails, re-downloading the real-time file block for re-verification. When the real-time block check fails, the real-time file block is downloaded and checked again, so that the check success probability of the real-time file block is improved, and the file transmission efficiency is improved.
In addition, before re-downloading the real-time file block for re-verification, the method further comprises the following steps: and judging that the re-downloading times of the real-time file blocks are smaller than a preset re-downloading time threshold value. When the re-downloading times are smaller than the re-downloading time threshold value, re-downloading and checking the real-time file block; and when the number of times of re-downloading exceeds the threshold value of the number of times of re-downloading, not downloading again.
In addition, after all real-time file blocks are combined into a target file according to the coding sequence, the method further comprises the following steps: acquiring a check value of a target file at a server side and a local check value of the merged target file; when the check value is matched with the local check value, the transmission of the target file is completed; and when the check value is not matched with the local check value, clearing the merged target file. And the reliability and the accuracy of target file transmission can be improved by checking again after merging.
Drawings
Fig. 1 is a flowchart of a file transfer method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a file transfer method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a file transfer method according to a third embodiment of the present invention;
FIG. 4 is a schematic view of a document transportation apparatus according to a fourth embodiment of the present invention;
FIG. 5 is a schematic view of a document transportation apparatus according to a fifth embodiment of the present invention;
FIG. 6 is a schematic structural diagram of an electronic device according to a sixth embodiment of the invention;
fig. 7 is a schematic structural diagram of an electronic device according to a seventh embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments. The following embodiments are divided for convenience of description, and should not constitute any limitation to the specific implementation of the present invention, and the embodiments may be mutually incorporated and referred to without contradiction.
The first embodiment of the present invention relates to a file transmission method, which is applied to a terminal, where the terminal may be a mobile phone, a tablet computer, etc., but is not limited thereto. In the embodiment, the coding and the check value of the real-time file block obtained by segmenting the target file are obtained, wherein the size of the real-time file block is determined according to the performance of the terminal, and the coding is used for indicating the downloading sequence of the real-time file block; downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed; and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence. The following describes implementation details of the file transfer method according to the present embodiment in detail, and the following description is only provided for easy understanding and is not necessary to implement the present embodiment.
Fig. 1 shows a flowchart of a file transfer method according to this embodiment, which specifically includes:
step S101, acquiring codes and check values of real-time file blocks obtained by segmenting a target file, wherein the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks.
The server may determine the size of the real-time file block according to the performance of the terminal by: and receiving the performance updating data of the terminal sent to the server by the terminal, so that the server can adjust the size of the real-time file block according to the performance updating data.
Specifically, after the terminal completes performance updating, the updated performance updating data is sent to the server, so that the server can adjust the size of the real-time file block in time according to the performance updating data, and the file transmission efficiency is improved.
In one example, the terminal performance includes performance parameters such as the size of the terminal memory, the receiving speed of the terminal, and the running speed of the terminal CPU. For example, when the memory of the terminal is large, a large real-time file block is divided from the target file, that is, the byte length of the real-time file block is long; correspondingly, when the memory of the terminal is small, a small real-time file block is divided from the target file.
In this embodiment, the server encodes the real-time file blocks according to the dividing order of the real-time file blocks, and the encoding is used for indicating the downloading order of the real-time file blocks. For example, the code of the first real-time file block divided from the target file is 1, and the code of the second real-time file block is 2; accordingly, the terminal downloads the real-time file block encoded as 1 first, and then downloads the real-time file block encoded as 2.
Further, real-time file blocks with adjacent encodings are contiguous. I.e. each real-time file block comprises several bytes, the start byte of the next real-time file block is consecutive to the end byte of the previous real-time file block. Therefore, the selection range of the next real-time file block is ensured to be continuous, and all the remaining target files are obtained, namely the selection range of the real-time file block is the remaining continuous target files, so that the server can dynamically adjust the size of the real-time file block conveniently.
In this embodiment, the check value of the real-time file block is a parameter, such as a hash value, capable of checking the integrity of the real-time file block.
And S102, downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed.
Specifically, the terminal downloads the real-time file blocks and acquires the check values of the real-time file blocks according to the coding sequence, and calculates the local check values of the downloaded real-time file blocks after the downloading of the real-time file blocks is completed; and comparing whether the local check value is matched with the check value, if so, the real-time file block passes the check, and downloading the next encoded real-time file block.
The checking method of the real-time file blocks comprises parity checking, BCC exclusive-or checking, MD5 checking and digital signature.
Taking the check value of the real-time file block as an example of parity check, after the terminal finishes downloading the current real-time file block, calculating the parity check value of the downloaded current real-time file block as a local check value, matching the calculated parity check value with the parity check value of the real-time file block acquired from the server, and if the calculated parity check value is matched with the parity check value of the real-time file block, checking the current real-time file block to download the next real-time file block; if not, the current real-time file block is not verified.
In this embodiment, since the downloading of the previous real-time file block is limited and the next real-time file block can be downloaded only after the previous real-time file block passes the verification, that is, the downloading of the next real-time file block can be triggered only after the previous real-time file block passes the verification, the waste of flow and time caused by the fact that the whole target file needs to be downloaded again due to an error of a certain real-time file block after the downloading of all the file blocks is completed can be avoided. Therefore, the purposes of saving flow and time are achieved.
And step S103, after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence.
Specifically, the server encodes the real-time file blocks according to the dividing sequence of dividing the real-time file blocks from the target file, i.e. the real-time file blocks encoded adjacently are continuous. After the downloading and the verification of the last real-time file block are finished, the real-time file blocks are combined according to the coding sequence to obtain a complete target file.
Step S104, after all real-time file blocks are merged into a target file according to the coding sequence, the method further comprises the following steps: acquiring a check value of the target file at the server side and a local check value of the merged target file, and judging whether the check value is matched with the local check value; when the check value is matched with the local check value, the transmission of the target file is completed; and when the check value is not matched with the local check value, clearing the merged target file.
Specifically, the terminal acquires a check value of the target file from the server, acquires a local check value of the merged target file after the terminal completes merging of all real-time file blocks, completes transmission of the target file when the check value is matched with the local check value, and stores the merged target file; and when the check value is not matched with the local check value, clearing the merged target file.
Further, after the merged target file is cleared, the server starts to perform blocking and encoding on the target file again, and the terminal also starts to download the real-time file blocks corresponding to the encoding again.
In the embodiment, the merged target file is verified, whether the merged target file is complete or not can be checked, and the reliability and the accuracy of file transmission are further ensured.
The method and the device can dynamically adjust the size of the real-time file block according to the performance of the terminal so as to adapt to more terminals with different performances and improve the file transmission efficiency; the real-time file blocks are coded, the terminal downloads the real-time file blocks according to the coding sequence, the current real-time file block is downloaded and is verified, and then the next real-time file block is downloaded, so that the integrity of all the downloaded real-time file blocks is ensured, the problem that the whole target file fails to be downloaded due to the fact that a certain real-time file block is wrong is avoided, and flow and time can be saved.
The second embodiment of the invention relates to a file transmission method which is applied to a terminal. The second embodiment is substantially the same as the first embodiment, and mainly differs therefrom in that: the second embodiment explains the condition for merging real-time file blocks. As shown in fig. 2, the file transfer method in this embodiment includes the following steps:
in step S201, before the coding and checking values of the real-time file block obtained by segmenting the target file are obtained, the total length of the target file is also obtained.
Specifically, the total length of the target file can be obtained before the target file is not divided; or, when the coding and check value of the first real-time file block is obtained, the total length of the target file is obtained; or, the total length of the target file is obtained before downloading the next real-time file block, and the total length of the target file is the number of bytes contained in the target file.
Specifically, the size of the real-time file block is determined according to the performance of the terminal, and the code is used for indicating the downloading sequence of the real-time file block.
And S202, downloading the real-time file blocks according to the coding sequence, and verifying the real-time file blocks according to the verification values.
In this embodiment, the downloading of the next real-time file block is performed after the real-time file block check is passed; and if the real-time file block is not verified, re-downloading the real-time file block for re-verification.
In this embodiment, before re-downloading the real-time file block for re-verification, the method further includes: and judging that the re-downloading times of the real-time file blocks are smaller than a preset re-downloading time threshold value.
Specifically, a threshold value of the number of times of re-downloading can be preset; wherein, the numerical value of the threshold value of the number of times of downloading again is adjusted according to the network quality; and when the number of times of re-downloading exceeds the threshold value of the number of times of re-downloading, clearing all real-time file blocks which are downloaded. In practical application, when the network quality is poor and the file transmission speed is slow, the threshold value of the number of times of re-downloading can be reduced, and unnecessary traffic waste and time consumption are avoided; when the network quality is better and the file transmission speed is higher, the threshold value of the re-downloading times can be improved, the probability that the real-time file blocks pass the verification and the downloading is convenient to improve, the waste of flow and time caused by emptying all downloaded real-time file blocks and re-downloading is avoided, and the file transmission efficiency is favorably improved.
Step S203, obtaining the accumulated length of all downloaded real-time file blocks, and determining whether the accumulated length is equal to the total length to calculate the accumulated length.
Specifically, before downloading the next real-time file block, the method further includes: acquiring the accumulated length of all downloaded real-time file blocks, and judging whether the accumulated length is equal to the total length or not; if the accumulated length is smaller than the total length, the next real-time file block is downloaded again, and the step S202 is returned; if the accumulated length is equal to the total length, it is determined that the downloading of the last real-time file block is completed, and step S204 is executed.
And step S204, merging all real-time file blocks into a target file according to the coding sequence.
Specifically, when the accumulated duration is equal to the total length, which indicates that all real-time file blocks obtained by segmenting the target file have been completely downloaded, all downloaded real-time file blocks are combined according to the coding sequence.
Step S205, recheck the merged target file.
Steps S201, S202, S204, and S205 in this embodiment have similar parts to steps S101, S102, S103, and S104 in the first embodiment, and are not described again here.
In this embodiment, the size of the real-time file block is determined by the terminal performance, that is, the lengths of the real-time file blocks are not uniform. The relation between the accumulation length and the total length is judged so that the terminal can conveniently judge when all real-time file blocks are merged, and the relation between the accumulation length and the total length is compared to serve as a merging condition, so that the calculation amount is small and accurate, and the file transmission efficiency can be further improved. In addition, the re-downloading time threshold is set according to the network quality, so that the re-downloading time threshold is reduced under the condition of poor network quality, the data transmission can be stopped in time, and unnecessary flow waste and time consumption are avoided; under the condition of better network quality, the real-time file blocks are downloaded for multiple times by increasing the threshold value of the number of times of re-downloading, so that the probability that the real-time file blocks pass the verification is improved, and the aim of saving flow and time is fulfilled.
The third embodiment of the invention relates to a file transmission method which is applied to a server. As shown in fig. 3, the file transfer method in this embodiment includes the following steps:
s301, acquiring a target file.
Specifically, the server may receive the target file from another server, or the user may upload the target file to the server through the user input interface.
S302, segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block.
Specifically, the server can be connected with the terminal to obtain the performance data of the terminal, further analyze the performance of the terminal and determine the size of the real-time file block based on the performance of the terminal; or the server receives the terminal performance data uploaded by the terminal, and further determines the size of the real-time file block.
Further, the server adds a coding and check value for each real-time file block. And adding codes to the real-time file blocks according to the dividing sequence of dividing the real-time file blocks from the target file.
And S303, sending the real-time file block, the code corresponding to the real-time file block and the check value to the terminal according to the coding sequence.
In a specific example, the server may also obtain the length of the target file and transmit the length to the terminal.
In the embodiment, the server determines the size of the real-time file block according to the performance of the terminal, and can adapt to terminals with different performances; and the adjacent coded real-time file blocks are continuous, so that the residual target files are continuous, the server can adjust the size of the real-time file blocks better, and the file transmission efficiency is improved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A fourth embodiment of the present invention relates to a file transfer apparatus, as shown in fig. 4, including:
a first obtaining module 401, configured to obtain a code and a check value of a real-time file block obtained by segmenting a target file, where the size of the real-time file block is determined according to the performance of a terminal, and the code is used to indicate a downloading order of the real-time file block;
a downloading module 402, configured to download the real-time file blocks according to the coding sequence, check the real-time file blocks according to the check values, and download the next real-time file block after the check is passed;
a merging module 403, configured to merge all real-time file blocks into a target file according to the coding sequence after the downloading and verification of the last real-time file block are completed.
In a specific example, the file transmission apparatus may further include a performance update module (not shown) configured to send performance update data of the terminal to the server, so that the server adjusts the size of the real-time file block according to the performance update data.
In a specific example, the file transmission apparatus may further include a second obtaining module 405 and a length accumulating module 406; the second obtaining module 405 is configured to obtain a total length of the target file; the length accumulation module 406 is configured to obtain accumulated lengths of all downloaded real-time file blocks, and instruct the downloading module 402 to download a next real-time file block when the accumulated length is smaller than the total length; when the accumulated length is equal to the total length, it is determined that the downloading of the last real-time file block is completed, and the merging module 403 is triggered.
In a specific example, the downloading module 402 is further configured to re-download the real-time text plus block for re-verification when the downloaded real-time text plus block fails to be verified.
In a specific example, the downloading module 402 is specifically configured to, when the downloaded real-time text plus block fails to be verified and the number of times of re-downloading of the real-time text plus block is smaller than a preset threshold value of the number of times of re-downloading, re-download the real-time text plus block for re-verification.
In a specific example, the file transmission apparatus further includes a checking module 407, configured to obtain, after the merging module 403 merges all the real-time file blocks into the target file, a check value of the target file on the server side and a local check value of the merged target file, and determine whether the check value matches the local check value; when the check value is matched with the local check value, the transmission of the target file is completed; and when the check value is not matched with the local check value, clearing the merged target file.
It should be understood that this embodiment is an example of an apparatus corresponding to the above-described embodiment of the file transfer method applied to the terminal, and this embodiment may be implemented in cooperation with the above-described embodiment. The related technical details mentioned in the above embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related art details mentioned in the present embodiment can also be applied to the above-described method embodiment.
In the embodiment, the size of the real-time file block is determined according to the terminal performance, namely the size of the real-time file block is dynamically adjusted according to the terminal performance, so that the file transmission efficiency can be improved; the real-time file blocks are coded and the terminal downloads the real-time file blocks according to the coding sequence, so that the size adjusting range of the next real-time file block is the remaining target file, the aim of dynamic adjustment can be further fulfilled, the flow is further saved, and the downloading efficiency is improved; and the current real-time file block is downloaded and the next real-time file block is downloaded after the current real-time file block passes the verification, so that all the downloaded real-time file blocks are guaranteed to be effective, the failure of downloading the whole target file due to the error of a certain real-time file block is avoided, and the flow and the time can be saved.
A fifth embodiment of the present invention relates to a document transporting apparatus, as shown in fig. 5, including:
an obtaining module 501, configured to obtain a target file;
a segmenting module 502, configured to segment the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and add a coding and check value for indicating a downloading order to each real-time file block;
and a transmission module 503, configured to send the real-time file block, the code corresponding to the real-time file block, and the check value to the terminal according to the coding sequence.
In the embodiment, the server determines the size of the real-time file block according to the performance of the terminal, and can adapt to terminals with different performances; and the adjacent coded real-time file blocks are continuous, so that the residual target files are continuous, the server can adjust the size of the real-time file blocks better, and the file transmission efficiency is improved.
It should be understood that this embodiment is an apparatus example corresponding to the above-described embodiment of the file transfer method applied to the server, and this embodiment may be implemented in cooperation with the above-described method embodiment. The related technical details mentioned in the above method embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related art details mentioned in the present embodiment can also be applied to the above-described method embodiment.
It should be noted that, each of the modules involved in the two embodiments of the above related apparatus is a logical module, and in practical applications, one logical unit may be one physical unit, may be a part of one physical unit, and may also be implemented by a combination of a plurality of physical units. In addition, in order to highlight the innovative part of the present invention, the elements of the two embodiments described above that are not so closely related to solve the technical problem proposed by the present invention are not introduced, but this does not indicate that no other elements exist in the present embodiment.
A sixth embodiment of the present invention relates to an electronic apparatus, as shown in fig. 6, including: at least one processor 601; and a memory 602 communicatively coupled to the at least one processor 601; and a communication component 603 communicatively coupled to the scanning device, the communication component 603 receiving and transmitting data under control of the processor 601; wherein the memory 602 stores instructions executable by the at least one processor 601, the instructions being executable by the at least one processor 601 to implement:
acquiring codes and check values of real-time file blocks obtained by segmenting a target file, wherein the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks; downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed; and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into a target file according to the coding sequence.
Specifically, the electronic device includes: one or more processors 601 and a memory 602, one processor 601 being illustrated in fig. 6. The processor 601 and the memory 602 may be connected by a bus or other means, and fig. 6 illustrates an example of a connection by a bus. The memory 602, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 601 executes various functional applications and data processing of the device by running nonvolatile software programs, instructions, and modules stored in the memory 602, that is, implements the above-described file transfer method.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store a list of options, etc. Further, the memory 602 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 602 may optionally include memory 602 located remotely from the processor 601, and these remote memories 602 may be connected to external devices via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 602 and, when executed by the one or more processors 601, perform the file transfer method of any of the method embodiments described above.
A seventh embodiment of the present invention relates to an electronic apparatus, as shown in fig. 7, including:
at least one processor 701; and, a memory 702 communicatively coupled to the at least one processor 701; and a communication component 703 communicatively coupled to the scanning device, the communication component 703 receiving and transmitting data under the control of the processor 701; wherein the memory 702 stores instructions executable by the at least one processor 701 to perform, by the at least one processor 701, the steps of:
acquiring a target file; segmenting a target file according to the performance of a terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block; and sending the real-time file blocks, the codes corresponding to the real-time file blocks and the check values to the terminal according to the coding sequence.
It should be noted that the processor 701, the memory 702, and the communication component 703 in this embodiment have similar functions to the processor 601, the memory 602, and the communication component 603 in the sixth embodiment, and are not described again here.
The product can execute the method provided by the embodiment of the application, has corresponding functional modules and beneficial effects of the execution method, and can refer to the method provided by the embodiment of the application without detailed technical details in the embodiment.
An eighth embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program for causing a computer to execute some or all of the method embodiments described above as applied to a terminal or a server.
That is, as can be understood by those skilled in the art, all or part of the steps applied to the terminal in the method of the above embodiments may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific embodiments for practicing the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.
The embodiment provides A1. a file transmission method, which is applied to a terminal and comprises the following steps:
acquiring a code and a check value of a real-time file block obtained by segmenting a target file, wherein the size of the real-time file block is determined according to the performance of the terminal, and the code is used for indicating the downloading sequence of the real-time file block;
downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed;
and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into the target file according to the coding sequence.
A2. According to the file transfer method of a1, the size of the real-time file block is determined according to the performance of the terminal by:
and sending the performance updating data of the terminal to a server, so that the server can adjust the size of the real-time file block according to the performance updating data.
A3. According to the file transmission method of a1, before the obtaining the encoding and checking values of the real-time file blocks segmented by the target file, the method further includes: acquiring the total length of the target file; before the downloading of the next real-time file block, the method further includes:
acquiring the accumulated length of all downloaded real-time file blocks, and judging whether the accumulated length is equal to the total length or not;
if the accumulated length is smaller than the total length, then the next real-time file block is downloaded;
and if the accumulated length is equal to the total length, judging that the downloading of the last real-time file block is finished.
A4. The file transmission method according to any one of a1 to A3, further comprising, after verifying the real-time file chunk according to the verification value: and if the verification fails, the real-time file block is downloaded again for re-verification.
A5. According to the file transmission method in a4, before the re-downloading the real-time file block for re-verification, the method further includes:
and judging that the re-downloading times of the real-time file blocks are smaller than a preset re-downloading time threshold value.
A6. The file transfer method according to a1, further comprising, after the merging all the real-time file blocks into the target file according to the encoding order:
judging whether the check value is matched with the local check value or not according to the check value of the target file transmitted by the server and the combined local check value of the target file;
if the check value is matched with the local check value, the merged target file is stored;
and if the check value is not matched with the local check value, clearing the merged target file.
The embodiment provides a b1. a file transmission method applied to a server, including:
acquiring a target file;
segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block;
and sending the real-time file block, the code corresponding to the real-time file block and the check value to the terminal according to the coding sequence.
This embodiment provides c1. a file transfer device, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring codes and check values of real-time file blocks obtained by segmenting a target file, the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks;
the downloading module is used for downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values and downloading the next real-time file block after the verification is passed;
and the merging module is used for merging all the real-time file blocks into the target file according to the coding sequence after the downloading and the verification of the last real-time file block are finished.
C2. The file transfer device according to C1, further comprising a performance update module, configured to send performance update data of the terminal to a server, so that the server adjusts the size of the real-time file block according to the performance update data.
C3. According to the file transmission device of C2, the file transmission device further includes a second obtaining module and a length accumulating module;
the second acquisition module is used for acquiring the total length of the target file;
the length accumulation module is used for acquiring the accumulated length of all downloaded real-time file blocks and indicating the downloading module to download the next real-time file block when the accumulated length is smaller than the total length; and when the accumulated length is equal to the total length, judging that the downloading of the last real-time file block is finished, and triggering the merging module.
C4. The file transfer device according to any one of C1-C3, wherein the download module is further configured to re-download the real-time text-plus-block for re-verification if the downloaded real-time text-plus-block fails to be verified.
C5. According to the file transmission device of C4, the download module is specifically configured to re-download the real-time text added block for re-verification when the downloaded real-time text added block does not pass verification and the re-download time of the real-time text added block is less than a preset re-download time threshold.
C6. The file transmission apparatus according to C1, further comprising a check module, configured to, after the merge module merges all the real-time file blocks into the target file, determine whether the check value matches the local check value according to a check value of the target file transmitted by a server and a local check value of the target file after merging; if the check value is matched with the local check value, the merged target file is stored; and if the check value is not matched with the local check value, clearing the merged target file.
This embodiment provides d1. a file transfer device, comprising:
the acquisition module is used for acquiring a target file;
the segmentation module is used for segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a coding and check value for indicating a downloading sequence to each real-time file block;
and the transmission module is used for sending the real-time file block, the code corresponding to the real-time file block and the check value to the terminal according to the coding sequence.
This embodiment provides an electronic device, comprising a memory and a processor, the memory storing a computer program, the processor executing when running the program:
acquiring a code and a check value of a real-time file block obtained by segmenting a target file, wherein the size of the real-time file block is determined according to the performance of a terminal, and the code is used for indicating the downloading sequence of the real-time file block;
downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed;
and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into the target file according to the coding sequence.
E2. The electronic device of E1, the processor when executing the program performs the file transfer method of any of A2-A6.
The present embodiment provides an electronic device including:
the system comprises a memory and a processor, wherein the memory stores computer programs, and the processor executes the programs to execute the following steps:
acquiring a target file;
segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block;
and sending the real-time file block, the code corresponding to the real-time file block and the check value to the terminal according to the coding sequence.
This embodiment provides G1. a non-volatile storage medium storing a computer-readable program for causing a computer to execute the file transfer method according to any one of a1 to a6.
This embodiment provides h1 a nonvolatile storage medium storing a computer-readable program for causing a computer to execute the file transfer method according to a 7.

Claims (10)

1. A file transmission method is applied to a terminal and comprises the following steps:
acquiring a code and a check value of a real-time file block obtained by segmenting a target file, wherein the size of the real-time file block is determined according to the performance of the terminal, and the code is used for indicating the downloading sequence of the real-time file block;
downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed;
and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into the target file according to the coding sequence.
2. The file transfer method according to claim 1, wherein the size of the real-time file block is determined according to the performance of the terminal by:
and sending the performance updating data of the terminal to a server, so that the server can adjust the size of the real-time file block according to the performance updating data.
3. The file transmission method according to claim 1, further comprising, before said obtaining the encoding and checking values of the real-time file blocks segmented from the target file: acquiring the total length of the target file; before the downloading of the next real-time file block, the method further includes:
acquiring the accumulated length of all downloaded real-time file blocks, and judging whether the accumulated length is equal to the total length or not;
if the accumulated length is smaller than the total length, then the next real-time file block is downloaded;
and if the accumulated length is equal to the total length, judging that the downloading of the last real-time file block is finished.
4. The file transmission method according to any one of claims 1 to 3, wherein after the checking the real-time file block according to the check value, the method further comprises: and if the verification fails, the real-time file block is downloaded again for re-verification.
5. The method according to claim 4, further comprising, before re-downloading the real-time file block for re-verification:
and judging that the re-downloading times of the real-time file blocks are smaller than a preset re-downloading time threshold value.
6. The method of claim 1, further comprising, after said combining all real-time file blocks into the target file according to the coding order:
judging whether the check value is matched with the local check value or not according to the check value of the target file transmitted by the server and the combined local check value of the target file;
if the check value is matched with the local check value, the merged target file is stored;
and if the check value is not matched with the local check value, clearing the merged target file.
7. A file transmission method is applied to a server and comprises the following steps:
acquiring a target file;
segmenting the target file according to the performance of the terminal to obtain a plurality of real-time file blocks, and adding a code and a check value for indicating a downloading sequence to each real-time file block;
and sending the real-time file block, the code corresponding to the real-time file block and the check value to the terminal according to the coding sequence.
8. A file transfer apparatus, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring codes and check values of real-time file blocks obtained by segmenting a target file, the size of the real-time file blocks is determined according to the performance of a terminal, and the codes are used for indicating the downloading sequence of the real-time file blocks;
the downloading module is used for downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values and downloading the next real-time file block after the verification is passed;
and the merging module is used for merging all the real-time file blocks into the target file according to the coding sequence after the downloading and the verification of the last real-time file block are finished.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, the processor executing the program to perform:
acquiring a code and a check value of a real-time file block obtained by segmenting a target file, wherein the size of the real-time file block is determined according to the performance of a terminal, and the code is used for indicating the downloading sequence of the real-time file block;
downloading the real-time file blocks according to the coding sequence, verifying the real-time file blocks according to the verification values, and downloading the next real-time file block after the verification is passed;
and after the downloading and the verification of the last real-time file block are finished, combining all the real-time file blocks into the target file according to the coding sequence.
10. A non-volatile storage medium storing a computer-readable program for causing a computer to execute the file transfer method according to any one of claims 1 to 6.
CN202010135368.4A 2020-03-02 2020-03-02 File transmission method and device, electronic equipment and nonvolatile storage medium Pending CN111385354A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010135368.4A CN111385354A (en) 2020-03-02 2020-03-02 File transmission method and device, electronic equipment and nonvolatile storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010135368.4A CN111385354A (en) 2020-03-02 2020-03-02 File transmission method and device, electronic equipment and nonvolatile storage medium

Publications (1)

Publication Number Publication Date
CN111385354A true CN111385354A (en) 2020-07-07

Family

ID=71222634

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010135368.4A Pending CN111385354A (en) 2020-03-02 2020-03-02 File transmission method and device, electronic equipment and nonvolatile storage medium

Country Status (1)

Country Link
CN (1) CN111385354A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112165533A (en) * 2020-10-21 2021-01-01 苏州智加科技有限公司 Data checking and transmitting method, device, equipment, system and storage medium
CN112532740A (en) * 2020-12-11 2021-03-19 平安科技(深圳)有限公司 File uploading method and device and file checking method and device
CN113590994A (en) * 2021-08-02 2021-11-02 北京金山云网络技术有限公司 Data processing method, data processing device, computer equipment and storage medium
CN114697309A (en) * 2020-12-25 2022-07-01 北京三快在线科技有限公司 File transmission method, file processing method and device
CN115167767A (en) * 2022-06-28 2022-10-11 慧之安信息技术股份有限公司 Dirty data prevention method and system based on BBC exclusive or check

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101453478A (en) * 2007-11-28 2009-06-10 新奥特(北京)视频技术有限公司 Integrity checking method in document transmission
US8024472B1 (en) * 2007-09-25 2011-09-20 Limelight Networks, Inc. Third party verification using override IP addresses
CN103455518A (en) * 2012-06-04 2013-12-18 中兴通讯股份有限公司 Data processing method and device
CN104468843A (en) * 2014-12-31 2015-03-25 浪潮软件股份有限公司 File uploading method and device
CN110769030A (en) * 2019-09-12 2020-02-07 上海艾拉比智能科技有限公司 Method, terminal, server and storage medium for downloading file

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8024472B1 (en) * 2007-09-25 2011-09-20 Limelight Networks, Inc. Third party verification using override IP addresses
CN101453478A (en) * 2007-11-28 2009-06-10 新奥特(北京)视频技术有限公司 Integrity checking method in document transmission
CN103455518A (en) * 2012-06-04 2013-12-18 中兴通讯股份有限公司 Data processing method and device
CN104468843A (en) * 2014-12-31 2015-03-25 浪潮软件股份有限公司 File uploading method and device
CN110769030A (en) * 2019-09-12 2020-02-07 上海艾拉比智能科技有限公司 Method, terminal, server and storage medium for downloading file

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112165533A (en) * 2020-10-21 2021-01-01 苏州智加科技有限公司 Data checking and transmitting method, device, equipment, system and storage medium
CN112532740A (en) * 2020-12-11 2021-03-19 平安科技(深圳)有限公司 File uploading method and device and file checking method and device
CN114697309A (en) * 2020-12-25 2022-07-01 北京三快在线科技有限公司 File transmission method, file processing method and device
CN113590994A (en) * 2021-08-02 2021-11-02 北京金山云网络技术有限公司 Data processing method, data processing device, computer equipment and storage medium
CN115167767A (en) * 2022-06-28 2022-10-11 慧之安信息技术股份有限公司 Dirty data prevention method and system based on BBC exclusive or check

Similar Documents

Publication Publication Date Title
CN111385354A (en) File transmission method and device, electronic equipment and nonvolatile storage medium
US10725772B2 (en) Electric control device for vehicles, program updating method, and server apparatus
US9514209B2 (en) Data processing method and data processing device
CN111262876B (en) Data processing method, device and equipment based on block chain and storage medium
CN103106068B (en) Internet of things big data fast calibration method
US8560552B2 (en) Method for lossless data reduction of redundant patterns
CN110442377B (en) Patch package generation method, application updating method, device and electronic equipment
EP3933573B1 (en) Zero differential upgrade method, non-volatile storage medium and electronic device
CN112165533B (en) Data checking and transmitting method, device, equipment, system and storage medium
CN113824760B (en) File concurrency block uploading method and device, electronic equipment and storage medium
CN109286957B (en) Switching method and device of return link, electronic equipment and storage medium
CN111240713A (en) Method for detecting remote breakpoint continuous transmission through power utilization
CN105208108A (en) File uploading/downloading method and system in Web environment, server and client end
CN110995788B (en) Method for realizing breakpoint continuous uploading and file storage of HTTP (hyper text transport protocol) server
CN109412999B (en) Mapping method and device for probability modeling
US20060273934A1 (en) Dictionary-based compression and decompression
CN112235422B (en) Data processing method and device, computer readable storage medium and electronic device
CN112637357A (en) File transmission method and device and terminal equipment
CN112905542A (en) File processing method, device, server, equipment and storage medium
CN111865557A (en) Check code generation method and device
CN113064658B (en) Copying method, copying device, copying equipment and computer readable storage medium for configuration data
CN111193777B (en) File downloading method and device based on breakpoint continuous transmission and storage medium
CN107071548B (en) Video processing method and system
CN110769030A (en) Method, terminal, server and storage medium for downloading file
CN116057925A (en) Data transmission method, data downloading method and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200707

RJ01 Rejection of invention patent application after publication