A file transmission method and device based on a protocol hybrid strategy

By segmenting files into data blocks and combining a hybrid strategy of TCP and UDP protocols, the problems of high transmission latency and low efficiency in file transfer are solved, achieving a fast, stable, and efficient file transfer process.

CN116886791BActive Publication Date: 2026-07-21CHONGQING CHANGAN TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING CHANGAN TECH CO LTD
Filing Date
2023-07-28
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies, Transmission Control Protocol (TCP) suffers from high transmission latency and low efficiency during file uploads, while User Datagram Protocol (UDP) cannot balance accuracy and efficiency in file transfer.

Method used

A hybrid strategy is adopted to divide the file into data blocks, transmit metadata and verification information via TCP protocol, determine the protocol hybrid strategy based on the current network information, use a mixture of TCP and UDP protocols to transmit data blocks, and perform integrity verification at the receiving end.

Benefits of technology

It achieves a balance between accuracy and efficiency in file transfer, overcoming the problems of low transmission efficiency and high latency of the traditional TCP protocol, and ensuring data integrity and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116886791B_ABST
    Figure CN116886791B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data transmission, in particular to a file transmission method and device based on a protocol hybrid strategy, which comprises the following steps: dividing a to-be-transmitted file into data blocks, and calculating the check information of each data block; transmitting the metadata of the to-be-transmitted file and the check information of each data block by using a TCP protocol; acquiring current network information, and determining a protocol hybrid strategy according to the current network information; transmitting all the data blocks by using a mixed transmission mode of the TCP protocol and the UDP protocol according to the protocol hybrid strategy; and completing the transmission of the to-be-transmitted file when an acknowledgement message fed back by a receiving end is received, wherein the acknowledgement message is generated by the receiving end after integrity verification of all the data blocks according to the metadata and the check information. The embodiment of the application combines the advantages of the TCP protocol and the UDP protocol, and achieves the effect of giving consideration to the accuracy and transmission efficiency of file transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data transmission technology, specifically to a file transfer method and apparatus based on a protocol hybrid strategy. Background Technology

[0002] The traditional Transmission Control Protocol (TCP) is a connection-oriented, reliable transmission protocol. In file uploads, it provides reliable data transmission, guarantees data order, supports flow control and congestion control, and ensures data integrity. TCP is often used in scenarios with high data integrity requirements. However, during file uploads, TCP requires a three-way handshake to establish a connection. While this reliability is important, it also leads to higher transmission latency and lower transmission efficiency.

[0003] On the other hand, User Datagram Protocol (UDP) is a simple data transmission method that enables data transmission over a network. The advantages of UDP are its fast transmission speed and the fact that it doesn't require a complete connection. However, its disadvantage is that due to its lack of reliability, transmitted data may be lost or corrupted. Related technologies use TCP to transmit file control information, such as retransmission of small data sets and transmission speed information. For file data itself, UDP is used for transmission. However, UDP cannot simultaneously guarantee both accuracy and efficiency in file transmission.

[0004] Therefore, existing technologies still need to be improved and enhanced. Summary of the Invention

[0005] This application provides a file transfer method and apparatus based on a protocol hybrid strategy to solve the technical problem in related technologies where the UDP protocol cannot simultaneously ensure the accuracy and efficiency of file transfer.

[0006] To achieve the above objectives, this application adopts the following technical solution: The first aspect of this application provides a file transfer method based on a protocol hybrid strategy, including the following steps: The file to be transmitted is divided into data blocks, and the verification information of each data block is calculated; The metadata of the file to be transmitted and the verification information of each data block are transmitted using the TCP protocol. Obtain current network information and determine a protocol mixing strategy based on the current network information; According to the aforementioned protocol hybrid strategy, all data blocks are transmitted using a hybrid transmission method that combines TCP and UDP protocols. When a confirmation message is received from the receiving end, the transmission of the file to be transmitted is completed. The confirmation message is generated by the receiving end after verifying the integrity of all the data blocks based on the metadata and the verification information.

[0007] Based on the above technical means, the embodiments of this application combine the advantages of TCP and UDP protocols, achieving the effect of balancing the accuracy and efficiency of file transmission.

