File transmission method, electronic device, storage medium, and program product

By fragmenting extremely large files and generating checksum blocks, the high latency and low efficiency of traditional TCP/IP file transfer methods in complex network environments are solved, thereby improving the reliability and security of file transfer and providing a more stable and efficient file transfer experience.

CN120166103BActive Publication Date: 2026-01-20ZHONGJINKE INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510648588.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2026-01-20
Estimated Expiration
2045-05-20

AI Technical Summary

Technical Problem

Traditional TCP/IP file transfer methods suffer from high latency and low efficiency when handling extremely large files. Especially under poor network conditions, the integrity and speed of file transfer are difficult to guarantee, and there are data security risks in complex network environments.

Method used

After the target file is fragmented, data fragments whose transmission time exceeds the preset time are encoded to generate check blocks. Redundant information is added using erasure coding algorithms to generate check blocks for data recovery. The check blocks and untransmitted data fragments are then transmitted to the receiving end to ensure file integrity and security.

Benefits of technology

It improves the reliability and efficiency of file transfer, reduces the number of retransmissions, enhances data security, and especially enables rapid recovery of data fragments under unstable network conditions, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120166103B_ABST
    Figure CN120166103B_ABST
Patent Text Reader

Abstract

The application discloses a file transmission method, an electronic device, a storage medium and a program product. The method is applied to a file sending end and comprises the following steps: in response to receiving a file transmission instruction for a target file, the target file is fragmented to obtain a plurality of data fragments, wherein the data quantity of the target file is greater than a preset threshold; in the process of transmitting the plurality of data fragments to a file receiving end, in response to the existence of a preset data fragment with a transmission duration greater than a preset transmission duration in the plurality of data fragments, the preset data fragment is encoded to obtain a check block corresponding to the preset data fragment, wherein the check block is used for recovering the preset data fragment in the case that the preset data fragment fails to be transmitted; and the check block and the data fragments that have not been transmitted in the plurality of data fragments are transmitted to the file receiving end to obtain a transmission result. The application solves the technical problem of low file transmission efficiency in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of data transmission, in particular to a file transmission method, an electronic device, a storage medium and a program product. BACKGROUND

[0002] With the wide application of big data, cloud computing and multimedia technology, large file transmission has become a key requirement in many business scenarios. However, the traditional file transmission method based on Transmission Control Protocol / Internet Protocol (TCP / IP) exposes problems such as high delay and low efficiency when processing large files, especially in poor network conditions, the integrity and speed of file transmission are often difficult to guarantee. To cope with this challenge, technologies such as fragmentation transmission, breakpoint resume and compression algorithm have been developed and applied, greatly improving the efficiency and reliability of file transmission.

[0003] However, these technical solutions still have some limitations in practical application, such as the extension of transmission time caused by excessive number of fragments, the large file size after compression affecting the transmission speed, and the security of data during transmission. Especially in complex network environments, such as transmission across public and private networks, network delay, packet loss and other phenomena occur frequently, further exacerbating the decline in transmission efficiency and the risk of illegal access to file content, resulting in low efficiency of file transmission in related technologies.

[0004] In view of the above problems, no effective solution has been proposed so far. SUMMARY

[0005] The embodiments of the present application provide a file transmission method, an electronic device, a storage medium and a program product, to at least solve the technical problem of low file transmission efficiency in related technologies.

[0006] According to an aspect of an embodiment of the present application, a file transmission method is provided, applied to a file sending end, comprising: in response to receiving a file transmission instruction for a target file, fragmenting the target file to obtain a plurality of data fragments, wherein the data amount of the target file is greater than a preset threshold; in the process of transmitting the plurality of data fragments to a file receiving end, in response to the existence of a preset data fragment with a transmission time longer than a preset transmission time in the plurality of data fragments, encoding the preset data fragment to obtain a check block corresponding to the preset data fragment, wherein the check block is used to recover the preset data fragment in the case of transmission failure of the preset data fragment; transmitting the check block and the data fragments in the plurality of data fragments that have not been transmitted to the file receiving end to obtain a transmission result, wherein the transmission result is used to indicate whether the file receiving end successfully receives the target file.

[0007] Further, the target file is fragmented to obtain a plurality of data fragments, comprising: fragmenting the target file to obtain a plurality of initial data fragments; and compressing the plurality of initial data fragments to obtain the plurality of data fragments.

[0008] Further, the preset data fragment is encoded to obtain a check block corresponding to the preset data fragment, comprising: adding redundant information to the preset data fragment by using an erasure code algorithm to obtain the check block.

[0009] According to another aspect of the embodiment of the present application, a file transmission method applied to a file receiving end is further provided, comprising: in response to receiving a file transmission instruction for a target file, analyzing the file transmission instruction to obtain a preset number of a plurality of data fragments to be received, wherein the plurality of data fragments are obtained by fragmenting the target file by a file sending end, and a data amount of the target file is greater than a preset threshold; in the process of receiving the plurality of data fragments sent by the file sending end, in response to receiving a check block corresponding to a preset data fragment, obtaining a transmission result based on a received number of the plurality of data fragments, the check block and the preset number, wherein the transmission result is used to indicate whether the target file is successfully received; and in the process of receiving the plurality of data fragments sent by the file sending end, in response to not receiving the check block, obtaining the transmission result based on the received number and the preset number.

