CN107645357B - Recovery method and device for incomplete transmitted file - Google Patents

Recovery method and device for incomplete transmitted file Download PDF

Info

Publication number
CN107645357B
CN107645357B CN201610581670.6A CN201610581670A CN107645357B CN 107645357 B CN107645357 B CN 107645357B CN 201610581670 A CN201610581670 A CN 201610581670A CN 107645357 B CN107645357 B CN 107645357B
Authority
CN
China
Prior art keywords
sub
block
file
original
check code
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.)
Active
Application number
CN201610581670.6A
Other languages
Chinese (zh)
Other versions
CN107645357A (en
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201610581670.6A priority Critical patent/CN107645357B/en
Priority to PCT/CN2017/076158 priority patent/WO2018014564A1/en
Publication of CN107645357A publication Critical patent/CN107645357A/en
Application granted granted Critical
Publication of CN107645357B publication Critical patent/CN107645357B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Abstract

The invention discloses a recovery method for incomplete transmission files, which comprises the following steps: when the received file sent by the sending end is incomplete, the received file is subjected to blocking processing to obtain a first subfile block; calculating a first sub check code of the first sub file block; and sending the block start-stop information and the first sub-check code of the first subfile block to a sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates the first original sub-check code of the first original subfile block in the original file corresponding to the block start-stop information, and retransmits the first original subfile block when the first sub-check code is inconsistent with the first original sub-check code. The invention also discloses a recovery device for incomplete transmission files. The invention realizes the retransmission of the first subfile block when the received file is incomplete, reduces the data volume of the file retransmission, improves the speed and efficiency of the file retransmission and ensures the integrity of the file.

Description

Recovery method and device for incomplete transmitted file
Technical Field
The invention relates to the technical field of computer networks, in particular to a recovery method and a recovery device for incomplete transmitted files.
Background
The file transfer technology is an important component of computer network technology, and the currently common file transfer technology comprises file copy, FTP file transfer protocol, TCP/IP transfer protocol and the like. In the process of file transmission, a problem of data loss (or damage) sometimes occurs, and in order to solve the problem, integrity verification needs to be performed on received file data. Common data integrity verification algorithms include: MD5 and SHA 1. The SHA1 algorithm has high requirements on network components such as routers, and the MD5 is a message digest algorithm invented by RSA, which has the advantages of rapidness and high efficiency.
In addition, an application program developed by using JAVA language can conveniently embed MD5 algorithm. Currently, many foreign websites on the Internet provide download resources that simultaneously provide an md5 authentication file. The whole file is subjected to md5 encoding once at the receiving end, and the file is retransmitted once the verification fails.
However, the integrity check method needs to retransmit the whole file once, and the transmitted file data volume is large, which consumes a large amount of resources, greatly affects the file transmission speed and efficiency, and even causes network congestion.
Disclosure of Invention
The invention provides a recovery method and a recovery device for incomplete transmitted files, and aims to solve the technical problem that the transmission speed and efficiency of the files are influenced by retransmitting the whole files when the files are incomplete.
In order to achieve the above object, the present invention provides a recovery method for incomplete transmission files, which includes the following steps:
when a received file sent by a sending end is incomplete, carrying out blocking processing on the received file to obtain a first sub-file block;
calculating a first sub check code of the first sub file block;
and sending the block start-stop information of the first subfile block and the first sub-check code to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates the first original sub-check code of the first original subfile block in the original file corresponding to the block start-stop information, and when the first sub-check code is inconsistent with the first original sub-check code, the sending end retransmits the first original subfile block.
Preferably, the step of sending the block start-stop information of the first sub-file block and the first sub-check code to the sender includes:
sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file, and when the first sub-check code is inconsistent with the first original sub-check code and the data volume of the first original sub-file block is larger than a preset value, the sending end feeds back prompt information that the data volume of the first original sub-file block is too large;
when the prompt information fed back by the sending end is received, the first subfile block is subjected to blocking processing to obtain a third subfile block;
calculating a third sub check code of the third sub file block;
and sending the block start-stop information and the third sub-check code of the third sub-file block to the sending end, wherein when the block start-stop information and the third sub-check code are received, the sending end calculates the third original sub-check code of the third original sub-file block corresponding to the block start-stop information in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original sub-file block is smaller than or equal to a preset value, the sending end retransmits the third original sub-file block.
Preferably, after the step of sending the block start-stop information of the first sub-file block and the first sub-check code to the sender, the method for recovering that the transmission file is incomplete further includes:
when the received first original subfile block is complete, calculating a first check code of the received file based on the received first original subfile block and a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file is subjected to blocking processing;
when the first check code is inconsistent with a second check code of the original file, calculating a second sub-check code of the second sub-file block;
and sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
Preferably, the step of sending the block start-stop information of the first sub-file block and the first sub-check code to the sender includes:
sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first sub-file block;
when the complete prompt message of the first subfile block is received, calculating a second sub check code of a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file blocking processing;
and sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
In addition, to achieve the above object, the present invention further provides a recovery method for incomplete transmission files, including the following steps:
when a received file sent by a sending end is incomplete, carrying out blocking processing on the received file to obtain a plurality of sub-file blocks;
calculating the sub check code of each sub file block;
and sending the block start-stop information and the sub-check codes of the sub-file blocks to the sending end, wherein when the block start-stop information and the sub-check codes are received, the sending end calculates the original sub-check codes of the original sub-file blocks corresponding to the block start-stop information in the original file, and when the sub-check codes have the check codes inconsistent with the corresponding original sub-check codes, the sending end retransmits the original sub-file blocks corresponding to the inconsistent check codes.
In addition, to achieve the above object, the present invention provides a recovery apparatus for incomplete transmission files, including:
the first blocking module is used for carrying out blocking processing on the received file to obtain a first subfile block when the received file sent by the sending end is incomplete;
the first calculation module is used for calculating a first sub check code of the first sub file block;
the first sending module is used for sending the block start and stop information of the first subfile block and the first sub check code to the sending end, wherein when the block start and stop information and the first sub check code are received, the sending end calculates a first original sub check code of a first original subfile block in an original file corresponding to the block start and stop information, and when the first sub check code is inconsistent with the first original sub check code, the sending end retransmits the first original subfile block.
Preferably, the first transmitting module includes:
a first sending unit, configured to send block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the block start-stop information in the original file, and when the first sub-check code is inconsistent with the first original sub-check code and the data size of the first original subfile block is greater than a preset value, the sending end feeds back prompt information that the data size of the first original subfile block is too large;
a blocking unit, configured to perform blocking processing on the first subfile block to obtain a third subfile block when the prompt information fed back by the sending end is received;
the first calculating unit is used for calculating a third sub check code of the third sub file block;
and a second sending unit, configured to send the block start-stop information of the third subfile block and the third sub-check code to the sending end, where when the block start-stop information and the third sub-check code are received, the sending end calculates a third original sub-check code of a third original subfile block corresponding to the block start-stop information in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original subfile block is less than or equal to a preset value, the sending end retransmits the third original subfile block.
Preferably, the recovery apparatus in which the transmission file is incomplete further includes:
the second calculation module is used for calculating a first check code of the received file based on the received first original subfile block and a second subfile block when the received first original subfile block is complete, wherein the second subfile block is a file block except the first subfile block after the file is processed in a blocking mode;
the third calculation module is used for calculating a second sub check code of the second sub file block when the first check code is inconsistent with a second check code of the original file;
and the second sending module is used for sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
Preferably, the first transmitting module includes:
a third sending unit, configured to send the block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the block start-stop information in the original file, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first subfile block;
the second calculating unit is used for calculating a second sub check code of a second sub file block when the complete prompt message of the first sub file block is received, wherein the second sub file block is a file block except the first sub file block after the file blocking processing;
and a fourth sending unit, configured to send the block start-stop information of the second subfile block and the second sub-check code to the sending end, where when the block start-stop information and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original subfile block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block.
In addition, to achieve the above object, the present invention provides a recovery apparatus for incomplete transmission files, including:
the second blocking module is used for carrying out blocking processing on the received file to obtain a plurality of sub-file blocks when the received file sent by the sending end is incomplete;
the fourth calculation module is used for calculating the sub check code of each sub file block;
and the third sending module is used for sending the block start-stop information and the sub-check codes of the sub-file blocks to the sending end, wherein when the block start-stop information and the sub-check codes are received, the sending end calculates the original sub-check codes of the original sub-file blocks corresponding to the block start-stop information in the original file, and when the sub-check codes are inconsistent with the corresponding original sub-check codes, the sending end retransmits the inconsistent original sub-file blocks corresponding to the check codes.
The invention carries out block processing on the received file to obtain a first subfile block when the received file sent by a sending end is incomplete, then calculates a first sub check code of the first subfile block, and then sends block start and stop information of the first subfile block and the first sub check code to the sending end, wherein when the block start and stop information and the first sub check code are received, the sending end calculates a first original sub check code of a first original subfile block in an original file corresponding to the block start and stop information, and retransmits the first original subfile block when the first sub check code is not consistent with the first original sub check code, thereby realizing retransmission of the first subfile block when the received file is incomplete, reducing the data volume of file retransmission, and being capable of retransmitting damaged data with lower cost, the bandwidth and resource occupancy rate of the retransmission of the large-data-volume files are reduced, the equipment pressure of the network environment is reduced to the maximum extent, the file retransmission speed and efficiency are improved, and the integrity of the files is ensured. Furthermore, the received file is subjected to blocking processing through the receiving end, so that the processes of carrying out blocking processing on the file and calculating the check codes of all the subfile blocks through the transmitting end are reduced, the load of the transmitting end is further reduced, and the phenomenon that the transmitting end is automatically restarted or even crashed due to overload operation is avoided.
Drawings
FIG. 1 is a flowchart illustrating a recovery method for incomplete transmitted files according to a first embodiment of the present invention;
fig. 2 is a detailed flowchart of a step of sending the block start-stop information of the first sub-file block and the first sub-checksum to the sender according to a second embodiment of the incomplete recovery method for the transmission file of the present invention;
FIG. 3 is a flowchart illustrating a recovery method for incomplete transferred files according to a third embodiment of the present invention;
fig. 4 is a schematic detailed flow chart of a step of sending the block start and stop information of the first sub-file block and the first sub-checksum to the sending end in the fourth embodiment of the recovery method for incomplete transmission files according to the present invention;
FIG. 5 is a functional block diagram of a recovery apparatus for incomplete transmitted files according to a first embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating detailed functional modules of a first sending module in a second embodiment of a recovery apparatus for incomplete transmission files according to the present invention;
FIG. 7 is a functional block diagram of a recovery apparatus for incomplete transmitted files according to a third embodiment of the present invention;
fig. 8 is a schematic diagram illustrating detailed functional modules of a first sending module in a fourth embodiment of a recovery apparatus for incomplete transmission files according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a recovery method for incomplete transmission files. Referring to fig. 1, fig. 1 is a flowchart illustrating a recovery method for incomplete transmitted files according to a first embodiment of the present invention.
In this embodiment, the recovery method for incomplete transmission files includes:
step S10, when the received file sent by the sending end is incomplete, the received file is processed in a blocking mode to obtain a first subfile block;
in this embodiment, when the sending end needs to transmit a file to the receiving end, the MD5(Message-digest Algorithm 5) or SHA1(Secure Hash Algorithm) is used to calculate a second check code, which is the check code of the file, and then the file is transmitted to the receiving end, and when the file is sent, the second check code is sent to the receiving end. When a complete file and a second check code of an original file corresponding to the complete file are received, calculating the received check code of the file, namely calculating the second check code of the received file by using MD5 or SHA 1. Then, the receiving end compares the check code of the received file with a second check code, and when the check code of the received file is inconsistent with the second check code, the received file is incomplete, so that the received file is subjected to block processing to obtain a first subfile block and a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file is subjected to the block processing; specifically, the received file may be partitioned by a bisection method, that is, the data size of the first subfile block is the same as the data size of the second subfile block, where the received file is partitioned according to the sequence of data in the file when partitioned, for example, the first subfile block is a first half of the file, the second subfile block is a second half of the file, or the first subfile block is a second half of the file, and the second subfile block is a first half of the file.
Step S20, calculating a first sub check code of the first sub file block;
the receiver calculates the first sub-checksum of the first sub-file block, and specifically, the receiver may calculate the first sub-checksum of the first sub-file block by using MD5 or SHA 1.
Step S30, sending the block start-stop information of the first subfile block and the first sub-check code to the sending end, where the sending end calculates a first original sub-check code of a first original subfile block in an original file corresponding to the block start-stop information when receiving the block start-stop information and the first sub-check code, and retransmits the first original subfile block when the first sub-check code is inconsistent with the first original sub-check code.
In this embodiment, the receiving end sends the block start-stop information and the first sub-check code of the first sub-file block to the sending end, when receiving the block start-stop information and the first sub-check code, the sending end calculates the first original sub-check code of the first original sub-file block in the original file corresponding to the block start-stop information, that is, the sending end calculates the first original sub-check code of the first original sub-file block corresponding to the first sub-file block in the original file by using MD5 or SHA1, then the sending end compares the first original sub-check code with the received first sub-check code, and when the first sub-check code is inconsistent with the first original sub-check code, the sending end retransmits the first original sub-file block, that is, sends the first original sub-file block to the receiving end again. Preferably, when the first sub-check code is inconsistent with the first original sub-check code, if the data size of the first original sub-file block is less than or equal to a preset value, the sending end retransmits the first original sub-file block; if the data volume of the first original subfile block is larger than a preset value, the sending end sends prompt information that the data volume of the first original subfile block is too large to the receiving end, the receiving end carries out blocking processing on the first subfile block according to the prompt information to obtain a third subfile block and a fourth subfile block, and sends the blocking start-stop information of the third subfile block and the third sub-check code to the sending end, so that the sending end further judges whether the third original subfile block corresponding to the third subfile block needs to be retransmitted, wherein the preset value can be reasonably set according to needs, for example, the preset value is 30M, 15M, 8M, 5M and the like.
It should be emphasized that, when retransmitting the first original subfile block, the sending end sends the first original sub-check code to the receiving end, when receiving the first original subfile block, the receiving end calculates the check code of the received first original subfile block by using MD5 or SHA1, if the calculated check code and the first original sub-check code are not consistent, a prompt message indicating that the first original subfile block has been retransmitted successfully is sent to the sending end, and when receiving the prompt message, the sending end retransmits the first original subfile block again until the received check code of the first original subfile block is consistent with the first original sub-check code.
In other embodiments, when a received file sent by a sending end is incomplete, if there is associated information which reduces the integrity of the file currently, a fifth subfile block corresponding to the associated information is obtained from the file, and a fifth sub check code of the fifth subfile block is calculated; and then, sending the start-stop information and the fifth sub-check code of the fifth sub-file block to the sending end, wherein when the start-stop information and the fifth sub-check code are received, the sending end calculates the fifth original sub-check code of the fifth original sub-file block corresponding to the start-stop information in the original file, and when the fifth sub-check code is inconsistent with the fifth original sub-check code, the sending end retransmits the fifth original sub-file block. The data size of the fifth subfile block can be reasonably set as required.
In the embodiment, when a received file sent by a sending end is incomplete, the received file is partitioned to obtain a first subfile block, then a first sub check code of the first subfile block is calculated, and then the block start-stop information of the first subfile block and the first sub check code are sent to the sending end, wherein when the block start-stop information and the first sub check code are received, the sending end calculates a first original sub check code of a first original subfile block in an original file corresponding to the block start-stop information, and retransmits the first original subfile block when the first sub check code is inconsistent with the first original sub check code, so that the first subfile block is retransmitted when the received file is incomplete, the data volume of the retransmitted file is reduced, and the retransmission of damaged data can be performed at a lower cost, the bandwidth and resource occupancy rate of the retransmission of the large-data-volume files are reduced, the equipment pressure of the network environment is reduced to the maximum extent, the file retransmission speed and efficiency are improved, and the integrity of the files is ensured. Furthermore, the received file is subjected to blocking processing through the receiving end, so that the processes of carrying out blocking processing on the file and calculating the check codes of all the subfile blocks through the transmitting end are reduced, the load of the transmitting end is further reduced, and the phenomenon that the transmitting end is automatically restarted or even crashed due to overload operation is avoided.
A second embodiment of the recovery method for incomplete transferred file according to the present invention is proposed based on the first embodiment, and referring to fig. 2, in this embodiment, step S30 includes:
step S31, sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, where the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file when receiving the block start-stop information and the first sub-check code, and feeds back prompt information indicating that the data size of the first original sub-file block is too large when the first sub-check code is inconsistent with the first original sub-check code and the data size of the first original sub-file block is greater than a preset value;
in this embodiment, the receiving end sends the block start-stop information and the first sub-check code of the first sub-file block to the sending end, when receiving the block start-stop information and the first sub-check code, the sending end calculates the first original sub-check code of the first original sub-file block in the original file corresponding to the block start-stop information, that is, the sending end calculates the first original sub-check code of the first original sub-file block corresponding to the first sub-file block in the original file by using MD5 or SHA1, then the sending end compares the first original sub-check code with the received first sub-check code, when the first sub-check code is inconsistent with the first original sub-check code, if the data volume of the first original sub-file block is greater than a preset value, the sending end feeds back prompt information that the data volume of the first original sub-file block is too large to the receiving end, wherein the preset value can be set reasonably as required, for example, the preset values are 30M, 15M, 8M, 5M, etc.
Step S32, when receiving the prompt information fed back by the sender, performing blocking processing on the first subfile block to obtain a third subfile block;
in this embodiment, when the prompt information is received, the first subfile block is partitioned to obtain a third subfile block and a fourth subfile block, where the fourth subfile block is a file block of the first subfile block except for the third subfile block, and a way of partitioning the first subfile block is the same as a way of partitioning the received file.
Step S33, calculating a third sub-check code of the third sub-file block;
after the first subfile block is subjected to blocking processing to obtain a third subfile block and a fourth subfile block, the receiving end calculates a third sub-check code of the third subfile block, and specifically, the receiving end may calculate the third sub-check code of the first subfile block by using MD5 or SHA 1.
Step S34, sending the block start-stop information and the third sub-check code of the third sub-file block to the sending end, where the sending end calculates the third original sub-check code of the third original sub-file block corresponding to the block start-stop information in the original file when receiving the block start-stop information and the third sub-check code, and retransmits the third original sub-file block when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original sub-file block is less than or equal to a preset value.
In this embodiment, the receiving end sends the blocking start-stop information and the third sub-check code of the third sub-file block to the sending end, when the blocking start-stop information and the third sub-check code are received, the sending end calculates the third original sub-check code of the third original sub-file block in the original file corresponding to the blocking start-stop information, that is, the sending end calculates the third original sub-check code of the third original sub-file block corresponding to the third sub-file block in the original file by using MD5 or SHA1, then the sending end compares the third original sub-check code with the received third sub-check code, and when the third sub-check code is inconsistent with the third original sub-check code, if the data size of the third original sub-file block is less than or equal to a preset value, the sending end retransmits the third original sub-file block, that is, the third original sub-file block is sent to the receiving end again.
It should be emphasized that, when retransmitting the third original subfile block, the sending end sends the third original subfile block to the receiving end, when receiving the third original subfile block, the receiving end calculates the check code of the received third original subfile block by using MD5 or SHA1, if the calculated check code and the third original subfile block are the same, it indicates that the third original subfile block has been retransmitted successfully, if the calculated check code is not the same as the third original subfile block, it sends a prompt message indicating that the retransmission has failed to the sending end, and when receiving the prompt message, the sending end retransmits the third original subfile block again until the check code of the received third original subfile block is the same as the third original subfile block.
In other embodiments, if the data size of the third original subfile block is greater than the preset value, the sending end sends a prompt message indicating that the data size of the third original subfile block is too large to the receiving end, and the receiving end performs blocking processing on the third subfile block according to the prompt message and retransmits the original file block corresponding to the file block blocked by the second subfile block according to the above process, so as to reduce the retransmitted data size. And if the third sub-check code is consistent with the third original sub-check code, the block start-stop information of the fourth sub-file block and the fourth sub-check code are sent to the sending end, and the sending end retransmits the fourth sub-file block when the fourth sub-file block is incomplete, wherein the process of retransmitting the fourth sub-file block by the sending end when the fourth sub-file block is incomplete is the same as the process of retransmitting the third sub-file block, and the process is not repeated here.
In this embodiment, when the first sub-checksum is inconsistent with the first original sub-checksum and the data size of the first original sub-file block is greater than a preset value, the sending end feeds back prompt information that the data size of the first original sub-file block is too large, then when the prompt information fed back by the sending end is received, the first sub-file block is subjected to blocking processing to obtain a third sub-file block, then a third sub-checksum of the third sub-file block is calculated, and finally blocking start information and the third sub-checksum of the third sub-file block are sent to the sending end, wherein when the blocking start information and the third sub-checksum are received, the sending end calculates a third original sub-checksum of the third original sub-file block corresponding to the blocking start information in the original file, and when the third sub-checksum is inconsistent with the third original sub-checksum and the third original sub-file block is not consistent with the third original sub-checksum When the data volume of the third original sub-file block is smaller than or equal to the preset value, the sending end retransmits the third original sub-file block, so that the retransmission of the third original sub-file block with the data volume smaller than or equal to the preset value is realized, the data volume of the file retransmission is further reduced, the retransmission of damaged data can be carried out at a lower cost, the bandwidth and the resource occupancy rate of the retransmission of a large-data-volume file are reduced, the file retransmission speed and efficiency are improved, and the integrity of the file is ensured.
Based on the foregoing embodiment, a third embodiment of the incomplete recovery method for the transmission file according to the present invention is provided, and referring to fig. 3, in this embodiment, after step S30, the incomplete recovery method for the transmission file further includes:
step S40, when the received first original subfile block is complete, calculating a first check code of the received file based on the received first original subfile block and a second subfile block, where the second subfile block is a file block except the first subfile block after the file blocking process;
in this embodiment, when the first original subfile block is retransmitted, the sending end sends the first original sub-check code to the receiving end, and when the receiving end receives the first original subfile block, the receiving end calculates the check code of the received first original subfile block by using MD5 or SHA1, and if the calculated check code and the first original sub-check code are obtained, it indicates that the first original subfile block is retransmitted successfully. When the received first original subfile block is complete, the receiving end calculates a first check code of the received file based on the received first original subfile block and the second subfile block, specifically, the receiving end replaces the first subfile block in the file with the received first original subfile block, that is, the received first original subfile block is used as a new first subfile block, and then calculates the first check code of the file.
Step S50, when the first check code is not consistent with the second check code of the original file, calculating a second sub-check code of the second sub-file block;
in this embodiment, the first check code is inconsistent with the second check code of the original file, that is, when the retransmitted first sub-file block is complete, the whole file is still incomplete, and therefore, the second sub-check code of the second sub-file block is calculated.
Step S60, sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, where the sending end calculates a second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file when receiving the block start-stop information and the second sub-check code, and retransmits the second original sub-file block when the second sub-check code is inconsistent with the second original sub-check code and the data size of the second original sub-file block is less than or equal to a preset value.
In this embodiment, the receiving end sends the blocking start-stop information and the second sub-check code of the second subfile block to the sending end, when the blocking start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original subfile block in the original file corresponding to the blocking start-stop information, that is, the sending end calculates the second original sub-check code of the second original subfile block corresponding to the second subfile block in the original file by using MD5 or SHA1, then the sending end compares the second original sub-check code with the received second sub-check code, and when the second sub-check code is inconsistent with the second original sub-check code, if the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block. It should be emphasized that, when retransmitting the second original subfile block, the sending end sends the second original subfile block to the receiving end, when receiving the second original subfile block, the receiving end calculates the check code of the received second original subfile block by using MD5 or SHA1, if the calculated check code and the second original subfile block are not consistent, a prompt message indicating that the second original subfile block has been retransmitted successfully is sent to the sending end, and when receiving the prompt message, the sending end retransmits the second original subfile block again until the received check code of the second original subfile block is consistent with the second original subfile block.
In other embodiments, if the data size of the second original subfile block is greater than the preset value, the sending end sends a prompt message indicating that the data size of the second original subfile block is too large to the receiving end, and the receiving end performs blocking processing on the second subfile block according to the prompt message and retransmits the original file block corresponding to the file block blocked by the second subfile block according to the process of the second embodiment, so as to reduce the retransmitted data size.
In this embodiment, when the received first original subfile block is complete, a first check code of the received file is calculated based on the received first original subfile block and the received second subfile block, then when the first check code is inconsistent with a second check code of the original file, a second sub-check code of the second subfile block is calculated, and then starting and ending block information of the second subfile block and the second sub-check code are sent to the sending end, wherein when the starting and ending block information and the second sub-check code are received, the sending end calculates a second original sub-check code of the second original subfile block corresponding to the starting and ending block information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and a data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block, so that the second subfile block is retransmitted when the received first original subfile block is complete but the whole file is still incomplete, and the integrity of the file is further ensured.
A fourth embodiment of the recovery method for incomplete transferred file according to the present invention is proposed based on the first embodiment, and referring to fig. 4, in this embodiment, step S30 includes:
step S35, sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, where the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file when receiving the block start-stop information and the first sub-check code, and feeds back complete prompt information of the first sub-file block when the first sub-check code is consistent with the first original sub-check code;
in this embodiment, the receiving end sends the block start-stop information and the first sub-check code of the first sub-file block to the sending end, the sending end calculates the first original sub-check code of the first original sub-file block in the original file corresponding to the block start-stop information when receiving the block start-stop information and the first sub-check code, then the sending end compares the first original sub-check code with the received first sub-check code, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back the complete prompt information of the first sub-file block to prompt that the incompleteness of the current file of the receiving end is irrelevant to the first sub-file block.
Step S36, when the complete prompt message of the first subfile block is received, calculating a second sub check code of a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file blocking processing;
step S37, sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, where the sending end calculates a second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file when receiving the block start-stop information and the second sub-check code, and retransmits the second original sub-file block when the second sub-check code is inconsistent with the second original sub-check code and the data size of the second original sub-file block is less than or equal to a preset value.
In this embodiment, the receiving end sends the blocking start-stop information and the second sub-check code of the second subfile block to the sending end, when the blocking start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original subfile block in the original file corresponding to the blocking start-stop information, that is, the sending end calculates the second original sub-check code of the second original subfile block corresponding to the second subfile block in the original file by using MD5 or SHA1, then the sending end compares the second original sub-check code with the received second sub-check code, and when the second sub-check code is inconsistent with the second original sub-check code, if the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block. It should be emphasized that, when retransmitting the second original subfile block, the sending end sends the second original subfile block to the receiving end, when receiving the second original subfile block, the receiving end calculates the check code of the received second original subfile block by using MD5 or SHA1, if the calculated check code and the second original subfile block are not consistent, a prompt message indicating that the second original subfile block has been retransmitted successfully is sent to the sending end, and when receiving the prompt message, the sending end retransmits the second original subfile block again until the received check code of the second original subfile block is consistent with the second original subfile block.
In other embodiments, if the data size of the second original subfile block is greater than the preset value, the sending end sends a prompt message indicating that the data size of the second original subfile block is too large to the receiving end, and the receiving end performs blocking processing on the second subfile block according to the prompt message and retransmits the original file block corresponding to the file block blocked by the second subfile block according to the process of the second embodiment, so as to reduce the retransmitted data size.
In this embodiment, when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first sub-file block, then when the complete prompt information of the first sub-file block is received, calculates a second sub-check code of a second sub-file block, and then sends start-stop information of the second sub-file block and the second sub-check code to the sending end, wherein when the start-stop information of the block and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original sub-file block corresponding to the start-stop information of the block in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data size of the second original sub-file block is less than or equal to a preset value, the sending end retransmits the second original sub-file block, the second subfile block is retransmitted when the first subfile block is complete, and the integrity of the file is further ensured.
The invention further provides a recovery method for incomplete transmission files.
In this embodiment, the recovery method for incomplete transmission files includes:
step S110, when the received file sent by the sending end is incomplete, the received file is subjected to blocking processing to obtain a plurality of sub-file blocks;
in this embodiment, when the sending end needs to transmit a file to the receiving end, the MD5(Message-digest Algorithm 5) or SHA1(Secure Hash Algorithm) is used to calculate a second check code, which is the check code of the file, and then the file is transmitted to the receiving end, and when the file is sent, the second check code is sent to the receiving end. When a complete file and a second check code of an original file corresponding to the complete file are received, calculating the received check code of the file, namely calculating the second check code of the received file by using MD5 or SHA 1. And then the receiving end compares the check code of the received file with the second check code, and when the check code of the received file is inconsistent with the second check code, the received file is incomplete, so that the received file is subjected to blocking processing to obtain a plurality of subfile blocks. Preferably, the data amount of each sub-file block is less than or equal to a preset value.
Step S120, calculating the sub check code of each sub file block;
the receiving end calculates the sub-check code of each sub-file block, and specifically, the receiving end may use MD5 or SHA1 to calculate the sub-check code of each sub-file block.
Step S130, sending the block start-stop information and the sub-check codes of each sub-file block to the sending end, wherein when receiving the block start-stop information and the sub-check codes, the sending end calculates original sub-check codes of each original sub-file block corresponding to the block start-stop information in the original file, and when a check code inconsistent with the corresponding original sub-check code exists in the sub-check codes, the sending end retransmits the original sub-file block corresponding to the inconsistent check code.
In this embodiment, the receiving end sends the block start-stop information and the sub-check codes of each sub-file block to the sending end, and when receiving the block start-stop information and the sub-check codes, the sending end calculates the original sub-check codes of each original sub-file block corresponding to the block start-stop information in the original file by using MD5 or SHA1, and when a check code inconsistent with the corresponding original sub-check code exists in the sub-check codes, the sub-file block corresponding to the check code is incomplete, so that the sending end retransmits the original sub-file block corresponding to the check code.
In the embodiment, when a received file sent by a sending end is incomplete, the received file is partitioned to obtain a plurality of sub-file blocks, sub-check codes of the sub-file blocks are calculated, and then partitioning start-stop information and the sub-check codes of the sub-file blocks are sent to the sending end, wherein when the partitioning start-stop information and the sub-check codes are received, the sending end calculates original sub-check codes of each original sub-file block corresponding to the partitioning start-stop information in an original file, and when check codes which are inconsistent with the corresponding original sub-check codes exist in the sub-check codes, the sending end retransmits the original sub-file blocks corresponding to the inconsistent check codes; the method and the device have the advantages that the received file is subjected to blocking processing at the receiving end, the original sub-file blocks corresponding to the inconsistent check codes are retransmitted through the sending end, the processes of carrying out blocking processing on the file and calculating the check codes of the sub-file blocks through the sending end are reduced, the phenomenon that the sending end is automatically restarted or even crashed due to overload operation is avoided, the load of the sending end is reduced, and the integrity of the file can be guaranteed.
The invention further provides a recovery device for incomplete transmitted files.
Referring to fig. 5, fig. 5 is a functional block diagram of a recovery apparatus for incomplete transferred files according to a first embodiment of the present invention.
In this embodiment, the recovery apparatus for incomplete transmission file includes:
the first blocking module 10 is configured to, when a received file sent by a sending end is incomplete, perform blocking processing on the received file to obtain a first subfile block;
in this embodiment, when the sending end needs to transmit the file to the receiving end, the MD5 or SHA1 is used to calculate the check code of the file, i.e., the second check code, and then the file is transmitted to the receiving end, and when the file is sent, the second check code is sent to the receiving end. When receiving a complete file and a second check code of an original file corresponding to the file, the first block module 10 calculates the received check code of the file. Then, comparing the check code of the received file with the second check code, and when the check code of the received file is inconsistent with the second check code, the received file is incomplete, so that the first sub-file module 10 performs block processing on the received file to obtain a first sub-file block and a second sub-file block, wherein the second sub-file block is a file block except the first sub-file block after the file block processing; specifically, the received file may be partitioned by a bisection method, that is, the data size of the first subfile block is the same as the data size of the second subfile block, where the received file is partitioned according to the sequence of data in the file when partitioned, for example, the first subfile block is a first half of the file, the second subfile block is a second half of the file, or the first subfile block is a second half of the file, and the second subfile block is a first half of the file.
A first calculating module 20, configured to calculate a first sub-check code of the first sub-file block;
the first sending module 30 is configured to send the block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block in an original file corresponding to the block start-stop information, and when the first sub-check code is inconsistent with the first original sub-check code, the sending end retransmits the first original subfile block.
In this embodiment, the first sending module 30 sends the block start-stop information and the first sub-check code of the first sub-file block to the sending end, when receiving the block start-stop information and the first sub-check code, the sending end calculates the first original sub-check code of the first original sub-file block in the original file corresponding to the block start-stop information, that is, the sending end calculates the first original sub-check code of the first original sub-file block corresponding to the first sub-file block in the original file by using MD5 or SHA1, then the sending end compares the first original sub-check code with the received first sub-check code, and when the first sub-check code is inconsistent with the first original sub-check code, the sending end retransmits the first original sub-file block, that is, the sending end resends the first original sub-file block to the receiving end again. Preferably, when the first sub-check code is inconsistent with the first original sub-check code, if the data size of the first original sub-file block is less than or equal to a preset value, the sending end retransmits the first original sub-file block; if the data volume of the first original subfile block is larger than a preset value, the sending end sends prompt information that the data volume of the first original subfile block is too large to the receiving end, the receiving end carries out blocking processing on the first subfile block according to the prompt information to obtain a third subfile block and a fourth subfile block, and sends the blocking start-stop information of the third subfile block and the third sub-check code to the sending end, so that the sending end further judges whether the third original subfile block corresponding to the third subfile block needs to be retransmitted, wherein the preset value can be reasonably set according to needs, for example, the preset value is 30M, 15M, 8M, 5M and the like.
In this embodiment, when a received file sent by a sending end is incomplete, a first blocking module 10 performs blocking processing on the received file to obtain a first subfile block, then a first calculating module 20 calculates a first sub check code of the first subfile block, and then a first sending module 30 sends block start and stop information of the first subfile block and the first sub check code to the sending end, wherein when the block start and stop information and the first sub check code are received, the sending end calculates a first original sub check code of a first original subfile block in an original file corresponding to the block start and stop information, and when the first sub check code is not consistent with the first original sub check code, the sending end retransmits the first original subfile block, so that the first subfile block is retransmitted when the received file is incomplete, the method has the advantages of reducing the data volume of file retransmission, being capable of retransmitting damaged data at a lower cost, reducing the bandwidth and resource occupancy rate of retransmission of large-data-volume files, reducing the equipment pressure of the network environment to the maximum extent, improving the speed and efficiency of file retransmission and ensuring the integrity of the files. Furthermore, the received file is subjected to blocking processing through the receiving end, so that the processes of carrying out blocking processing on the file and calculating the check codes of all the subfile blocks through the transmitting end are reduced, the load of the transmitting end is further reduced, and the phenomenon that the transmitting end is automatically restarted or even crashed due to overload operation is avoided.
A second embodiment of the recovery apparatus for incomplete transmission file according to the present invention is proposed based on the first embodiment, and referring to fig. 6, in this embodiment, the first sending module 30 includes:
a first sending unit 31, configured to send the starting and stopping block information of the first subfile block and the first sub-check code to the sending end, where when the starting and stopping block information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the starting and stopping block information in the original file, and when the first sub-check code is inconsistent with the first original sub-check code and the data size of the first original subfile block is greater than a preset value, the sending end feeds back prompt information that the data size of the first original subfile block is too large;
a blocking unit 32, configured to perform blocking processing on the first subfile block to obtain a third subfile block when the prompt information fed back by the sending end is received;
a first calculating unit 33, configured to calculate a third sub-check code of the third sub-file block;
a second sending unit 34, configured to send the block start-stop information of the third subfile block and the third sub-check code to the sending end, where when the block start-stop information and the third sub-check code are received, the sending end calculates a third original sub-check code of a third original subfile block corresponding to the block start-stop information in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original subfile block is less than or equal to a preset value, the sending end retransmits the third original subfile block.
In this embodiment, when the first sub-checksum and the first original sub-checksum are not consistent and the data size of the first original sub-file block is greater than a preset value, the sending end feeds back prompt information that the data size of the first original sub-file block is too large, then when the prompt information fed back by the sending end is received, the blocking unit 32 performs blocking processing on the first sub-file block to obtain a third sub-file block, then the first calculating unit 33 calculates a third sub-checksum of the third sub-file block, and finally the second sending unit 34 sends the start-stop information of the third sub-file block and the third sub-checksum to the sending end, where when the start-stop information of the blocks and the third sub-checksum are received, the sending end calculates the third original sub-checksum of the third original sub-file block corresponding to the start-stop information of the blocks in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data volume of the third original sub-file block is less than or equal to a preset value, the sending end retransmits the third original sub-file block, so that the retransmission of the third original sub-file block with the data volume less than or equal to the preset value is realized, the data volume of the file retransmission is further reduced, the retransmission of damaged data can be carried out at a lower cost, the bandwidth and resource occupancy rate of the retransmission of a large-data-volume file are reduced, the file retransmission speed and efficiency are improved, and the integrity of the file is ensured.
Referring to fig. 7, in the third embodiment of the recovery apparatus for incomplete transmission file according to the present invention, referring to the first embodiment, the recovery apparatus for incomplete transmission file further includes:
a second calculating module 40, configured to calculate a first check code of the received file based on the received first original subfile block and a second subfile block when the received first original subfile block is complete, where the second subfile block is a file block after the file blocking processing except the first subfile block;
in this embodiment, when the first original subfile block is retransmitted, the sending end sends the first original sub-check code to the receiving end, and when the first original subfile block is received, the second calculating module 40 calculates the check code of the received first original subfile block by using MD5 or SHA1, and if the calculated check code and the first original sub-check code are obtained, it indicates that the first original subfile block is retransmitted successfully. When the received first original subfile block is complete, the receiving end calculates a first check code of the received file based on the received first original subfile block and the second subfile block, specifically, the receiving end replaces the first subfile block in the file with the received first original subfile block, that is, the received first original subfile block is used as a new first subfile block, and then calculates the first check code of the file.
A third calculating module 50, configured to calculate a second sub-check code of the second sub-file block when the first check code is inconsistent with the second check code of the original file;
a second sending module 60, configured to send the block start-stop information of the second subfile block and the second sub-check code to the sending end, where when the block start-stop information and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original subfile block corresponding to the block start-stop information in the original file, and when the second sub-check code is not consistent with the second original sub-check code and the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block.
In this embodiment, the second sending module 60 sends the blocking start-stop information and the second sub-check code of the second subfile block to the sending end, when the blocking start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original subfile block in the original file corresponding to the blocking start-stop information, that is, the sending end calculates the second original sub-check code of the second original subfile block corresponding to the second subfile block in the original file by using MD5 or SHA1, then the sending end compares the second original sub-check code with the received second sub-check code, and when the second sub-check code is inconsistent with the second original sub-check code, if the data size of the second original subfile block is less than or equal to the preset value, the sending end retransmits the second original subfile block. It should be emphasized that, when retransmitting the second original subfile block, the sending end sends the second original subfile block to the receiving end, when receiving the second original subfile block, the receiving end calculates the check code of the received second original subfile block by using MD5 or SHA1, if the calculated check code and the second original subfile block are not consistent, a prompt message indicating that the second original subfile block has been retransmitted successfully is sent to the sending end, and when receiving the prompt message, the sending end retransmits the second original subfile block again until the received check code of the second original subfile block is consistent with the second original subfile block.
In this embodiment, when the received first original subfile block is complete, the second calculating module 40 calculates a first check code of the received file based on the received first original subfile block and second subfile block, and then when the first check code is inconsistent with a second check code of the original file, the third calculating module 50 calculates a second sub check code of the second subfile block, and then the second sending module 60 sends the start-stop information of the block of the second subfile block and the second sub check code to the sending end, wherein when the start-stop information of the block and the second sub check code are received, the sending end calculates a second original sub check code of the second original subfile block corresponding to the start-stop information of the block in the original file, and when the second sub check code is inconsistent with the second original sub check code and the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block, so that the second subfile block is retransmitted when the received first original subfile block is complete but the whole file is still incomplete, and the integrity of the file is further ensured.
A fourth embodiment of the recovery apparatus for incomplete transmission file according to the present invention is proposed based on the first embodiment, and referring to fig. 8, in the present embodiment, the first sending module 30 includes:
a third sending unit 35, configured to send the block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the block start-stop information in the original file, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first subfile block;
a second calculating unit 36, configured to calculate a second sub-check code of a second sub-file block when receiving complete prompt information of the first sub-file block, where the second sub-file block is a file block except the first sub-file block after the file blocking process;
a fourth sending unit 37, configured to send the block start-stop information of the second subfile block and the second sub-checksum to the sending end, where when the block start-stop information and the second sub-checksum are received, the sending end calculates a second original sub-checksum of the second original subfile block corresponding to the block start-stop information in the original file, and retransmits the second original subfile block when the second sub-checksum is not consistent with the second original sub-checksum and the data size of the second original subfile block is smaller than or equal to a preset value.
In this embodiment, the fourth sending unit 37 sends the blocking start-stop information and the second sub-check code of the second sub-file block to the sending end, when receiving the blocking start-stop information and the second sub-check code, the sending end calculates the second original sub-check code of the second original sub-file block in the original file corresponding to the blocking start-stop information, that is, the sending end calculates the second original sub-check code of the second original sub-file block corresponding to the second sub-file block in the original file by using MD5 or SHA1, then the sending end compares the second original sub-check code with the received second sub-check code, and when the second sub-check code is inconsistent with the second original sub-check code, if the data size of the second original sub-file block is less than or equal to the preset value, the sending end retransmits the second original sub-file block. It should be emphasized that, when retransmitting the second original subfile block, the sending end sends the second original subfile block to the receiving end, when receiving the second original subfile block, the receiving end calculates the check code of the received second original subfile block by using MD5 or SHA1, if the calculated check code and the second original subfile block are not consistent, a prompt message indicating that the second original subfile block has been retransmitted successfully is sent to the sending end, and when receiving the prompt message, the sending end retransmits the second original subfile block again until the received check code of the second original subfile block is consistent with the second original subfile block.
In this embodiment, when the first sub-checksum is consistent with the first original sub-checksum, the sending end feeds back complete prompt information of the first sub-file block, and then when the complete prompt information of the first sub-file block is received, the second calculating unit 36 calculates a second sub-checksum of the second sub-file block, and then the fourth sending unit 37 sends start-stop information of the sub-block of the second sub-file block and the second sub-checksum to the sending end, where when the start-stop information of the sub-block and the second sub-checksum are received, the sending end calculates a second original sub-checksum of the second original sub-file block corresponding to the start-stop information of the sub-block in the original file, and when the second sub-checksum is inconsistent with the second original sub-checksum and the data size of the second original sub-file block is less than or equal to a preset value, and the sending end retransmits the second original subfile block, so that the second subfile block is retransmitted when the first subfile block is complete, and the integrity of the file is further ensured.
The invention further provides a recovery device for incomplete transmitted files.
In this embodiment, the recovery apparatus for incomplete transmission file includes:
the second blocking module is used for carrying out blocking processing on the received file to obtain a plurality of sub-file blocks when the received file sent by the sending end is incomplete;
in this embodiment, when the sending end needs to transmit a file to the receiving end, the MD5(Message-digest Algorithm 5) or SHA1(Secure Hash Algorithm) is used to calculate a second check code, which is the check code of the file, and then the file is transmitted to the receiving end, and when the file is sent, the second check code is sent to the receiving end. When a complete file and a second check code of an original file corresponding to the complete file are received, calculating the received check code of the file, namely calculating the second check code of the received file by using MD5 or SHA 1. And then the receiving end compares the check code of the received file with the second check code, and when the check code of the received file is inconsistent with the second check code, the received file is incomplete, so that the second partitioning module performs partitioning processing on the received file to obtain a plurality of sub-file blocks. Preferably, the data amount of each sub-file block is less than or equal to a preset value.
The fourth calculation module is used for calculating the sub check code of each sub file block;
and the third sending module is used for sending the block start-stop information and the sub-check codes of the sub-file blocks to the sending end, wherein when the block start-stop information and the sub-check codes are received, the sending end calculates the original sub-check codes of the original sub-file blocks corresponding to the block start-stop information in the original file, and when the sub-check codes are inconsistent with the corresponding original sub-check codes, the sending end retransmits the inconsistent original sub-file blocks corresponding to the check codes.
In this embodiment, the third sending module sends the block start-stop information and the sub-check codes of each sub-file block to the sending end, and when receiving the block start-stop information and the sub-check codes, the sending end calculates original sub-check codes of each original sub-file block corresponding to the block start-stop information in the original file by using MD5 or SHA1, and when a check code inconsistent with the corresponding original sub-check code exists in the sub-check codes, the sub-file block corresponding to the check code is incomplete, so that the sending end retransmits the original sub-file block corresponding to the check code.
In the embodiment, when a received file sent by a sending terminal is incomplete, a second partitioning module performs partitioning processing on the received file to obtain a plurality of subfile blocks, then a fourth calculating module calculates sub-check codes of the subfile blocks, and then a third sending module sends block start-stop information and the sub-check codes of the subfile blocks to the sending terminal, wherein when the block start-stop information and the sub-check codes are received, the sending terminal calculates original sub-check codes of original subfile blocks corresponding to the block start-stop information in an original file, and when check codes different from the corresponding original sub-check codes exist in the sub-check codes, the sending terminal retransmits the original subfile blocks corresponding to the different check codes; the method and the device have the advantages that the received file is subjected to blocking processing at the receiving end, the original sub-file blocks corresponding to the inconsistent check codes are retransmitted through the sending end, the processes of carrying out blocking processing on the file and calculating the check codes of the sub-file blocks through the sending end are reduced, the phenomenon that the sending end is automatically restarted or even crashed due to overload operation is avoided, the load of the sending end is reduced, and the integrity of the file can be guaranteed.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A recovery method for incomplete transmission files is characterized by comprising the following steps:
when a received file sent by a sending end is incomplete, carrying out blocking processing on the received file to obtain a first sub-file block;
calculating a first sub check code of the first sub file block;
and sending the block start-stop information of the first subfile block and the first sub-check code to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates the first original sub-check code of the first original subfile block in the original file corresponding to the block start-stop information, and when the first sub-check code is inconsistent with the first original sub-check code, the sending end retransmits the first original subfile block.
2. The method for recovering incomplete file of claim 1, wherein the step of sending the start-stop block information and the first sub-parity to the sender comprises:
sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file, and when the first sub-check code is inconsistent with the first original sub-check code and the data volume of the first original sub-file block is larger than a preset value, the sending end feeds back prompt information that the data volume of the first original sub-file block is too large;
when the prompt information fed back by the sending end is received, the first subfile block is subjected to blocking processing to obtain a third subfile block;
calculating a third sub check code of the third sub file block;
and sending the block start-stop information and the third sub-check code of the third sub-file block to the sending end, wherein when the block start-stop information and the third sub-check code are received, the sending end calculates the third original sub-check code of the third original sub-file block corresponding to the block start-stop information in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original sub-file block is smaller than or equal to a preset value, the sending end retransmits the third original sub-file block.
3. The method for recovering that a transmission file is incomplete as claimed in claim 1 or 2, wherein after the step of sending the block start-stop information of the first sub-file block and the first sub-parity to the sender, the method for recovering that a transmission file is incomplete further comprises:
when the received first original subfile block is complete, calculating a first check code of the received file based on the received first original subfile block and a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file is subjected to blocking processing;
when the first check code is inconsistent with a second check code of the original file, calculating a second sub-check code of the second sub-file block;
and sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
4. The method for recovering incomplete file of claim 1, wherein the step of sending the start-stop block information and the first sub-parity to the sender comprises:
sending the block start-stop information and the first sub-check code of the first sub-file block to the sending end, wherein when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original sub-file block corresponding to the block start-stop information in the original file, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first sub-file block;
when the complete prompt message of the first subfile block is received, calculating a second sub check code of a second subfile block, wherein the second subfile block is a file block except the first subfile block after the file blocking processing;
and sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates the second original sub-check code of the second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
5. A recovery method for incomplete transmission files is characterized by comprising the following steps:
when a received file sent by a sending end is incomplete, carrying out blocking processing on the received file to obtain a plurality of sub-file blocks;
calculating the sub check code of each sub file block;
and sending the block start-stop information and the sub-check codes of the sub-file blocks to the sending end, wherein when the block start-stop information and the sub-check codes are received, the sending end calculates the original sub-check codes of the original sub-file blocks corresponding to the block start-stop information in the original file, and when the sub-check codes have the check codes inconsistent with the corresponding original sub-check codes, the sending end retransmits the original sub-file blocks corresponding to the inconsistent check codes.
6. A recovery apparatus in which a transmission file is incomplete, the recovery apparatus comprising:
the first blocking module is used for carrying out blocking processing on the received file to obtain a first subfile block when the received file sent by the sending end is incomplete;
the first calculation module is used for calculating a first sub check code of the first sub file block;
the first sending module is used for sending the block start and stop information of the first subfile block and the first sub check code to the sending end, wherein when the block start and stop information and the first sub check code are received, the sending end calculates a first original sub check code of a first original subfile block in an original file corresponding to the block start and stop information, and when the first sub check code is inconsistent with the first original sub check code, the sending end retransmits the first original subfile block.
7. The apparatus for recovering that a transmission file is incomplete of claim 6, wherein the first transmitting module comprises:
a first sending unit, configured to send block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the block start-stop information in the original file, and when the first sub-check code is inconsistent with the first original sub-check code and the data size of the first original subfile block is greater than a preset value, the sending end feeds back prompt information that the data size of the first original subfile block is too large;
a blocking unit, configured to perform blocking processing on the first subfile block to obtain a third subfile block when the prompt information fed back by the sending end is received;
the first calculating unit is used for calculating a third sub check code of the third sub file block;
and a second sending unit, configured to send the block start-stop information of the third subfile block and the third sub-check code to the sending end, where when the block start-stop information and the third sub-check code are received, the sending end calculates a third original sub-check code of a third original subfile block corresponding to the block start-stop information in the original file, and when the third sub-check code is inconsistent with the third original sub-check code and the data size of the third original subfile block is less than or equal to a preset value, the sending end retransmits the third original subfile block.
8. The recovery apparatus that the transmission file is incomplete as claimed in claim 6 or 7, further comprising:
the second calculation module is used for calculating a first check code of the received file based on the received first original subfile block and the second subfile block when the received first original subfile block is complete;
a third calculating module, configured to calculate a second sub-check code of a second sub-file block when the first check code is inconsistent with a second check code of the original file, where the second sub-file block is a file block except the first sub-file block after the file blocking processing;
and the second sending module is used for sending the block start-stop information and the second sub-check code of the second sub-file block to the sending end, wherein when the block start-stop information and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original sub-file block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data volume of the second original sub-file block is smaller than or equal to a preset value, the sending end retransmits the second original sub-file block.
9. The apparatus for recovering that a transmission file is incomplete of claim 6, wherein the first transmitting module comprises:
a third sending unit, configured to send the block start-stop information of the first subfile block and the first sub-check code to the sending end, where when the block start-stop information and the first sub-check code are received, the sending end calculates a first original sub-check code of a first original subfile block corresponding to the block start-stop information in the original file, and when the first sub-check code is consistent with the first original sub-check code, the sending end feeds back complete prompt information of the first subfile block;
the second calculating unit is used for calculating a second sub check code of a second sub file block when the complete prompt message of the first sub file block is received, wherein the second sub file block is a file block except the first sub file block after the file blocking processing;
and a fourth sending unit, configured to send the block start-stop information of the second subfile block and the second sub-check code to the sending end, where when the block start-stop information and the second sub-check code are received, the sending end calculates a second original sub-check code of a second original subfile block corresponding to the block start-stop information in the original file, and when the second sub-check code is inconsistent with the second original sub-check code and the data size of the second original subfile block is less than or equal to a preset value, the sending end retransmits the second original subfile block.
10. A recovery apparatus in which a transmission file is incomplete, the recovery apparatus comprising:
the second blocking module is used for carrying out blocking processing on the received file to obtain a plurality of sub-file blocks when the received file sent by the sending end is incomplete;
the fourth calculation module is used for calculating the sub check code of each sub file block;
and the third sending module is used for sending the block start-stop information and the sub-check codes of the sub-file blocks to the sending end, wherein when the block start-stop information and the sub-check codes are received, the sending end calculates the original sub-check codes of the original sub-file blocks corresponding to the block start-stop information in the original file, and when the sub-check codes are inconsistent with the corresponding original sub-check codes, the sending end retransmits the inconsistent original sub-file blocks corresponding to the check codes.
CN201610581670.6A 2016-07-20 2016-07-20 Recovery method and device for incomplete transmitted file Active CN107645357B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610581670.6A CN107645357B (en) 2016-07-20 2016-07-20 Recovery method and device for incomplete transmitted file
PCT/CN2017/076158 WO2018014564A1 (en) 2016-07-20 2017-03-09 Method and device for recovering incomplete transmission file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610581670.6A CN107645357B (en) 2016-07-20 2016-07-20 Recovery method and device for incomplete transmitted file

Publications (2)

Publication Number Publication Date
CN107645357A CN107645357A (en) 2018-01-30
CN107645357B true CN107645357B (en) 2020-09-22

Family

ID=60992936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610581670.6A Active CN107645357B (en) 2016-07-20 2016-07-20 Recovery method and device for incomplete transmitted file

Country Status (2)

Country Link
CN (1) CN107645357B (en)
WO (1) WO2018014564A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109413200B (en) * 2018-11-26 2021-04-23 Oppo(重庆)智能科技有限公司 Resource import method, client, MES and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383720A (en) * 2007-09-05 2009-03-11 大唐移动通信设备有限公司 Software updating method of controlled network element, controlled network element and operation maintaining center
CN101453479A (en) * 2007-11-28 2009-06-10 新奥特(北京)视频技术有限公司 Fast document transmission system
CN103095795A (en) * 2011-10-28 2013-05-08 三星Sds株式会社 Apparatus and method for transmitting data
CN101453478B (en) * 2007-11-28 2013-07-03 新奥特(北京)视频技术有限公司 Integrity checking method in document transmission
CN104580158A (en) * 2014-12-12 2015-04-29 集时通(福建)信息科技有限公司 Distributed platform file and content distribution method and distributed platform file and content distribution system
CN105045626A (en) * 2015-07-21 2015-11-11 珠海格力电器股份有限公司 Program burning method, burning device and controller

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001243700A (en) * 2000-02-29 2001-09-07 Pioneer Electronic Corp Signal processing system
CN101043296A (en) * 2007-04-28 2007-09-26 华为技术有限公司 Method for requesting retransmission data, data retransmitting method and data transmission system
WO2011040850A1 (en) * 2009-10-02 2011-04-07 Telefonaktiebolaget Lm Ericsson (Publ) Method for retransmission using checksums for identifying lost data packets
CN105446829A (en) * 2015-09-29 2016-03-30 网易(杭州)网络有限公司 Client program repair method, device and system and server
CN105160253B (en) * 2015-09-29 2018-11-09 网易(杭州)网络有限公司 Repair method, apparatus, system and the server of client-side program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101383720A (en) * 2007-09-05 2009-03-11 大唐移动通信设备有限公司 Software updating method of controlled network element, controlled network element and operation maintaining center
CN101453479A (en) * 2007-11-28 2009-06-10 新奥特(北京)视频技术有限公司 Fast document transmission system
CN101453478B (en) * 2007-11-28 2013-07-03 新奥特(北京)视频技术有限公司 Integrity checking method in document transmission
CN103095795A (en) * 2011-10-28 2013-05-08 三星Sds株式会社 Apparatus and method for transmitting data
CN104580158A (en) * 2014-12-12 2015-04-29 集时通(福建)信息科技有限公司 Distributed platform file and content distribution method and distributed platform file and content distribution system
CN105045626A (en) * 2015-07-21 2015-11-11 珠海格力电器股份有限公司 Program burning method, burning device and controller

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于无线UKey的分段式文件加密系统研究与实现;关少华;《中国优秀硕士学位论文全文数据库 信息科技辑》;20160415;I138-26 *

Also Published As

Publication number Publication date
CN107645357A (en) 2018-01-30
WO2018014564A1 (en) 2018-01-25

Similar Documents

Publication Publication Date Title
JP7029471B2 (en) Uplink data decompression, compression method and equipment
US11251911B2 (en) Data transmission method and related device
KR101966626B1 (en) Method and apparatus for updating software of electronic devices in a vehicle
CN107257270B (en) Data transmission method and system based on hybrid automatic repeat request
US8976814B2 (en) Method of transporting data from sending node to destination node
CN108234087B (en) Data transmission method and sending end
CN105635116A (en) Reconnection methods, apparatuses and system in case of disconnection
CN108243146B (en) Information submitting method
CN110995513A (en) Data sending and receiving method in Internet of things system, Internet of things equipment and platform
CN103841111A (en) Method for preventing data from being submitted repeatedly and server
CN111371631B (en) Heartbeat mechanism detection method, terminal device and storage medium
CN108933642B (en) Downlink retransmission method based on code block grouping, base station and terminal
CN104348578A (en) Data processing method and device
CN110650097B (en) Data broadcasting method and device and computer readable storage medium
CN109120385B (en) Data transmission method, device and system based on data transmission system
CN107645357B (en) Recovery method and device for incomplete transmitted file
CN101453479A (en) Fast document transmission system
CN107147561B (en) Instant messaging method and system based on XMPP protocol
CN111246428A (en) Network reliable communication method, system, device and storage medium
CN114500021A (en) Attack detection method and device, electronic equipment and storage medium
CN104243107A (en) Data transmission method, device, terminal, server and system
CN110971535B (en) Communication congestion control method, device, equipment and storage medium
CN115189813A (en) OTT multicast method, system, device, multicast proxy and multicast server
CN116599953B (en) File uploading method, device, system, equipment and readable storage medium
CN110881213A (en) Method and system for transmitting network test process information

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
GR01 Patent grant
GR01 Patent grant