[0008] Optionally, the metadata includes: the file size, file name, file path, and total number of data blocks of the file to be transmitted, and the verification information is an MD5 value.

[0009] Based on the above technical means, in the embodiments of this application, the file size, file name, file path, total number of data blocks, and MD5 value are all key data of the file to be transmitted. The TCP protocol can provide reliable data transmission, thereby improving the reliability of file transmission.

[0010] Optionally, obtaining current network information and determining a protocol hybridization strategy based on the current network information includes: Obtain each network metric corresponding to the current network, and perform normalization processing on each network metric to obtain the normalization result corresponding to each network metric; Calculate the comprehensive value based on the normalization result; The usage ratio between TCP and UDP protocols is calculated based on the comprehensive value, and the usage ratio is used as the protocol mixing strategy.

[0011] Based on the above technical means, the embodiments of this application normalize each network indicator to ensure that the values ​​of different indicators are comparable, and then calculate the usage ratio between TCP and UDP protocols so as to carry out mixed transmission according to the usage ratio, thereby achieving both the accuracy and efficiency of file transmission.

[0012] Optionally, calculating the comprehensive value based on the normalization result includes: Obtain the weight values ​​corresponding to each of the pre-set network metrics; The normalized results of each network indicator are weighted according to their respective weight values ​​to obtain a comprehensive value.

[0013] Based on the above technical means, the embodiments of this application quantify network information by weighted summation of each normalization result, thereby calculating the usage ratio between TCP and UDP protocols and forming a protocol hybrid strategy.

[0014] Optionally, the network metrics include: network latency, network packet loss rate, and bandwidth utilization.

[0015] Based on the above technical means, the embodiments of this application normalize network latency, network packet loss rate and bandwidth utilization, and then calculate the comprehensive value and the usage ratio between TCP protocol and UDP protocol.

[0016] Optionally, in accordance with the protocol hybridization strategy, all data blocks are transmitted using a hybrid transmission method combining TCP and UDP protocols, including: The first number of data blocks transmitted using the TCP protocol and the second number of data blocks transmitted using the UDP protocol are obtained according to the usage ratio, and the sum of the first number and the second number is equal to the total number of data blocks. The first number of data blocks will be transmitted using the TCP protocol, and the second number of data blocks will be transmitted using the UDP protocol.

[0017] Based on the above technical means, the hybrid strategy of TCP and UDP protocols in this application overcomes the problems of low transmission efficiency and high transmission latency of the traditional TCP protocol, and realizes a faster, more stable and efficient file transfer process.

[0018] Optionally, the step of dividing the file to be transmitted into data blocks and calculating the verification information for each data block further includes: Each data block is assigned a unique identifier.

[0019] Based on the above technical means, the embodiments of this application pre-assign unique identification information to each data block, so as to determine the data blocks that need to be retransmitted according to the identification information, thereby improving the accuracy of file transmission.

[0020] Optionally, after transmitting all the data blocks using a hybrid TCP and UDP protocol transmission method according to the aforementioned protocol hybridization strategy, the method further includes: If a retransmission instruction is received from the receiving end, the identification information in the retransmission instruction is identified. The target data block to be retransmitted is determined based on the identification information, and the target data block is transmitted using the TCP protocol; The retransmission instruction is generated by the receiving end when it detects packet loss and / or data errors based on the metadata and the verification information.

[0021] Based on the above technical means, in order to ensure the accuracy and integrity of the data, this application embodiment retransmits lost or damaged data blocks through the TCP protocol, making full use of the advantages of the two protocols and solving the shortcomings of traditional single use of TCP or UDP protocols in the file transfer process.

[0022] A second aspect of this application provides a file transfer device based on a protocol hybrid strategy, characterized in that it includes: The segmentation calculation module is used to segment the file to be transmitted into data blocks and calculate the verification information of each data block; The first transmission module is used to transmit the metadata of the file to be transmitted and the verification information of each data block using the TCP protocol; The strategy determination module is used to acquire current network information and determine a protocol mixing strategy based on the current network information. The second transmission module is used to transmit all the data blocks in accordance with the protocol mixing strategy, using a mixed transmission method of TCP and UDP protocols. The message receiving module is used to complete the transmission of the file to be transmitted when it receives a confirmation message from the receiving end. The confirmation message is generated by the receiving end after verifying the integrity of all the data blocks based on the metadata and the verification information.