[0010] Further, the transmission result is obtained based on the received number of the plurality of data fragments, the check block and the preset number, comprising: in response to the received number being the same as the preset number, determining that the transmission result is that the target file is successfully received; and in response to the received number being different from the preset number, determining the transmission result based on the check block and the received number.

[0011] Further, the transmission result is determined based on the check block and the received number, comprising: restoring the check block to obtain the preset data fragment and a current number of the preset data fragment; determining a number and a value of the current number and the received number; and determining the transmission result based on the preset data fragment, the number and the value and the preset number.

[0012] Further, the transmission result is determined based on the preset data fragment, the number and the value and the preset number, comprising: in response to the number and the value being the same as the preset number, combining the preset data fragment and a received data fragment to obtain the target file, and determining that the transmission result is that the target file is successfully received; and in response to the number and the value being different from the preset number, determining that the transmission result is that the target file is not successfully received.

[0013] According to another aspect of the embodiments of the present application, there is also provided a file transmission apparatus, comprising: an application for a file sending end, comprising: a fragmentation module, configured to fragment a target file in response to receiving a file transmission instruction for the target file, to obtain a plurality of data fragments, wherein the data amount of the target file is greater than a preset threshold; an encoding module, configured to encode a preset data fragment in the plurality of data fragments in response to the preset data fragment having a transmission duration greater than a preset transmission duration during transmission of the plurality of data fragments to a file receiving end, to obtain a check block corresponding to the preset data fragment, wherein the check block is used to recover the preset data fragment in the case of transmission failure of the preset data fragment; and a transmission module, configured to transmit the check block and the data fragments other than the transmitted data fragments in the plurality of data fragments to the file receiving end, to obtain a transmission result, wherein the transmission result is used to indicate whether the file receiving end successfully receives the target file.

[0014] According to another aspect of the embodiments of the present application, there is also provided another file transmission apparatus, comprising: an application for a file receiving end, comprising: an analysis module, configured to analyze a file transmission instruction in response to receiving the file transmission instruction for a target file, to obtain a preset number of a plurality of data fragments to be received, wherein the plurality of data fragments are obtained by fragmenting the target file by a file sending end, and the data amount of the target file is greater than a preset threshold; a first receiving module, configured to obtain a transmission result based on the number of received data fragments, the check block and the preset number in the process of receiving the plurality of data fragments sent by the file sending end in response to receiving the check block corresponding to the preset data fragment, wherein the transmission result is used to indicate whether the target file is successfully received; and a second receiving module, configured to obtain the transmission result based on the number of received data fragments and the preset number in the process of receiving the plurality of data fragments sent by the file sending end in response to not receiving the check block.

[0015] According to another aspect of the embodiments of the present application, there is also provided an electronic device, comprising: a memory storing an executable program; and a processor configured to run the program, wherein the program performs the file transmission method when running.

[0016] According to another aspect of the embodiments of the present application, there is also provided a computer readable storage medium, comprising a stored executable program, wherein the computer readable storage medium controls the device where the computer readable storage medium is located to perform the file transmission method when the executable program runs.

[0017] According to another aspect of the embodiments of the present application, there is also provided a computer program product, comprising a computer program, wherein the computer program implements the file transmission method when executed by a processor.

[0018] In the embodiment of the present application, after receiving the file transmission instruction for the target file, the target file is fragmented into a plurality of data fragments; then the plurality of data fragments are transmitted to the data receiving end, in the process, the data fragments with transmission duration longer than the preset transmission duration are encoded to obtain the check block; finally, the check block and the data fragments not transmitted in the plurality of data fragments are transmitted to the file receiving end to obtain the transmission result. It is easy to note that when the file sending end receives the transmission instruction for the target file, the target file is first fragmented based on the preset threshold to form a plurality of smaller data fragments, and the transmission duration of each data fragment is monitored in real time, once it is found that the transmission duration of a certain data fragment exceeds the preset transmission duration, the erasure code encoding mechanism is started immediately to generate the check block, which can be used for quick recovery when the original data fragment transmission fails, avoiding the resource waste and efficiency reduction caused by retransmitting the entire data fragment, thereby solving the efficiency and stability problems of large file transmission under unstable network conditions, improving the reliability of file transmission, improving the file transmission experience and data processing efficiency, and further solving the technical problem of low file transmission efficiency in related technologies. BRIEF DESCRIPTION OF DRAWINGS

[0019] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and serve to explain the present application. In the drawings:

[0020] Figure 1 is a flowchart of a file transmission method according to an embodiment of the present application;

