File transmission method and device, storage medium and equipment
By generating and transmitting file compressed packages sequentially, the problem of numerous repetitive steps and long processing times during file transfer between Android phones and computers is solved, achieving fast file transfer and efficient processing.
Patent Information
- Application Number
- CN202410734979.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-11-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
File transfer between Android phones and computers involves many repetitive steps and is time-consuming, especially when transferring multiple files.
The method of sequentially generating and transmitting file compressed packages is adopted. Each file compressed package is generated by packaging and compressing several files to be transmitted when the total data volume reaches a first threshold. When the Nth file compressed package is generated, the N-1th file compressed package is transmitted to the second device. The first threshold is dynamically adjusted to coordinate the compression and transmission process.
It enables fast file transfer between Android phones and computers, reduces loop operations, improves processing and read/write efficiency, and shortens the overall transfer time.
Smart Images

Figure CN118921361A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a file transmission method, device, storage medium and equipment. Background Art
[0002] Communication between Android phones and computers usually uses the Android Debug Bridge. File transfer through the network interface requires multiple processes such as establishing communication, creating files, transferring file attributes, transferring files, writing files, and closing communications. When there are multiple files to be transferred, the above-mentioned cycle operations need to be repeated a large number of times, and multiple processes are involved in reading and writing memory at the same time, resulting in slow processing speed and the entire process is very time-consuming. Summary of the invention
[0003] The embodiments of the present application provide a file transmission method, apparatus, storage medium and device, which are used to solve the technical problems that the existing file transmission process between Android mobile phones and computers has many repetitive steps and is time-consuming.
[0004] In one aspect of the present application, a file transmission method is provided, which is applied to a first device and is used to transmit a file from the first device to a second device; the method includes:
[0005] Sequentially generate file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold;
[0006] The file compression packages are transmitted sequentially; wherein, when the packing and compression start to generate the Nth file compression package, the N-1th file compression package is transmitted to the second device.
[0007] Furthermore, each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold, including:
[0008] Reading a plurality of files to be transmitted and writing them into the first storage space;
[0009] When the total data volume of the plurality of files to be transmitted reaches a first threshold, the plurality of files to be transmitted in the first storage space are packaged and compressed and then written into the second storage space to generate a file compression package.
[0010] Furthermore, the sequential generation of the file compression package includes:
[0011] After the plurality of first files to be transmitted are packaged, compressed and written into the second storage space, a plurality of second files to be transmitted are read and written into the first storage space;
[0012] A plurality of second files to be transmitted in the first storage space are packaged, compressed, and written into the second storage space to generate a file compression package.
[0013] Furthermore, the sequential transmission of the file compression packages includes:
[0014] After the N-1th file compression package is transmitted, the Nth file compression package is transmitted.
[0015] Furthermore, after the N-1th file compression package is transmitted and before the Nth file compression package is transmitted, the method further includes:
[0016] Delete the N-1th file compression package from the second storage space in the first device.
[0017] Further, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device, including:
[0018] When the total data volume of the plurality of files to be transmitted reaches a first threshold, generating a trigger signal;
[0019] In response to the trigger signal, start packaging and compressing to generate the Nth file compression package;
[0020] In response to the trigger signal, start transmitting the N-1th file compression package to the second device.
[0021] Furthermore, when the packing and compression start to generate the Nth file compression package, the N-1th file compression package starts to be transmitted to the second device, and then includes:
[0022] The time taken to generate the Nth compressed package of the file by counting the packaging and compression is taken as the first time;
[0023] The time from when the N-1th compressed file package is transmitted to the second device until when the N-1th compressed file package is deleted from the first device is counted as a second time;
[0024] Determine whether the difference between the first time and the second time is less than a second threshold. If so, wait for the trigger signal. Otherwise, if the first time is less than the second time, increase the first threshold. If the first time is less than the second time, reduce the first threshold.
[0025] A second aspect of the present application provides a file transmission device, comprising:
[0026] A generation module, used for sequentially generating file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold;
[0027] A transmission module is used to sequentially transmit the file compression packages; wherein, when the packaging and compression start to generate the Nth file compression package, the N-1th file compression package starts to be transmitted to the second device.
[0028] The third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the first aspect of the present application.
[0029] The fourth aspect of the present application provides a computer-readable storage medium, which is used to store a computer program. When the computer program runs on a computer, the computer executes the method described in the first aspect of the present application.
[0030] According to a fifth aspect of the present application, a computer program product is provided. When the computer program product is run on an electronic device, the electronic device executes the method described in the first aspect of the present application.
[0031] In an embodiment of the present application, a file transmission method is adopted and applied to the first device, for transmitting files from the first device to the second device, and sequentially generating file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold; sequentially transmitting the file compression packages; wherein, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device. The present application solves the technical problem that the existing file transfer process between Android phones and computers has many repeated steps and is time-consuming, thereby achieving the effect of fast transmission of a large number of files between Android phones and computers. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0033] Figure 1 It is a flowchart of a file transmission method according to an embodiment of the present application.
[0034] Figure 2 It is a schematic diagram of a parallel flow of two processes of a file transmission method according to an embodiment of the present application;
[0035] Figure 3 is a schematic diagram of the structure of a file transmission device according to an embodiment of the present application;
[0036] Figure 4 It is a schematic diagram of the hardware composition structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0037] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0038] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0039] An embodiment of the present invention provides a file transmission method for transmitting multiple small files. In order to shorten the time-consuming disadvantage of the traditional method that a large number of loop operations are required to be performed on multiple files, this embodiment proposes a method of cyclically reading and compressing in blocks, each of which includes a number of files to be transmitted, that is, the block is a file set, and the compressed file set is transmitted to the target object in time, thus reducing the loop operation and shortening the overall time; in order to further improve the processing efficiency of the memory, this embodiment proposes transmitting the compressed package corresponding to the previous file set while compressing and packaging the next file set, and through dynamic adjustment, the above two parallel processes are started at the same time and ended at the same time as much as possible, thus ensuring that only one process is reading and writing files at the same time, thereby greatly improving the reading and writing efficiency, so that a faster processing speed is obtained when the memory remains unchanged, thereby further shortening the overall time.
[0040] like Figure 1 FIG. 1 is a flow chart of an embodiment of the present invention. The embodiment provides a file transmission method, which is applied to a first device. The first device has a plurality of small files to be transmitted. The transmission method is used to transmit the small files from the first device to a second device. Figure 1 It can be seen that the file transmission method includes:
[0041] Step S102, sequentially generate file compression packages; wherein each file compression package is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold. If there are many small files to be transmitted, packaging and combining a number of small files for transmission can reduce the number of transmissions, thereby reducing the interaction between the first device and the second device and improving processing efficiency.
[0042] Step S104, sequentially transmitting the file compression packages; wherein, when the Nth file compression package is generated by packing and compressing, the N-1th file compression package is transmitted to the second device. Each compression package needs to go through the process of reading and writing small files, compression and writing of compression packages before transmission. Therefore, when the Nth file compression package is generated by packing and compressing, the N-1th file compression package is transmitted to the second device, so that only a single process can read and write files in the same time period to the maximum extent.
[0043] In some embodiments, the first device is an electronic device such as a handheld mobile communication device or a tablet computer that stores a number of small files as evidence, and the second device is an electronic device used to copy the small files in the first device to the second device for evidence storage. The second device usually has a much greater computing power than the first device, and the second device is preferably a computer.
[0044] In some preferred embodiments, each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold, including:
[0045] Reading a plurality of files to be transmitted and writing them into the first storage space;
[0046] When the total data volume of the plurality of files to be transmitted reaches a first threshold, the plurality of files to be transmitted in the first storage space are packaged and compressed and then written into the second storage space to generate a file compression package.
[0047] Memory is a device or component used to store large amounts of information in digital systems. It is an important component of computers and digital devices. Memory can be divided into two categories: random access memory (RAM) and read-only memory (ROM).
[0048] Among them, random access memory (RAM) is an internal memory that directly exchanges data with the CPU. It can store information in a specified unit and read information from a specified unit. It can be read and written at any time, and the speed is very fast. It is usually used as a temporary data storage medium for operating systems or other running programs. When RAM is working, it can write (store) or read (retrieve) information from any specified address at any time.
[0049] ROM is a read-only memory. The stored data is stable and will not change after power failure. It has a simple structure and is easy to use. Therefore, it is often used to store various fixed programs and data. In addition to fixed storage of data, tables, and solidified programs, it is also widely used in combinational logic circuits.
[0050] Therefore, in some optional embodiments, the first storage space is located in the RAM memory for caching data, and the second storage space is located in the ROM memory for storing files.
[0051] The size of the first threshold is related to the time required to read the file to reach the first threshold, the time required to compress the file set corresponding to the threshold into a compressed package, the time required to write the compressed package into the second storage space, and the time required to transmit the compressed package. Therefore, in order to coordinate the compression and transmission processes to be carried out simultaneously, the above-mentioned first threshold must make the time required for compression and transmission basically the same. Since the above-mentioned process mainly involves the first device and partially involves the second device, the time consumption of each of the above-mentioned processes is mainly related to the hardware performance, resource utilization, etc. of the first device, and is also related to the transmission efficiency between the first device and the second device. As the first device and / or the second device each or between the devices has a configuration or method that is conducive to shortening the entire file transmission time, the first threshold can be appropriately increased.
[0052] In the implementation of the present invention, the initial value of the first threshold is defined as 200M. That is, in the process of reading a number of files to be transmitted and writing them into the first storage space, the cumulative file size of the files read in the current round is counted in real time, and the file set under the current round is formed with the first threshold as the limit, and the file set in the first storage space is compressed. In the embodiment of the present invention, the generated first file set is limited to 200M. With the subsequent dynamic adjustment, the first threshold changes, and the size of the subsequent file set changes accordingly.
[0053] In some optional embodiments, the reading of the plurality of files to be transmitted and writing the files into the first storage space includes:
[0054] The first storage space is written in an appending manner. The appending manner is a manner of continuing to write new content at the end of the original content in the storage space.
[0055] In some preferred embodiments, the sequential generation of the file compression package includes:
[0056] After the plurality of first files to be transmitted are packaged, compressed and written into the second storage space, a plurality of second files to be transmitted are read and written into the first storage space;
[0057] A plurality of second files to be transmitted in the first storage space are packaged, compressed, and written into the second storage space to generate a file compression package.
[0058] In some optional embodiments, the second files to be transmitted are all different from the first files to be transmitted, that is, each file to be transmitted only needs to go through a complete reading, compression and transmission process once, so in some embodiments, optionally, the files that have been read and formed into corresponding compressed packages are marked, and the next round continues to read from the unmarked files.
[0059] In some preferred embodiments, the sequential transmission of the file compression packages includes:
[0060] After the N-1th file compression package is transmitted, the Nth file compression package is transmitted.
[0061] Optionally, in some embodiments, the order of the compressed packets is marked by the time sequence of their generation, and the compressed packets are transmitted one by one in the above order.
[0062] In some preferred embodiments, in order to release storage space in time, after the N-1th file compression package is transmitted and before the Nth file compression package is transmitted, the method further includes:
[0063] Delete the N-1th file compression package from the second storage space in the first device.
[0064] In some preferred embodiments, in order to synchronize the compression process and the transmission process, when the Nth file compression package is generated by starting to pack and compress, the N-1th file compression package is started to be transmitted to the second device, including:
[0065] When the total data volume of the plurality of files to be transmitted reaches a first threshold, generating a trigger signal;
[0066] In response to the trigger signal, start packaging and compressing to generate the Nth file compression package;
[0067] In response to the trigger signal, start transmitting the N-1th file compression package to the second device.
[0068] That is, both the compression process and the transmission process are related to the trigger signal, and the two processes are triggered to proceed synchronously.
[0069] In some preferred embodiments, in order to coordinate the compression process and the transmission process to end synchronously, when the Nth file compression package is generated by starting to pack and compress, the N-1th file compression package is started to be transmitted to the second device, and then the method includes:
[0070] The time taken to generate the Nth compressed package of the file by counting the packaging and compression is taken as the first time;
[0071] The time from when the N-1th compressed file package is transmitted to the second device until when the N-1th compressed file package is deleted from the first device is counted as a second time;
[0072] Determine whether the difference between the first time and the second time is less than a second threshold. If so, wait for the trigger signal. Otherwise, if the first time is less than the second time, increase the first threshold. If the first time is less than the second time, reduce the first threshold.
[0073] The process corresponding to the first time is defined as a compression process, and the process corresponding to the second time is defined as a transmission and deletion process. The second threshold is used to define the difference between the first time and the second time. In some embodiments, the second threshold is defined as 5% of the larger of the first time and the second time. If the difference is less than the second threshold, it indicates that the first time and the second time are equivalent, and the end time of the compression process and the transmission process is also equivalent when they start at the same time. After the compression process ends, the process of writing compressed files is directly entered, and after the transmission and deletion process ends, the next trigger signal is waited for to trigger the next transmission and deletion process. Since the duration of the compression process and the transmission and deletion process is proportional to the size of the compressed package, and the compression process is more affected by the size of the compressed package than the transmission and deletion process, the time of the two processes is coordinated by adjusting the size of the first threshold in real time to shorten the time difference between the first time and the second time. When the first time is less than the second time, it indicates that the compression process is faster and the transmission and deletion process is slower. At this time, more files can be added for compression together. Through such operation, the compression process time becomes longer and the transmission and deletion process time also becomes longer, but the degree of the compression process time lengthening is greater than the degree of the transmission and deletion process time lengthening, so that the difference between the first time and the second time can be reduced. When the first time is greater than the second time, it indicates that the compression process is slower and the transmission and deletion process is faster. At this time, some files can be reduced for compression. Through such operation, the compression process time becomes shorter and the transmission and deletion process time also becomes shorter. However, the degree of shortening of the compression process time will be greater than the degree of shortening of the transmission and deletion process time, thereby reducing the difference between the first time and the second time.
[0074] In the above-mentioned embodiment of the present invention, the sequential generation of the file compression package is realized by the first process, and the sequential transmission of the file compression package is realized by the second process. When the present invention is implemented, the two processes are started at the same time, and the cooperation between the two processes is realized through trigger conditions and adjustment strategies to achieve synchronous operation.
[0075] Therefore, a file transmission method according to an embodiment of the present application is as follows:
[0076] including a first process and a second process started synchronously;
[0077] The first process is used to sequentially generate file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold;
[0078] The second process is used to sequentially transmit the file compression packages; wherein, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device;
[0079] Wherein, when the Nth file compression package is generated by starting to pack and compress, the N-1th file compression package is started to be transmitted to the second device, including: when the total data volume of the plurality of files to be transmitted reaches a first threshold, a trigger signal is generated;
[0080] The first process starts packaging and compressing to generate the Nth file compression package in response to the trigger signal;
[0081] The second process starts transmitting the N-1th file compression package to the second device in response to the trigger signal; after the N-1th file compression package is transmitted, the N-1th file compression package is deleted from the first device;
[0082] Among them, when the packaging and compression starts to generate the Nth file compression package, after the N-1th file compression package is transmitted to the second device, it includes: counting the duration of packaging and compression to generate the Nth file compression package as the first time; counting the duration of transmitting the N-1th file compression package to the second device until the N-1th file compression package is deleted from the first device as the second time; the second process determines whether the difference between the first time and the second time is less than a second threshold, if so, waits for the trigger signal, otherwise if the first time is less than the second time, increases the size of the first threshold, if the first time is less than the second time, reduces the size of the first threshold, and then waits for the trigger signal.
[0083] like Figure 2This is an embodiment of the present application, which shows the process of generating and transmitting the first file compression package A and the second file compression package B according to the method of the above embodiment of the present application. In the figure, process one (i.e., the first process in the above embodiment) is responsible for reading files, writing into the first storage space, judging whether the total data volume reaches the first threshold, compressing small files, and writing into the second storage space to form a file compression package. Process two (i.e., the second process in the above embodiment) in the figure is responsible for transmitting the file compression package and deleting the file compression package from the second storage space after the transmission, and judging how to adjust the size of the first threshold according to the judgment condition.
[0084] Next, the above process 1 and process 2 are introduced in chronological order. In the figure, both processes are divided into 5 time periods by dotted lines, and the steps corresponding to the left and right positions in the same time period in the two processes occur in the same time period. Figure 2 As shown, in this embodiment, two processes start synchronously:
[0085] Process 1 first reads the file and writes it into the BufferA space in the RAM in an appended manner, and determines in real time whether the file size in the BufferA space is greater than X, where X is the first threshold, and the initial value is 200M. If it has not reached X, it continues to write to the RAM until it reaches greater than X, and then generates a trigger signal A, and then starts to compress the small files in BufferA, with a total time of T1; then writes the FileA file compression package into the second storage space in the ROM;
[0086] After that, process one continues to execute the above process, that is, for this embodiment, it continues to read the file and writes it to the BufferB space in the RAM in an appended manner, and judges in real time whether the file size in the BufferB space is greater than Y, where Y is the first threshold and the initial value is 200M. If it has not reached Y, it continues to write to the RAM until it reaches greater than Y, and then generates a trigger signal B, and then starts to compress the small files in BufferB. The total time is T3, and then the FileB file compression package is written to the second storage space in the ROM, and then the reading of subsequent files continues.
[0087] Process 2 first executes waiting for trigger signal A. Since process 2 is started synchronously with process 1, trigger signal A is not generated at the beginning of process 2. Process 2 is in waiting state when it is just started until process 1 runs to generate trigger signal A. Thereafter, process 2 executes transmission of FileB and deletion of FileB. However, since process 1 has not generated FileB at this time, this step is directly skipped when process 2 is first executed, and T2=0, so it runs to waiting for trigger signal B until process 1 runs to generate trigger signal B, then starts to transmit FileA and then deletes FileA, with a total time of T4. At this time, corresponding process 1 is synchronously executing compression of BufferB, with a total time of T3, and then compares whether the difference between T3 and T4 is less than the second threshold. In this embodiment, the second threshold is 5% of the larger one of T3 and T4. If not, the size of the first threshold corresponding to the file compression package corresponding to T3 in process 1 is further adjusted according to the size of T3 and T4, that is, the size of Y. Otherwise, wait for the next trigger signal. The next trigger signal is generated by process 1 completing the writing of the FileB file compression package and performing a new round of file reading and appending to RAM until the size meets the requirement. Figure 2 When trigger signal A appears above the first dotted line on the right side of the process, FileB starts to be transferred and deleted, and the total time is T2. At this time, compare whether the difference between T1 and T2 is less than the second threshold value, which is 5% of the larger one of T1 and T2. If not, further adjust the size of the first threshold value corresponding to the file compression package corresponding to T1 in process one according to the size of T1 and T2, that is, the size of X. Otherwise, wait for the next trigger signal.
[0088] The embodiments of the present application are as follows: Figure 3 As shown, a file transmission device is also provided, comprising:
[0089] A generation module, used for sequentially generating file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold;
[0090] A transmission module is used to sequentially transmit the file compression packages; wherein, when the packaging and compression start to generate the Nth file compression package, the N-1th file compression package starts to be transmitted to the second device.
[0091] By using the device in the above embodiment, a plurality of small files are packaged and combined for transmission, which can reduce the number of transmissions, thereby reducing the interaction between the first device and the second device, and improving the processing efficiency. In addition, the packaging compression and transmission processes are performed simultaneously, so that only a single process is kept to read and write files in the same time period to the maximum extent, thereby improving the reading and writing efficiency.
[0092] In some preferred embodiments, the generation module is also used to read a number of files to be transmitted and write them into the first storage space; when the total data volume of the files to be transmitted reaches a first threshold, the files to be transmitted are packaged and compressed and written into the second storage space.
[0093] In some preferred embodiments, the transmission module is used to, after packaging and compressing a number of first files to be transmitted and writing them into the second storage space, read a number of second files to be transmitted and write them into the first storage space; and package and compress a number of second files to be transmitted in the first storage space and write them into the second storage space to generate a file compression package.
[0094] In some preferred embodiments, the transmission module is used to transmit the Nth file compression package after the N-1th file compression package is transmitted.
[0095] In some preferred embodiments, the transmission module is used to delete the N-1th file compression package from the second storage space in the first device after the N-1th file compression package is transmitted and before the Nth file compression package is transmitted.
[0096] In some preferred embodiments, the transmission module is used to generate a trigger signal when the total data volume of the several files to be transmitted reaches a first threshold; start packaging and compressing to generate the Nth file compression package in response to the trigger signal; and start transmitting the N-1th file compression package to the second device in response to the trigger signal.
[0097] In some preferred embodiments, the transmission module is used to, when starting to pack and compress to generate the Nth file compression package, after starting to transmit the N-1th file compression package to the second device, count the duration of packing and compressing to generate the Nth file compression package as the first time; count the duration of transmitting the N-1th file compression package to the second device until the N-1th file compression package is deleted from the first device as the second time; determine whether the difference between the first time and the second time is less than a second threshold, and if so, wait for the trigger signal, otherwise if the first time is less than the second time, increase the size of the first threshold, if the first time is less than the second time, reduce the size of the first threshold, and then wait for the trigger signal.
[0098] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0099] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in an embodiment of the present application, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is configured to run the computer program to execute the method in the above embodiment.
[0100] In one embodiment, the electronic device may be a server. In this embodiment, the structure of the electronic device may be as follows: Figure 4 As shown, it includes a memory 2001 , a communication module 2003 and one or more processors 2002 .
[0101] The memory 2001 is used to store computer programs executed by the processor 2002. The memory 2001 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0102] The memory 2001 may be a volatile memory, such as a random-access memory (RAM); the memory 2001 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 2001 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2001 may be a combination of the above memories.
[0103] The processor 2002 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 2002 is used to implement the above-mentioned audio data processing method when calling the computer program stored in the memory 2001 .
[0104] The communication module 2003 is used to communicate with terminal devices and other servers.
[0105] The specific connection medium between the memory 2001, the communication module 2003 and the processor 2002 is not limited in the embodiment of the present application. Figure 4 In the embodiment, the memory 2001 and the processor 2002 are connected via a bus 2004. The bus 2004 is Figure 4 The connections between the other components are only for illustration and are not intended to be limiting. The bus 2004 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 4 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.
[0106] Based on the same inventive concept as the above method embodiment, an embodiment of the present invention also provides a computer-readable storage medium, the computer-readable storage medium is used to store a computer program, when the computer program is run on a computer, the electronic device implements the control method in the above embodiment. The computer-readable storage medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0107] Based on the same inventive concept as the above-mentioned method embodiment, an embodiment of the present invention further provides a computer program product, the computer program product including a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the control method according to various exemplary embodiments of the present application described above in this specification. The program product may adopt any combination of one or more readable media. These computer program commands may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate commands for implementing the steps in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0108] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A file transmission method, applied to a first device, for transmitting a file from the first device to a second device, characterized in that: including a first process and a second process started synchronously; The first process is used to sequentially generate file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold; The second process is used to sequentially transmit the file compression packages; wherein, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device; Wherein, when the Nth file compression package is generated by starting to pack and compress, the N-1th file compression package is started to be transmitted to the second device, including: when the total data volume of the plurality of files to be transmitted reaches a first threshold, a trigger signal is generated; The first process starts packaging and compressing to generate the Nth file compression package in response to the trigger signal; The second process starts transmitting the N-1th file compression package to the second device in response to the trigger signal; after the N-1th file compression package is transmitted, the N-1th file compression package is deleted from the first device; Among them, when the packaging and compression starts to generate the Nth file compression package, after the N-1th file compression package is transmitted to the second device, it includes: counting the duration of packaging and compression to generate the Nth file compression package as the first time; counting the duration of transmitting the N-1th file compression package to the second device until the N-1th file compression package is deleted from the first device as the second time; judging whether the difference between the first time and the second time is less than a second threshold, if so, waiting for the trigger signal, otherwise if the first time is less than the second time, increasing the size of the first threshold, if the first time is less than the second time, reducing the size of the first threshold, and then waiting for the trigger signal.
2. The method according to claim 1, characterized in that Each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold, and includes: Reading a plurality of files to be transmitted and writing them into the first storage space; When the total data volume of the plurality of files to be transmitted reaches a first threshold, the plurality of files to be transmitted in the first storage space are packaged and compressed and then written into the second storage space to generate a file compression package.
3. The method according to claim 2, characterized in that The sequential generation of the file compression package includes: After the plurality of first files to be transmitted are packaged, compressed and written into the second storage space, a plurality of second files to be transmitted are read and written into the first storage space; A plurality of second files to be transmitted in the first storage space are packaged, compressed, and written into the second storage space to generate a file compression package.
4. A file transmission device, characterized in that: include: A generation module, used for sequentially generating file compression packages; wherein each of the file compression packages is generated by packaging and compressing a number of files to be transmitted whose total data volume reaches a first threshold; a transmission module, configured to start sequentially transmitting the file compression packages synchronously with the generation module; wherein, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device; wherein, when the Nth file compression package is generated by packaging and compressing, the N-1th file compression package is transmitted to the second device, including: when the total data volume of the plurality of files to be transmitted reaches a first threshold, a trigger signal is generated; The first process starts packaging and compressing to generate the Nth file compression package in response to the trigger signal; The second process starts transmitting the N-1th file compression package to the second device in response to the trigger signal; after the N-1th file compression package is transmitted, the N-1th file compression package is deleted from the first device; Among them, when the packaging and compression starts to generate the Nth file compression package, after the N-1th file compression package is transmitted to the second device, it includes: counting the duration of packaging and compression to generate the Nth file compression package as the first time; counting the duration of transmitting the N-1th file compression package to the second device until the N-1th file compression package is deleted from the first device as the second time; judging whether the difference between the first time and the second time is less than a second threshold, if so, waiting for the trigger signal, otherwise if the first time is less than the second time, increasing the size of the first threshold, if the first time is less than the second time, reducing the size of the first threshold, and then waiting for the trigger signal.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 3.
7. A computer program product, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Data transmission method and device based on database storage system, equipment and medium
CN116185657A
Data transfer method, device, and system
JP2015176337A
Data transmitting program, data transmitting device, and data transmitting method
US20190199832A1
Methods and systems for encoding / decoding files and transmission thereof
US8533166B1