[0023] A third aspect of this application provides a terminal device, the terminal device including a memory, a processor, and a file transfer program based on a protocol hybrid strategy stored in the memory and executable on the processor. When the processor executes the file transfer program based on the protocol hybrid strategy, it implements the steps of the file transfer method based on the protocol hybrid strategy as described above.

[0024] A fourth aspect of this application provides a computer-readable storage medium storing a file transfer program based on a protocol hybrid strategy. When the file transfer program based on the protocol hybrid strategy is executed by a processor, it implements the steps of the file transfer method based on the protocol hybrid strategy as described above.

[0025] The beneficial effects of this application are: (1) This application combines the advantages of TCP and UDP protocols, achieving the effect of balancing the accuracy and efficiency of file transmission.

[0026] (2) This application normalizes each network indicator to ensure that the values ​​of different indicators are comparable, and then calculates the usage ratio between TCP and UDP protocols so as to carry out mixed transmission according to the usage ratio, thereby achieving both the accuracy and efficiency of file transmission.

[0027] (3) In order to ensure the accuracy and integrity of data, this application retransmits lost or damaged data blocks through the TCP protocol, making full use of the advantages of the two protocols and solving the shortcomings of traditional single use of TCP or UDP protocols in the file transfer process.

[0028] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0029] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart illustrating a file transfer method based on a protocol hybrid strategy provided in this application embodiment; Figure 2 This is a flowchart illustrating a specific embodiment of the present application; Figure 3 This is a schematic diagram of the structure of a file transfer device based on a protocol hybrid strategy according to an embodiment of this application; Figure 4 This is a block diagram illustrating the internal structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0030] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0031] The following describes a file transfer method and apparatus based on a protocol hybrid strategy according to embodiments of this application, with reference to the accompanying drawings. Addressing the problem mentioned in the background art that the UDP protocol cannot simultaneously ensure both accuracy and efficiency in file transfer, this application provides a file transfer method based on a protocol hybrid strategy. In this method, the file to be transferred is divided into data blocks, and verification information for each data block is calculated. The metadata of the file to be transferred and the verification information for each data block are transmitted using the TCP protocol. Current network information is obtained, and a protocol hybrid strategy is determined based on this information. All data blocks are transmitted using a hybrid transmission method combining TCP and UDP protocols according to the protocol hybrid strategy. When an acknowledgment message is received from the receiving end, the file transfer is completed. The acknowledgment message is generated by the receiving end after verifying the integrity of all data blocks based on the metadata and verification information. This application combines the advantages of both TCP and UDP protocols, achieving a balance between accuracy and efficiency in file transfer.

[0032] Specifically, Figure 1 This is a schematic flowchart of a file transfer method based on a protocol hybrid strategy provided in an embodiment of this application.

[0033] like Figure 1 As shown, the file transfer method based on a protocol hybrid strategy includes the following steps: In step S101, the file to be transmitted is divided into data blocks, and the verification information for each data block is calculated.

[0034] In this embodiment, the file sender divides the file to be transmitted into fixed-size data blocks, for example, into 50MB blocks. The sender calculates checksum information for each data block so that the file receiver can determine whether the received data is erroneous based on the checksum information.

[0035] In step S102, the metadata of the file to be transmitted and the verification information of each data block are transmitted using the TCP protocol.

[0036] This application uses the TCP protocol to transmit file metadata and verification information for each data block. The TCP protocol can provide reliable data transmission and flow control mechanisms, ensuring the accuracy and order of critical data.

[0037] In one embodiment, the metadata includes: the file size, file name, file path, and total number of data blocks of the file to be transmitted; the verification information is the MD5 value. The file size, file name, file path, total number of data blocks, and MD5 value are all key data of the file to be transmitted. The TCP protocol can provide reliable data transmission, thereby improving the reliability of file transmission.

[0038] In step S103, current network information is obtained, and a protocol mixing strategy is determined based on the current network information.