[0021] Figure 2 is a flowchart of another file transmission method according to an embodiment of the present application;

[0022] Figure 3 is a flowchart of an optional file transmission method according to an embodiment of the present application;

[0023] Figure 4 is a schematic diagram of a file transmission device according to an embodiment of the present application;

[0024] Figure 5 is a schematic diagram of another file transmission device according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to better understand the technical scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts should fall within the scope of the present application.

[0026] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.

[0027] According to an embodiment of the present application, an embodiment of a file transmission method is provided, which is applied to a file sending end. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0028] Figure 1 is a flowchart of a file transmission method according to an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:

[0029] Step S102, in response to receiving a file transmission instruction for a target file, the target file is fragmented to obtain a plurality of data fragments, wherein the data amount of the target file is greater than a preset threshold.

[0030] The above-mentioned target file can refer to a file that needs to be transmitted, and the data amount of the target file reaches or exceeds a preset threshold, triggering a fragmentation transmission mechanism. The target file type can include but is not limited to documents, images, videos, audios, database backups, and other types of digital content. The specific target file type needs to be determined according to the actual transmission requirements. The target file is the core object in the transmission process, and the transmission efficiency and stability can be improved through fragmentation processing.

[0031] The file transmission instruction can be an instruction issued by a user or a system, used to instruct the transmission system to start the transmission process of the target file. The type of file transmission instruction can include but is not limited to an instruction triggered by a user interface, an instruction automatically generated by the system, an instruction issued by a specific interface, etc. The specific file transmission instruction is determined according to the system design, which is not limited herein. The file transmission instruction can include but is not limited to identification information of the target file, a transmission direction (upload or download), an address of a target server, and other key parameters.

[0032] The above-mentioned fragmentation can refer to the process of dividing a large file into multiple smaller data blocks according to a predetermined rule, aiming to optimize transmission and storage efficiency. The type of fragmentation can include but is not limited to size-based fragmentation, content-based fragmentation, dynamic fragmentation, etc. The specific fragmentation type needs to be determined according to the fragmentation purpose, which is not limited herein.

[0033] The above-mentioned data fragment can refer to a single file block generated after fragmentation operation, which is a subset of the target file. The type of data fragment can include but is not limited to fixed-size data fragment, variable-length fragment, and hash value-based fragment, etc. The specific data fragment type needs to be determined according to the fragmentation method, which is not limited herein. The data fragment can be used as an independent unit in the transmission process, facilitating management and parallel processing.

[0034] The above-mentioned data volume can refer to the actual size of the target file, which is usually expressed in units of bytes (Bytes), kilobytes (Kilobytes), megabytes (Megabytes), gigabytes (Gigabytes), etc. The data volume is a key indicator for determining whether fragmentation transmission is needed. When the data volume of the target file exceeds a predetermined threshold, the fragmentation transmission mechanism will be activated.

[0035] The above-mentioned predetermined threshold can be a standard value set to trigger fragmentation transmission. When the data volume of the target file exceeds this threshold, the fragmentation mechanism will be started. The specific predetermined threshold needs to be determined according to application scenarios, network conditions, storage capacity, and other factors, which is not limited herein. The predetermined threshold can be used to divide the file transmission mode and help the system determine the optimal allocation of resources during the transmission process.

[0036] In an optional embodiment, in response to receiving a file transmission instruction for a target file, the file is fragmented to obtain multiple data fragments. This process is particularly for large files with a data volume greater than a predetermined threshold. Through fragmentation, not only can the transmission efficiency in complex network environments be significantly improved, but also the impact of a single data block transmission failure on the overall transmission can be reduced. Redundant data fragments are used for quick recovery, thereby improving the stability and reliability of the transmission.

[0037] In step S104, in the process of transmitting the plurality of data fragments to the file receiving end, in response to the presence of a preset data fragment with a transmission duration greater than a preset transmission duration in the plurality of data fragments, the preset data fragment is encoded to obtain a check block corresponding to the preset data fragment, wherein the check block is used to recover the preset data fragment in the case of transmission failure of the preset data fragment.

[0038] The above-mentioned file receiving end can refer to a target system or entity of file transmission, responsible for receiving and processing uploaded data fragments. The type of file receiving end can include but is not limited to file server, application server, client device, etc. The specific file receiving end needs to be determined according to the actual use scene and system design, which is not limited here. The file receiving end can be used to complete the integration, checking and recovery of data fragments, and finally restore the complete target file, etc.

[0039] The above-mentioned preset transmission duration can refer to a time limit set in advance to ensure the transmission efficiency of data fragments. When the transmission time of a certain data fragment exceeds the preset transmission duration, additional data protection measures will be triggered. The type of preset transmission duration can include but is not limited to static preset transmission duration based on experience or test results, real-time dynamic preset transmission duration based on network conditions, etc. The specific preset transmission duration needs to be determined according to the actual situation, which is not limited here. The preset transmission duration can be used to ensure that the data fragments are transmitted within a reasonable time, avoid long network waiting time, and enhance transmission stability, etc.

[0040] The above-mentioned preset data fragment can refer to a data fragment identified due to long transmission time during transmission.

[0041] The above-mentioned encoding can refer to the process of converting original data into another form. The type of encoding can include but is not limited to erasure encoding, Huffman encoding, and forward error correction encoding, etc. The specific encoding needs to be determined according to the encoding purpose and actual demand, which is not limited here. Encoding can be used to encode data fragments when the transmission duration of data fragments exceeds the preset value, thereby playing a role in protecting data, compression, and improving transmission efficiency.

[0042] The above-mentioned check block can refer to a redundant data unit generated by encoding the preset data fragment for data recovery. The type of check block can include but is not limited to erasure code check block, parity check block, etc. The specific type of check block needs to be determined according to the encoding method, which is not limited here. The check block can be used for data recovery to ensure data integrity.

[0043] The above-mentioned recovery can refer to the process of using a check block to recover a data fragment when the data fragment is lost or damaged during data transmission. The recovery process can be used to ensure data integrity and transmission reliability.

[0044] In an optional embodiment, when it is detected that the transmission time of a data segment is too long, exceeding the preset transmission duration, the system will encode the data segment to generate a check block. These check blocks can be used for data recovery at the receiving end, ensuring the integrity of the data segment and the reliability of the transmission, even in complex network environments. In addition, by dynamically adjusting the preset transmission duration, the system can adapt to different network conditions, improving the flexibility of data transmission. The encoding and check block mechanism not only enhances the security of the data, but also significantly improves the overall efficiency of file transmission, especially in large file transmission, which can effectively reduce the transmission failure rate, reduce the number of retransmissions, speed up the transmission process, and provide users with a more stable, efficient, and secure file transmission experience.

[0045] Step S106, transmitting the check block and the untransmitted data segments in the plurality of data segments to the file receiving end to obtain a transmission result, wherein the transmission result is used to indicate whether the target file is successfully received by the file receiving end.

[0046] The transmission result can be a confirmation feedback of the system on the file receiving state after the completion of the file transmission process, indicating whether all data segments and check blocks are successfully received by the file receiving end. The type of transmission result can include, but is not limited to, successful transmission result, failed transmission result, and partially successful transmission result, etc. The specific transmission result needs to be determined according to the actual situation, which is not limited here. The transmission result can be used to confirm the completeness of the received data, trigger subsequent operations, generate a transmission efficiency report, etc.

[0047] In an optional embodiment, the check block and the untransmitted data segments are sent to the file receiving end, and the final transmission result is obtained. Through the transmission result acquisition and feedback mechanism, the system can monitor the transmission state in real time, adjust the transmission strategy in time, avoid invalid retransmission operations, save network resources, and improve transmission efficiency.

[0048] In the embodiment of the present application, after receiving the file transmission instruction for the target file, the target file is fragmented into a plurality of data fragments; then the plurality of data fragments are transmitted to the data receiving end, and in the process, the data fragments with a transmission duration longer than a preset transmission duration are encoded to obtain a check block; finally, the check block and the data fragments that have not been transmitted in the plurality of data fragments are transmitted to the file receiving end to obtain a transmission result. It is easy to note that when the file sending end receives the transmission instruction for the target file, the target file is first fragmented based on a preset threshold to form a plurality of smaller data fragments, and the transmission duration of each data fragment is monitored in real time. Once it is found that the transmission duration of a certain data fragment exceeds the preset transmission duration, the erasure code encoding mechanism is immediately started to generate a check block. The check block can be used for quick recovery when the original data fragment fails to transmit, avoiding resource waste and efficiency reduction caused by retransmitting the entire data fragment, thereby solving the efficiency and stability problems of large file transmission under unstable network conditions, improving the reliability of file transmission, improving the file transmission experience and data processing efficiency, and further solving the technical problem of low file transmission efficiency in related technologies.

[0049] Optionally, the target file is fragmented to obtain a plurality of data fragments, including: fragmenting the target file to obtain a plurality of initial data fragments; and compressing the plurality of initial data fragments to obtain the plurality of data fragments.

[0050] The above-mentioned initial data fragments can refer to original data blocks obtained by dividing the target file according to a preset size or logical rule before file transmission. Fragmenting the target file into initial data fragments can be used to simplify transmission, data recovery, and improve file transmission speed by processing a plurality of initial data fragments in parallel.

[0051] The above-mentioned compression can refer to converting data fragments into a more compact format through a specific algorithm to reduce the amount of data required for transmission. The type of compression can include but is not limited to lossless compression, lossy compression, predefined compression algorithm, and adaptive compression, etc. The specific compression needs to be determined according to actual needs, which is not limited here. Compression can be used to reduce transmission cost, improve transmission efficiency, and optimize storage, etc.