[0039] This application combines the TCP and UDP protocols, adaptively selecting different transmission protocols to transmit files based on the current network environment. This combines the advantages of both TCP and UDP protocols, thereby achieving a balance between the accuracy and efficiency of file transmission.

[0040] In this embodiment of the application, step S103 includes: obtaining each network indicator corresponding to the current network, normalizing each network indicator to obtain the normalization result corresponding to each network indicator; calculating the comprehensive value based on the normalization result; calculating the usage ratio between TCP protocol and UDP protocol based on the comprehensive value, and using the usage ratio as the protocol mixing strategy.

[0041] In this embodiment, the sending end monitors various network indicators to obtain current network information, thereby dynamically adjusting the protocol mixing strategy. Each network indicator is normalized to 0 to 1 to ensure that the values ​​of different indicators are comparable. Then, the usage ratio between TCP and UDP protocols is calculated so that mixed transmission can be performed according to the usage ratio, thereby achieving a balance between the accuracy and efficiency of file transmission.

[0042] In one embodiment, calculating the comprehensive value based on the normalization result includes: obtaining the pre-set weight values ​​corresponding to each network indicator; and weighting the normalization results of each network indicator according to the weight values ​​corresponding to each network indicator to obtain the comprehensive value.

[0043] This application embodiment quantifies network information by weighted summation of various normalization results, thereby calculating the usage ratio between TCP and UDP protocols and forming a protocol hybrid strategy.

[0044] In one embodiment, this application uses three network metrics: network latency, network packet loss rate, and bandwidth utilization. Network latency refers to the delay time of the network, network packet loss rate refers to the proportion of data packets lost, and bandwidth utilization refers to the degree of network bandwidth usage. This application normalizes network latency, network packet loss rate, and bandwidth utilization, and then calculates a comprehensive value and the usage ratio between TCP and UDP protocols.

[0045] Specifically, the system obtains the first weight corresponding to the pre-set network latency, the second weight corresponding to the network packet loss rate, and the third weight corresponding to the bandwidth utilization rate; it then performs a weighted summation of the normalized network latency, normalized network packet loss rate, and normalized bandwidth utilization rate based on the first, second, and third weights to obtain a comprehensive value; finally, it calculates the usage ratio of TCP and UDP protocols based on the comprehensive value and uses the usage ratio as the protocol mixing strategy.

[0046] In this embodiment, weights are set for each network metric. The normalized network metrics are multiplied by their corresponding weights and then summed to obtain a composite value, which ranges from 0 to 1. The formula for calculating the composite value is: .

[0047] The usage ratio of TCP and UDP protocols is TCP:UDP = Total value: (1 - Total value).

[0048] In step S104, all data blocks are transmitted using a hybrid TCP and UDP protocol transmission method, in accordance with the protocol hybridization strategy.

[0049] In one embodiment of this application, step S104 specifically includes: obtaining a first number of data blocks transmitted using the TCP protocol and a second number of data blocks transmitted using the UDP protocol according to the usage ratio, wherein the sum of the first number and the second number equals the total number of data blocks; transmitting the first number of data blocks using the TCP protocol and transmitting the second number of data blocks using the UDP protocol. This embodiment of the application determines the number of data blocks transmitted using the TCP protocol (the first number) and the number of data blocks transmitted using the UDP protocol (the second number) based on the usage ratio between the TCP and UDP protocols. Specifically, for example, if the total number of data blocks is 500 and the usage ratio between the TCP and UDP protocols is 1:4, then the number of data blocks transmitted using the TCP protocol is 100, and the number of data blocks transmitted using the UDP protocol is 400. During transmission, 100 data blocks are transmitted using the TCP protocol and 400 data blocks are transmitted using the UDP protocol to achieve the best transmission effect.

[0050] The hybrid strategy based on TCP and UDP protocols in this application overcomes the problems of low transmission efficiency and high transmission latency of the traditional TCP protocol. Furthermore, compared with the UDP protocol, it ensures the integrity and reliability of files. Therefore, the hybrid protocol strategy in this application achieves a faster, more stable and efficient file transfer process, which is suitable for various file upload scenarios, such as cloud storage and large file transfer.