[0052] In an optional embodiment, by splitting the target file into multiple initial data slices, not only the transmission process is simplified, but also parallel processing is allowed, thus shortening the overall transmission time; secondly, each initial data slice is compressed, further reducing the amount of data required for transmission and reducing network transmission costs. The above process, through the combination of slicing and compression, significantly improves the fault tolerance and security of data in the transmission process. Even in the case of network instability or partial slice loss, through mechanisms such as erasure coding, the remaining slices and generated check blocks can still be used to recover the complete file. In addition, compressed data slices are more difficult to be intercepted and analyzed by third parties, thus protecting the privacy and security of file content during transmission.

[0053] Optionally, the preset data slice is encoded to obtain a check block corresponding to the preset data slice, including: adding redundant information to the preset data slice by using an erasure code algorithm to obtain the check block.

[0054] The above erasure code algorithm can refer to a data redundancy technology, and the erasure code algorithm can be used to protect data from loss or damage in network transmission or distributed storage systems, by splitting the original data into multiple data blocks and encoding these data blocks to generate additional redundant data blocks, i.e. check blocks, even if some data blocks are lost, the original data can be recovered from the remaining data blocks and check blocks.

[0055] The above redundant information can refer to additional information added in the data encoding process, and the redundant information can be used to help restore the integrity and consistency of the data.

[0056] In an optional embodiment, redundant information is added to the preset data slice by using an erasure code algorithm to generate a check block, in order to improve the efficiency, stability and security of large file transmission. In this process, the erasure code algorithm splits and encodes the original data slice to generate additional check blocks, even if some data slices are lost or damaged during network transmission, the original file can be recovered from the remaining data slices and check blocks, greatly enhancing the fault tolerance of file transmission. This mechanism not only ensures the integrity of data transmission, but also improves the transmission strategy, dynamically adjusts the encoding and transmission of data slices according to the file transmission instruction and the preset transmission time, avoiding long waiting and invalid retransmission, thus significantly improving the transmission efficiency in complex network environment. In addition, the generation of check blocks also increases the security of data, even if the data is intercepted during transmission, it is difficult for attackers to tamper with or analyze the complete file content, protecting the privacy and data security during file transmission.

[0057] According to an embodiment of the present application, an embodiment of a file transmission method is also provided, which is applied to a file receiving end. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.

[0058] Figure 2 FIG. 2 is a flowchart of another embodiment of a file transmission method according to an embodiment of the present application, as shown in the figure, the method comprises the following steps: Figure 2

[0059] In step S202, in response to receiving a file transmission instruction for a target file, the file transmission instruction is parsed to obtain a preset number of data fragments to be received, wherein the data fragments are obtained by file sending end for the target file, and the data amount of the target file is greater than a preset threshold.

[0060] The above parsing can refer to the process of analyzing the instruction by the receiving end system after the file transmission instruction reaches the file receiving end, and extracting the key parameters. The key parameters obtained by parsing can include but are not limited to the preset number of data fragments to be received, the size of the data fragments, the transmission protocol, the identification of the target file, etc. The type of parsing can include but is not limited to text-based parsing, transmission protocol-based parsing, custom instruction parsing, etc. The specific parsing type needs to be determined according to actual needs, which is not limited here. Parsing can be used to determine transmission parameters, optimize resource allocation, detect and handle exceptions, etc.

[0061] The above-mentioned preset number can refer to the expected number of data fragments generated by the file sending end after splitting the target file, which can be determined according to historical experience and actual situation, which is not limited here. The preset number can be used for transmission control, resource planning, and efficiency optimization, etc.

[0062] In an optional embodiment, in response to receiving a file transmission instruction of a target file, the file receiving end first parses the file transmission instruction to obtain a preset number of data fragments to be received. This step is the key to ensure efficient and safe file transmission. Obtaining the preset number of data fragments in advance enables the receiving end to accurately prepare for receiving resources, while monitoring and handling exceptions during transmission.

[0063] In step S204, during the process of receiving the plurality of data fragments sent by the file sending end, in response to receiving a check block corresponding to a preset data fragment, a transmission result is obtained based on the number of received data fragments, the check block and the preset number, wherein the transmission result is used to indicate whether the target file is successfully received. ​

[0064] The file sending end can be the initiator of the file transmission, responsible for splitting the target file into multiple data segments and sending these data segments and necessary check blocks to the file receiving end. The file sending end can include, but is not limited to, a personal device, a server, a dedicated file transmission device, etc. The specific file sending end is determined according to the actual situation, which is not limited here. The file sending end can be used for file splitting, data compression, secure transmission, transmission control, etc.

[0065] The receiving quantity can be the total number of data segments received by the file receiving end during the transmission process. The receiving quantity can include, but is not limited to, the total receiving quantity, the partial receiving quantity, and the excess receiving quantity, etc. The specific receiving quantity is determined according to the actual receiving situation, which is not limited here. The receiving quantity can be used to confirm the integrity of the transmission process, i.e., whether all the preset data segments have been successfully received. In addition, by comparing the receiving quantity and the preset quantity, the error or missing data segments in the transmission process can be detected, and the retransmission mechanism can be started in time.

[0066] In an optional embodiment, the file sending end not only transmits multiple data segments, but also determines whether to send check blocks according to whether the transmission time exceeds a preset threshold, to enhance the data recovery capability. The file receiving end needs to count the total number of received data segments during the receiving process, and verify the check blocks and the preset quantity, to determine the transmission result, i.e., whether the entire target file has been successfully received. This receiving confirmation mechanism is beneficial to data integrity protection, transmission security enhancement, and transmission efficiency improvement.

[0067] In step S206, during the process of receiving the multiple data segments sent by the file sending end, the transmission result is obtained based on the receiving quantity and the preset quantity in response to not receiving the check block.

[0068] In an optional embodiment, when the file receiving end does not receive the check block during the process of receiving the multiple data segments sent by the file sending end, it compares the current received data segment quantity, i.e., the receiving quantity, with the preset quantity, to evaluate the integrity of the transmission process. This mechanism ensures that large file transmission can be efficiently and stably completed even without check blocks, which not only improves the transmission efficiency and reduces resource waste, but also provides immediate error feedback, simplifies the transmission logic, significantly enhances the system performance and user experience, especially in high-bandwidth and low-latency network environments.

[0069] Optionally, the transmission result is determined based on the number of received data segments, the check block and a preset number, including: in response to the number of received data segments being the same as the preset number, determining that the transmission result is successful reception of the target file; and in response to the number of received data segments being different from the preset number, determining the transmission result based on the check block and the number of received data segments.

[0070] In an optional embodiment, when the number of received data segments, i.e., the number of received data segments, at the file receiving end matches the preset number at the file sending end, the system will immediately confirm that the transmission result is successful, which means that the entire target file has arrived at the receiving end completely and accurately. Conversely, if the number of received data segments does not match the preset number, i.e., some data segments are not successfully received, the receiving end will attempt data recovery using the received check block to reconstruct the missing data segments using the redundant information of the check block, thereby ensuring the integrity of the file transmission and the availability of the data. The above process, with the assistance of the check block, can maximize the integrity of the file transmission even in poor network environments or in the event of unexpected conditions during data transmission, significantly improving the fault tolerance and data recovery efficiency of the system.

[0071] Optionally, the transmission result is determined based on the check block and the number of received data segments, including: recovering the check block to obtain preset data segments and a current number of preset data segments; determining a number and a value of the current number and the number of received data segments; and determining the transmission result based on the preset data segments, the number and the value, and the preset number.

[0072] The above current number can refer to the total number of preset data segments obtained after data recovery at the file receiving end using the check block. The current number reflects the actual number of data segments possessed by the receiving end after the data recovery operation, and can be used for data recovery confirmation and transmission integrity verification.

[0073] The above number and value can refer to the numerical value and relationship of the current number and the number of received data segments. The type of number and value can include, but is not limited to, the current number being equal to the number of received data segments, the current number being greater than the number of received data segments, and the current number being less than the number of received data segments. By analyzing the number and value, the integrity of the file transmission can be determined, including whether all data segments are successfully received and whether the missing data segments are successfully recovered using the check block.

[0074] In an optional embodiment, when the file receiving end fails to directly receive all the preset data fragments, the system can obtain the current number of preset data fragments through data recovery operation based on the check block and the received number. By analyzing the number and value of the current number and the received number, the receiving end can accurately judge the effect of the data recovery operation and the integrity of the transmission process. This mechanism enables the receiving end to recover the lost data fragments through the data recovery operation of the check block even in the case of partial data fragment loss, thereby ensuring the integrity of file transmission and improving the fault tolerance of the system.

[0075] Optionally, based on the preset data fragments, the number and value, and the preset number, determining the transmission result comprises: in response to the number and value being the same as the preset number, combining the preset data fragments and the received data fragments to obtain a target file, and determining the transmission result as successfully receiving the target file; and in response to the number and value being different from the preset number, determining the transmission result as unsuccessfully receiving the target file.

[0076] In an optional embodiment, when the current number of preset data fragments obtained by the file receiving end through direct reception and check block recovery is consistent with the preset number, the system can confirm that all data fragments have been successfully transmitted. At this time, the receiving end will combine the received data fragments to reconstruct the complete target file, and the transmission result is determined as successfully receiving the target file; otherwise, if the number and value are different from the preset number, it indicates that there is an abnormality in the data transmission process, and part of the data fragments are not successfully recovered or received. In this case, the system will determine the transmission result as unsuccessfully receiving the target file, and may trigger a retransmission mechanism or other error handling process to ensure the complete transmission of the file. Through the direct comparison of the number and value with the preset number, the file receiving end can accurately judge the integrity of file transmission, avoiding the misjudgment of the transmission result caused by the uncertainty of the data recovery operation. At the same time, whether it is the availability of the successfully transmitted file or the immediate retry in the case of transmission failure, the system can quickly give feedback according to the transmission result, thereby greatly improving the user experience and reducing the waiting time and uncertainty of operation.