[0051] In step S105, when an acknowledgment message is received from the receiving end, the transmission of the file to be transmitted is completed. The acknowledgment message is generated by the receiving end after verifying the integrity of all data blocks based on metadata and verification information.

[0052] This application embodiment establishes an integrity verification and confirmation mechanism. After receiving all data blocks, the receiving end can perform integrity verification, such as through checksums, hash values, or digital signatures. The receiving end sends a confirmation message to the sending end to indicate successful upload and to ensure the integrity and correctness of the file.

[0053] In one embodiment of this application, step S101 further includes: assigning unique identification information to each data block. When the receiving end of the file receives a data block and detects data errors or packet loss, it determines the identification information of the data error or packet loss, and determines the data blocks that need to be retransmitted based on the identification information, so as to improve the accuracy of file transmission.

[0054] In one embodiment of this application, after step S104, the method further includes: if a retransmission instruction is received from the receiving end, identifying the identification information in the retransmission instruction; determining the target data block to be retransmitted based on the identification information, and transmitting the target data block using the TCP protocol; wherein, the retransmission instruction is generated by the receiving end when it detects packet loss and / or data errors based on metadata and verification information.

[0055] This embodiment of the application, after receiving all data blocks sent by the sender, uses metadata and verification information uploaded via the TCP protocol to detect packet loss or data errors, and responds with identification information to the sender. For lost or corrupted data blocks, retransmission is performed via the TCP protocol to ensure data accuracy and integrity, fully utilizing the advantages of both protocols and solving the shortcomings of traditionally using TCP or UDP protocols alone in file transfer.

[0056] In one embodiment, a specific file transfer flowchart is shown below. Figure 2 As shown.

[0057] Step A1: The file is divided into data blocks, and a unique identifier is assigned to each data block; Step A2: Transmit the metadata and verification information via TCP protocol, and then proceed to step A7; Step A3: Dynamically adjust the protocol mixing strategy; Step A4: Transmit data blocks according to the protocol hybrid strategy of TCP / UDP protocol; Step A5: Determine if retransmission is needed; if yes, proceed to step A6; if no, proceed to step A7. Step A6: Retransmit the data block via TCP protocol; Step A7: The receiving end receives the file; Step A8: The receiving end determines whether the integrity check has passed; if yes, the process ends; otherwise, it returns to step A4.

[0058] Next, with reference to the accompanying drawings, a file transfer apparatus based on a protocol hybrid strategy proposed according to an embodiment of this application is described.

[0059] like Figure 3 As shown, the file transfer device 10 based on a protocol hybrid strategy includes: The segmentation calculation module 100 is used to segment the file to be transmitted into data blocks and calculate the verification information of each data block; The first transmission module 200 is used to transmit the metadata of the file to be transmitted and the verification information of each data block using the TCP protocol; The strategy determination module 300 is used to obtain current network information and determine the protocol mixing strategy based on the current network information. The second transmission module 400 is used to transmit all data blocks in accordance with a protocol mixing strategy, using a mixed transmission method of TCP and UDP protocols. The message receiving module 500 is used to complete the transmission of the file to be transmitted when it receives an acknowledgment message from the receiving end. The acknowledgment message is generated by the receiving end after verifying the integrity of all data blocks based on metadata and verification information.

[0060] Optionally, the metadata includes: the file size, file name, file path, and total number of data blocks of the file to be transferred, and the verification information is the MD5 value.

[0061] Optionally, the strategy determination module includes: The normalization unit is used to obtain the network indicators corresponding to the current network, and perform normalization processing on each network indicator to obtain the normalization result corresponding to each network indicator. The composite value calculation unit is used to calculate the composite value based on the normalization result. The ratio calculation unit is used to calculate the usage ratio between TCP and UDP protocols based on the comprehensive value, and uses the usage ratio as a protocol mixing strategy.

[0062] Optionally, the composite value calculation unit includes: The weight value acquisition sub-unit is used to obtain the pre-set weight values ​​corresponding to each network indicator. The weighted sub-unit is used to weight the normalized results of each network indicator according to the weight value corresponding to each network indicator, so as to obtain a comprehensive value.

[0063] Optionally, network metrics include: network latency, network packet loss rate, and bandwidth utilization.