[0077] In an optional embodiment, Figure 3 is an optional file transmission method flowchart according to an embodiment of the application, as shown in Figure 3As shown, the file transmission method starts with file uploading first; it is judged whether the file size is greater than 1M, if not, the file stream is directly encrypted, if yes, the file is divided into pieces by 1M, the file is divided into pieces by 1M, and the compressed content is compressed after the pieces, and the check block is generated according to the error correction code mechanism; then, the content consistency calculation of the compressed content after the pieces is performed to generate the signing value; then, the file stream is encrypted and starts to be uploaded in pieces; it is judged whether the uploading is successful, if not, the content consistency calculation of the compressed content after the pieces is performed again to generate the signing value, if yes, the file stream is received and decrypted, and it is judged whether it is timed out, if yes, it is judged whether the number of received pieces has exceeded the minimum number of error correction codes, if not, the signing is verified after the file stream is received; and it is judged whether there is a data piece missing, if not, the file stream is combined according to the serial number to form a complete large file, if yes, it is judged whether the number of received pieces has exceeded the minimum number of error correction codes, if not, the method starts to be executed again, if yes, the file is recovered using the error correction code mechanism, and the file transmission method ends.

[0078] According to another aspect of the embodiment of the application, a file transmission device is also provided, which is applied to a file sending end and can execute the file transmission method of the above-mentioned embodiment. The specific implementation method and preferred application scenario are the same as those of the above-mentioned embodiment, and will not be repeated here.

[0079] Figure 4 is a schematic diagram of a file transmission device according to an embodiment of the application, as Figure 4 shown, the device comprises the following: a piece module 402, an encoding module 404, and a transmission module 406.

[0080] The piece module 402 divides a target file into pieces in response to receiving a file transmission instruction for the target file, to obtain a plurality of data pieces, wherein the data amount of the target file is greater than a preset threshold; the encoding module 404 encodes a preset data piece in the plurality of data pieces in response to the preset data piece having a transmission duration greater than a preset transmission duration during the transmission of the plurality of data pieces to a file receiving end, to obtain a check block corresponding to the preset data piece, wherein the check block is used to recover the preset data piece in the case of transmission failure of the preset data piece; and the transmission module 406 transmits the check block and the data pieces that have not been transmitted in the plurality of data pieces to the file receiving end, to obtain a transmission result, wherein the transmission result is used to indicate whether the file receiving end successfully receives the target file.

[0081] Optionally, the piece module comprises: a piece unit, configured to divide the target file into pieces to obtain a plurality of initial data pieces; and a compression unit, configured to compress the plurality of initial data pieces to obtain a plurality of data pieces.

[0082] Optionally, the encoding module comprises: adding redundancy information to the preset data segment by using an erasure code algorithm to obtain a check block.

[0083] According to another aspect of the embodiments of the present application, another file transmission device is also provided, which is applied to a file receiving end and can execute the file transmission method of the above-mentioned embodiments. The specific implementation method and preferred application scenario are the same as those of the above-mentioned embodiments, and thus are not described here again.

[0084] Figure 5 is a schematic diagram of another file transmission device according to an embodiment of the present application, as shown in Figure 5 The device comprises the following: an analysis module 502, a first receiving module 504, and a second receiving module 506.

[0085] The analysis module 502 is configured to analyze a file transmission instruction for a target file to obtain a preset number of data segments to be received in response to receiving the file transmission instruction, wherein the data segments are obtained by a file sending end by fragmenting the target file, and the data amount of the target file is greater than a preset threshold. The first receiving module 504 is configured to obtain a transmission result based on the number of received data segments, the check block, and the preset number in response to receiving the check block corresponding to a preset data segment during the process of receiving the data segments sent by the file sending end, wherein the transmission result is used to indicate whether the target file is successfully received. The second receiving module 506 is configured to obtain a transmission result based on the number of received data segments and the preset number in response to not receiving the check block during the process of receiving the data segments sent by the file sending end.

[0086] Optionally, the first receiving module comprises: a first determination unit configured to determine that the transmission result is that the target file is successfully received in response to the number of received data segments being the same as the preset number; and a second determination unit configured to determine the transmission result based on the check block and the number of received data segments in response to the number of received data segments being different from the preset number.

[0087] Optionally, the second determination unit comprises: a recovery subunit configured to recover the check block to obtain the preset data segment and a current number of the preset data segment; a first determination subunit configured to determine a number and value of the current number and the number of received data segments; and a second determination subunit configured to determine the transmission result based on the preset data segment, the number and value, and the preset number.

[0088] Optionally, the second determination subunit comprises: in response to the number and value being the same as the preset number, combining the preset data segment and the received data segment to obtain the target file and determining that the transmission result is that the target file is successfully received; and in response to the number and value being different from the preset number, determining that the transmission result is that the target file is not successfully received.