[0064] Optionally, the second transmission module includes: The quantity calculation unit is used to obtain a first quantity transmitted using the TCP protocol and a second quantity transmitted using the UDP protocol according to the usage ratio. The sum of the first quantity and the second quantity is equal to the total number of data blocks. The data transmission unit is used to transmit a first number of data blocks using the TCP protocol and to transmit a second number of data blocks using the UDP protocol.

[0065] Optionally, the segmentation calculation module also includes an allocation unit for assigning unique identification information to each data block.

[0066] Optionally, the file transfer device further includes: The identification module is used to identify the identification information in the retransmission instruction if a retransmission instruction is received from the receiving end. The retransmission module is used to determine the target data block to be retransmitted based on the identification information and to transmit the target data block using the TCP protocol. The retransmission instruction is generated by the receiving end when it detects packet loss and / or data errors based on metadata and verification information.

[0067] It should be noted that the foregoing explanation of the file transfer method embodiment based on the protocol hybrid strategy also applies to the file transfer device based on the protocol hybrid strategy in this embodiment, and will not be repeated here.

[0068] According to the file transfer device based on the protocol hybrid strategy proposed in the embodiments of this application, this application divides the file to be transferred into data blocks and calculates the verification information of each data block; it uses the TCP protocol to transmit the metadata of the file to be transferred and the verification information of each data block; it obtains the current network information and determines the protocol hybrid strategy based on the current network information; it transmits all data blocks in a hybrid transmission mode using TCP and UDP protocols according to the protocol hybrid strategy; when an acknowledgment message is received from the receiving end, the file transfer is completed. The acknowledgment message is generated by the receiving end after verifying the integrity of all data blocks based on the metadata and verification information. The embodiments of this application combine the advantages of TCP and UDP protocols, achieving the effect of balancing the accuracy and efficiency of file transfer.

[0069] Figure 4 A schematic diagram of the structure of a terminal device provided in an embodiment of this application. The terminal device may include: The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.

[0070] When the processor 502 executes the program, it implements the file transfer method based on the protocol hybrid strategy provided in the above embodiments.

[0071] Furthermore, the terminal equipment also includes: Communication interface 503 is used for communication between memory 501 and processor 502.

[0072] The memory 501 is used to store computer programs that can run on the processor 502.

[0073] The memory 501 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0074] If the memory 501, processor 502, and communication interface 503 are implemented independently, then the communication interface 503, memory 501, and processor 502 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 4 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0075] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.

[0076] Processor 502 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0077] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the file transfer method based on a protocol hybrid strategy as described above.

[0078] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0079] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0080] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0081] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can read and execute instructions from or in conjunction with such an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). In addition, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically by optically scanning paper or other media, then editing, interpreting or otherwise processing them as necessary, and then storing them in computer memory.

[0082] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0083] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware, and the program can be stored in a computer-readable storage medium. When executed, the program includes one or a combination of the steps of the method embodiments.

[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0085] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. A file transfer method based on a protocol hybrid strategy, characterized in that, Includes the following steps: The file to be transmitted is divided into data blocks, and the verification information of each data block is calculated; The metadata of the file to be transmitted and the verification information of each data block are transmitted using the TCP protocol. Obtain current network information and determine a protocol mixing strategy based on the current network information; According to the aforementioned protocol hybrid strategy, all data blocks are transmitted using a hybrid transmission method that combines TCP and UDP protocols. When a confirmation message is received from the receiving end, the transmission of the file to be transmitted is completed. The confirmation message is generated by the receiving end after verifying the integrity of all the data blocks based on the metadata and the verification information. The step of obtaining current network information and determining a protocol hybridization strategy based on the current network information includes: Obtain each network metric corresponding to the current network, and perform normalization processing on each network metric to obtain the normalization result corresponding to each network metric; Calculate the comprehensive value based on the normalization result; The usage ratio between TCP and UDP protocols is calculated based on the comprehensive value, and the usage ratio is used as the protocol mixing strategy. According to the aforementioned protocol hybrid strategy, all data blocks are transmitted using a hybrid transmission method combining TCP and UDP protocols, including: The first number of data blocks transmitted using the TCP protocol and the second number of data blocks transmitted using the UDP protocol are obtained according to the usage ratio, and the sum of the first number and the second number is equal to the total number of data blocks. The first number of data blocks will be transmitted using the TCP protocol, and the second number of data blocks will be transmitted using the UDP protocol. The step of dividing the file to be transmitted into data blocks and calculating the verification information for each data block further includes: Assign a unique identifier to each of the data blocks; After transmitting all the data blocks according to the protocol hybrid strategy using a hybrid transmission method of TCP and UDP protocols, the process further includes: If a retransmission instruction is received from the receiving end, the identification information in the retransmission instruction is identified. The target data block to be retransmitted is determined based on the identification information, and the target data block is transmitted using the TCP protocol; The retransmission instruction is generated by the receiving end when it detects packet loss and / or data errors based on the metadata and the verification information. Each network metric is normalized to a value between 0 and 1. Weights are assigned to each network metric. The normalized network metrics are multiplied by their corresponding weights and then summed to obtain a composite value. The composite value ranges from 0 to 1. The ratio of TCP to UDP protocols is TCP:UDP = Composite value: (1 - Composite value).

2. The file transfer method based on a protocol hybrid strategy as described in claim 1, characterized in that, The metadata includes: the file size, file name, file path, and total number of data blocks of the file to be transmitted, and the verification information is the MD5 value.

3. The file transfer method based on a protocol hybrid strategy as described in claim 1, characterized in that, The network metrics include: network latency, network packet loss rate, and bandwidth utilization.

4. A file transfer device based on a protocol hybrid strategy, characterized in that, include: The segmentation calculation module is used to segment the file to be transmitted into data blocks and calculate the verification information of each data block; The first transmission module is used to transmit the metadata of the file to be transmitted and the verification information of each data block using the TCP protocol; The strategy determination module is used to acquire current network information and determine a protocol mixing strategy based on the current network information. The second transmission module is used to transmit all the data blocks in accordance with the protocol mixing strategy, using a mixed transmission method of TCP and UDP protocols. The message receiving module is used to complete the transmission of the file to be transmitted when it receives a confirmation message from the receiving end. The confirmation message is generated by the receiving end after verifying the integrity of all the data blocks based on the metadata and the verification information. The step of obtaining current network information and determining a protocol mixing strategy based on the current network information includes: obtaining various network indicators corresponding to the current network, performing normalization processing on each network indicator to obtain a normalization result corresponding to each network indicator; calculating a comprehensive value based on the normalization result; calculating the usage ratio between TCP and UDP protocols based on the comprehensive value, and using the usage ratio as the protocol mixing strategy. According to the protocol hybrid strategy, all the data blocks are transmitted using a hybrid transmission method of TCP and UDP protocols, including: obtaining a first number of data blocks to be transmitted using TCP and a second number of data blocks to be transmitted using UDP protocols according to the usage ratio, wherein the sum of the first number and the second number equals the total number of data blocks; transmitting the first number of data blocks using TCP protocols and transmitting the second number of data blocks using UDP protocols. Assign a unique identifier to each of the data blocks; If a retransmission instruction is received from the receiving end, the identification information in the retransmission instruction is identified; the target data block to be retransmitted is determined according to the identification information, and the target data block is transmitted using the TCP protocol; wherein, the retransmission instruction is generated by the receiving end when packet loss and / or data errors are detected based on the metadata and the verification information; Each network metric is normalized to a value between 0 and 1. Weights are assigned to each network metric. The normalized network metrics are multiplied by their corresponding weights and then summed to obtain a composite value. The composite value ranges from 0 to 1. The ratio of TCP to UDP protocols is TCP:UDP = Composite value: (1 - Composite value).

5. A terminal device, characterized in that, The terminal device includes a memory, a processor, and a file transfer program based on a protocol hybrid strategy stored in the memory and executable on the processor. When the processor executes the file transfer program based on the protocol hybrid strategy, it implements the steps of the file transfer method based on the protocol hybrid strategy as described in any one of claims 1-3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a file transfer program based on a protocol hybrid strategy. When the file transfer program based on the protocol hybrid strategy is executed by a processor, it implements the steps of the file transfer method based on a protocol hybrid strategy as described in any one of claims 1-3.