[0089] In the above-mentioned embodiments of the present application, the description of each embodiment is focused on, and the part not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0090] In several embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and in actual implementation, there can be another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, and can be electrical or other forms.

[0091] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0092] In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0093] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and various program code storage media.

[0094] The above-mentioned is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be regarded as the protection scope of the present application.

Claims

1. A file transfer method characterized by, Applied to a file sending end, comprising: In response to receiving a file transmission instruction for a target file, the target file is fragmented to obtain a plurality of data fragments and a preset number of the plurality of data fragments, wherein the data amount of the target file is greater than a preset threshold; In the process of transmitting the plurality of data fragments to a file receiving end, in response to the presence of a preset data fragment with a transmission duration greater than a preset transmission duration in the plurality of data fragments, the preset data fragment is encoded to obtain a corresponding check block, wherein the check block is used to recover the preset data fragment in the case of transmission failure of the preset data fragment, and the preset transmission duration is dynamically adjusted according to different network conditions; The check block and the data fragments not transmitted in the plurality of data fragments are transmitted to the file receiving end to obtain a transmission result, wherein the transmission result is used to indicate whether the file receiving end successfully receives the target file, and the transmission result is obtained based on the number of received data fragments, the check block and the preset number in the file receiving end, and the number of received data fragments is the number of data fragments received by the file receiving end during transmission; In the file receiving end, the transmission result is obtained based on the number of received data fragments, the check block and the preset number, comprising: In response to the number of received data fragments being the same as the preset number, it is determined that the transmission result is successfully received the target file; In response to the number of received data fragments being different from the preset number, the check block is recovered to obtain the preset data fragment and the current number of the preset data fragment; the number and value of the current number and the number of received data fragments are determined; and based on the preset data fragment, the number and value, and the preset number, the transmission result is determined; Wherein, the encoding of the preset data fragment to obtain the corresponding check block of the preset data fragment comprises: Adding redundant information to the preset data fragment using an erasure code algorithm to obtain the check block, wherein the redundant information is additional information added in the data encoding process; Wherein, the target file is fragmented to obtain a plurality of data fragments, comprising: the target file is fragmented to obtain a plurality of initial data fragments; and the plurality of initial data fragments are compressed to obtain the plurality of data fragments, wherein the compression is used to reduce the transmission data amount of the plurality of initial data fragments.

2. A file transfer method characterized by, Applied to a file receiving end, comprising: In response to receiving a file transmission instruction for a target file, the file transmission instruction is parsed to obtain a preset number of a plurality of data fragments to be received, wherein the plurality of data fragments are obtained by fragmenting the target file by a file sending end, the data amount of the target file is greater than a preset threshold, the plurality of data fragments are obtained by compressing a plurality of initial data fragments, the plurality of initial data fragments are obtained by fragmenting the target file, and the compression is used to reduce the transmission data amount of the plurality of initial data fragments; In the process of receiving the plurality of data fragments sent by the file sending end, in response to receiving a check block corresponding to a preset data fragment, a transmission result is obtained based on a received number of the plurality of data fragments, the check block and the preset number, wherein the transmission result is used to indicate whether the target file is successfully received, the check block is obtained by adding redundant information to the preset data fragment using an erasure code algorithm when the file sending end exists a preset data fragment with a transmission duration longer than a preset transmission duration in the plurality of data fragments, the preset transmission duration is dynamically adjusted according to different network conditions, and the redundant information is information added in a data encoding process; In the process of receiving the plurality of data fragments sent by the file sending end, in response to not receiving the check block, the transmission result is obtained based on the received number and the preset number, wherein the received number is a number of data fragments received by the file receiving end in the transmission process; Wherein, the transmission result is obtained based on the received number of the plurality of data fragments, the check block and the preset number, including: In response to the received number being the same as the preset number, it is determined that the transmission result is that the target file is successfully received; In response to the received number being different from the preset number, the check block is recovered to obtain the preset data fragment and a current number of the preset data fragment, the current number and a value of the received number are determined, and the transmission result is determined based on the preset data fragment, the number and value and the preset number.

3. The file transfer method of claim 2, wherein, The transmission result is determined based on the preset data fragment, the number and value and the preset number, including: In response to the number and value being the same as the preset number, the preset data fragment and the received data fragment are combined to obtain the target file, and it is determined that the transmission result is that the target file is successfully received; In response to the number and value being different from the preset number, it is determined that the transmission result is that the target file is not successfully received.

4. An electronic device, comprising: Including: A memory storing an executable program; A processor configured to run the program, wherein the program performs the method of any one of claims 1 to 3 when running.

5. A computer readable storage medium, characterized in that, The computer readable storage medium includes a stored executable program, wherein the executable program controls the device where the storage medium is located to perform the method of any one of claims 1 to 3 when running.

6. A computer program product, characterised in that, Including a computer program, the computer program implements the method according to any one of claims 1 to 3 when executed by a processor.

Citation Information

Patent Citations

  • File transmission method and device, computer equipment and storage medium

    CN116827672A