File transmission method and device for network bandwidth, storage medium and equipment
The file segmentation and transmission control is solved through the target compression and token bucket mechanism, and the file transfer speed is slow under the condition of network bandwidth limitation, and fast, stable and controllable file transfer is achieved.
Patent Information
- Application Number
- CN202411650525.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-25
AI Technical Summary
In application scenarios where network bandwidth is limited, traditional file transmission methods are slow due to bandwidth limitations, which increases the risk of data transmission and security risks, affecting the normal handling of departure services.
The source files to be transferred are compressed through the target compression method, divided into multiple sub-data blocks to be transmitted, and the token bucket mechanism is used to control the transmission rate of the data blocks to ensure that they are transmitted only when there are enough tokens in the token bucket.
It realizes a fast, stable and controllable file transfer process under the conditions of network bandwidth limitation, avoids network congestion, and improves transmission efficiency and reliability.
Smart Images

Figure CN119520505A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method, a device, a storage medium and a device for file transmission over a network bandwidth. Background Art
[0002] With the rapid development of the global civil aviation industry, airports, as important transportation hubs, have become a bottleneck restricting the improvement of departure service efficiency due to their limited network bandwidth. In the departure service of the airport, the departure network dedicated line is often limited by a low bandwidth, which is usually between 2Mbps and 10Mbps. This bandwidth limitation has become a significant obstacle to traditional file transportation methods, which not only increases the risk of data transmission, but also poses a security risk and seriously interferes with the normal handling of departure business. Traditional file transfer methods usually rely on hardware speed-limiting devices, which require manual configuration and lack the flexibility to respond to changes in network requirements, adding a lot of workload to the operation and maintenance team.
[0003] In today's fast-growing civil aviation industry, efficient and rapid data transmission has become a core element to ensure smooth operations. Massive data files, including flight information, passenger registration, security checks and other information, need to be seamlessly transmitted between airports. The urgency of this demand highlights the importance of network bandwidth, which is not only the information lifeline connecting various aviation hubs, but also the key to improving service quality and ensuring flight safety.
[0004] The above civil aviation application scenario is only an example of an application scenario under the condition of limited network bandwidth, and application scenarios under other conditions of limited network bandwidth are not listed exhaustively.
[0005] Therefore, how to improve the speed of file transfer under the condition of limited network bandwidth is a technical problem to be solved. Summary of the invention
[0006] Based on this, it is necessary to provide a file transmission method, apparatus, storage medium and device for network bandwidth to address the defect of slow file transmission under network bandwidth limited conditions.
[0007] In a first aspect, an embodiment of the present invention provides a file transmission method for network bandwidth, the method comprising:
[0008] Compressing the source file to be transmitted by using a target compression method to obtain a compressed file;
[0009] After the compressed file is used as the file to be transmitted, the data block corresponding to the file to be transmitted is divided into a plurality of sub-data blocks to be transmitted according to a preset size;
[0010] Determine whether there is a first token greater than or equal to a first preset threshold in the token bucket;
[0011] When it is determined that there are the first tokens in the token bucket that are greater than or equal to the first preset threshold, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token, the sub-data block to be transmitted is transmitted to the corresponding destination end.
[0012] Optionally, the method further comprises:
[0013] In response to the tokens in the token bucket being exhausted, waiting for and generating second tokens to store all the second tokens in the token bucket;
[0014] Determine whether there is a second token in the token bucket that is greater than or equal to a second preset threshold;
[0015] After determining that there is a second token greater than or equal to the second preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding second token, the sub-data block to be transmitted is transmitted to the corresponding destination.
[0016] Optionally, the method further comprises:
[0017] Real-time monitoring of current network limitations and current network bandwidth usage;
[0018] The transmission rate of any one of the plurality of sub-data blocks to be transmitted is dynamically determined according to the limitation of the current network and the usage of the current network bandwidth.
[0019] Optionally, compressing the source file to be transmitted in a target compression manner to obtain a compressed file includes:
[0020] Obtain a target suffix that matches the target compression mode;
[0021] The source file to be transmitted is compressed using the target compression method to obtain the compressed file with the target suffix.
[0022] Optionally, the method further comprises:
[0023] An internal buffer is created to store the compressed file through the internal buffer.
[0024] In a second aspect, an embodiment of the present invention provides a file transmission device for network bandwidth, the device comprising:
[0025] A compression module is used to compress the source file to be transmitted by using a target compression method to obtain a compressed file;
[0026] A splitting module, used for splitting the data block corresponding to the file to be transmitted into a plurality of sub-data blocks to be transmitted according to a preset size after taking the compressed file as the file to be transmitted;
[0027] A determination module, used to determine whether there is a first token greater than or equal to a first preset threshold in the token bucket;
[0028] A transmission module is used to transmit the sub-data block to be transmitted to the corresponding destination end when it is determined that there is the first token greater than or equal to the first preset threshold in the token bucket and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token.
[0029] Optionally, the device further comprises:
[0030] A token generation module, configured to wait for and generate second tokens in response to the tokens in the token bucket being exhausted, so as to store all the second tokens in the token bucket;
[0031] The determination module is further used to: determine whether there is a second token greater than or equal to a second preset threshold in the token bucket;
[0032] The transmission module is also used to: when it is determined that there is a second token greater than or equal to the second preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding second token, transmit the sub-data block to be transmitted to the corresponding destination end.
[0033] Optionally, the device further comprises:
[0034] Monitoring module, used to monitor the current network restrictions and current network bandwidth usage in real time;
[0035] The transmission rate determination module is used to dynamically determine the transmission rate of each of the multiple sub-data blocks to be transmitted according to the limitation of the current network and the usage of the current network bandwidth.
[0036] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to execute the above method steps.
[0037] In a fourth aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0038] processor;
[0039] a memory for storing instructions executable by the processor;
[0040] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the above method steps.
[0041] In an embodiment of the present invention, a source file to be transmitted is compressed by a target compression method to obtain a compressed file; after the compressed file is used as the file to be transmitted, the data block corresponding to the file to be transmitted is divided into multiple sub-data blocks to be transmitted according to a preset size; it is determined whether there is a first token greater than or equal to a first preset threshold in the token bucket; and when it is determined that there is a first token greater than or equal to the first preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token, the sub-data block to be transmitted is transmitted to the corresponding destination. The file transmission method for network bandwidth provided by the embodiment of the present invention transmits the sub-data block to be transmitted to the corresponding destination only when there are enough first tokens in the token bucket and any one of the sub-data blocks to be transmitted applies for and obtains a token in the token bucket, thereby avoiding possible network congestion, thereby realizing a fast, stable and controllable file transmission process. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] By referring to the following drawings, a more complete understanding of the exemplary embodiments of the present invention can be obtained. The drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the drawings, the same reference numerals generally represent the same components or steps.
[0043] Figure 1 A flowchart of a file transmission method for network bandwidth provided according to an exemplary embodiment of the present invention;
[0044] Figure 2 A schematic diagram of a file transfer method for network bandwidth in a specific application scenario;
[0045] Figure 3 It is a schematic structural diagram of a file transmission device 300 for network bandwidth provided according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0046] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0047] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present invention should have the common meanings understood by those skilled in the art to which the present invention belongs.
[0048] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or equipment.
[0049] Embodiments of the present invention provide a file transmission method and device for network bandwidth, an electronic device, and a computer-readable medium, which are described below in conjunction with the accompanying drawings.
[0050] Example 1
[0051] Please refer to Figure 1 , which shows a flowchart of a file transmission method for network bandwidth provided by some embodiments of the present invention, such as Figure 1 As shown, the file transmission method for network bandwidth may include the following steps:
[0052] Step S101: compressing the source file to be transmitted by using a target compression method to obtain a compressed file.
[0053] In actual application scenarios, the target compression method may be: gzip compression using the gzip algorithm. The gzip compression method can significantly reduce the size of the transmitted file to reduce the demand for network bandwidth. During the compression process, the source file to be transmitted is converted into a compressed file in .gz format.
[0054] In addition, you can use the GZIP Output Stream class in Java to compress files. Integrate open source compression libraries such as Apache Commons Compress into the file transfer system. Set the compression level to balance compression efficiency and compression ratio.
[0055] In addition to the compression methods in the above examples, other compression methods may also be used to compress the source files to be transmitted, which are not specifically limited here.
[0056] In actual application scenarios, the above compression method can significantly reduce the size of the transmitted file, directly reducing the demand for network bandwidth. Through the above compression method, such as the aforementioned gzip compression, the file size of the aforementioned source file can be reduced to 30%-50% of the source file size while ensuring data integrity, thereby effectively reducing transmission time and bandwidth usage.
[0057] In a possible implementation, compressing the source file to be transmitted by using a target compression method to obtain a compressed file includes the following steps:
[0058] Get the target suffix that matches the target compression method;
[0059] The source file to be transmitted is compressed by a target compression method to obtain a compressed file with a target suffix.
[0060] In a possible implementation, the file transmission method for network bandwidth provided by the embodiment of the present invention may further include the following steps:
[0061] An internal buffer is created to store the compressed file through the internal buffer.
[0062] In actual application scenarios, the compressed file is read using a data stream before creating an internal buffer.
[0063] In actual application scenarios, the File Input Stream class in Java is used to read the compressed file. To create an internal buffer, the Byte Buffer class in Java or a custom buffer can be used.
[0064] ByteBuffer can be used as a buffer because it is a continuous space in memory. Four indexes are defined inside the ByteBuffer object, namely mark, position, limit, and capacity. The following are the descriptions of the above four indexes:
[0065] mark is used to mark the current position;
[0066] Position indicates the current readable and writable pointer. If a byte is written to the ByteBuffer object, the byte will be written to the address pointed to by position. If a byte is read from the ByteBuffer, the byte will be read from the address pointed to by position. After the reading and writing are completed, position is incremented by 1.
[0067] Limit is the boundary of what can be read and written. When positio reaches the limit, it means that the contents in the ByteBuffer have been read or the ByteBuffer has been filled.
[0068] capacity is the capacity of ByteBuffer. If ByteBuffer.allocate(128) is called in the program, it means that a ByteBuffer object with a capacity of 128 bytes is created.
[0069] Step S102: after the compressed file is used as the file to be transmitted, the data block corresponding to the file to be transmitted is divided into a plurality of sub-data blocks to be transmitted according to a preset size.
[0070] In the file transmission method provided in the embodiment of the present invention, the preset size in step S102 is not specifically limited, and the preset size can be configured according to the requirements of different application scenarios, which will not be described in detail here.
[0071] In a specific application scenario, the preset size can be configured as 1KB. The data block corresponding to the file to be transmitted is divided into multiple 1KB sub-data blocks to be transmitted. In this way, network congestion can be prevented by limiting the data transmission rate to maintain stable and efficient network communication.
[0072] Step S103: Determine whether there is a first token in the token bucket that is greater than or equal to a first preset threshold.
[0073] It should be noted that this step is aimed at application scenarios where there are enough tokens in the token bucket. The first preset threshold is not specifically limited and can be adjusted according to the requirements of different application scenarios, which will not be described in detail here.
[0074] Step S104: when it is determined that there is a first token greater than or equal to the first preset threshold in the token bucket and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token, the sub-data block to be transmitted is transmitted to the corresponding destination.
[0075] It should be noted that this step is targeted at an application scenario in which there are enough first tokens in the token bucket and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token.
[0076] In order to avoid data congestion problems that may occur during file transmission, the file transmission method provided by the embodiment of the present invention mainly has the following two application scenarios, which are described in detail as follows:
[0077] Case 1: There are enough tokens in the token bucket:
[0078] In response to there being enough first tokens in the token bucket (first tokens greater than or equal to the first preset threshold), and any one of the multiple sub-data blocks to be transmitted applies for and obtains a first token in the token bucket, the sub-data block to be transmitted is transmitted to the corresponding destination end.
[0079] The second situation: There are not enough tokens in the token bucket:
[0080] In response to the tokens in the token bucket being exhausted, waiting to generate a new token, i.e., a second token, until the second token is generated, so as to store all the second tokens in the token bucket;
[0081] If it is determined that there are enough second tokens in the token bucket (second tokens greater than or equal to the second preset threshold), and any one of the multiple sub-data blocks to be transmitted applies for and obtains a second token in the token bucket, the sub-data block to be transmitted is transmitted to the corresponding destination.
[0082] As above, the first token is for application scenarios where there are enough tokens in the token bucket, while the second token is for application scenarios where there are not enough tokens in the token bucket, and a new token is generated until the newly generated token is the application scenario of the second token.
[0083] It should be noted that this step is targeted at application scenarios where there are enough newly generated second tokens in the token bucket. The second preset threshold is not specifically limited and can be adjusted according to the requirements of different application scenarios, which will not be described in detail here.
[0084] In actual application scenarios, the token bucket initialization process includes: setting the initial number of tokens and setting the token generation rate. The initial number of tokens refers to the number of tokens initially present in the token bucket, and the token generation rate refers to the number of tokens generated by the token generator per second.
[0085] The token generator dynamically adjusts the number of tokens generated per second according to the dynamic transmission rate control module.
[0086] In the file transfer method provided in the embodiment of the present invention, there is no specific limitation on the number of tokens generated by the token generator per second. The following strategy can be used to determine the number of tokens generated per second, as described in detail below:
[0087] The first case: If the current bandwidth of the current network is relatively ample, the token generator will increase the number of tokens generated per second to increase the transmission rate.
[0088] The second case: If the current bandwidth of the current network is relatively tight, the token generator will reduce the number of tokens generated per second to reduce the transmission rate.
[0089] The token generator dynamically adjusts the number of tokens generated per second according to the dynamic transmission rate control module; in this way, under different network bandwidth conditions, the transmission speed can be flexibly adjusted to maximize the transmission efficiency to reduce network congestion and ensure the stability of the transmission process.
[0090] In a possible implementation, the file transmission method provided by the embodiment of the present invention may further include the following steps:
[0091] Real-time monitoring of current network limitations and current network bandwidth usage;
[0092] The transmission rate of each of the plurality of sub-data blocks to be transmitted is dynamically determined according to the current network limitation and the current network bandwidth usage.
[0093] In an actual application scenario, the process of the above-mentioned dynamic transmission rate control module dynamically determining the transmission rate of each of the multiple sub-data blocks to be transmitted is specifically described as follows:
[0094] The current network bandwidth of the outbound dedicated line is queried through the SNMP protocol. The query action executed by the SNMP protocol can obtain the number of input bytes and output bytes of the network device, so as to calculate the current bandwidth utilization rate. According to the query results, the current bandwidth ratio is calculated. If the utilization rate of the current bandwidth of the current network does not reach 50%, a part of the remaining bandwidth is allocated to each sub-data block to be transmitted for file transmission; if the utilization rate of the current bandwidth of the current network has reached 50% or above, the current transmission rate is limited to 1% of the total bandwidth. This method of dynamically adjusting the transmission rate can maximize the file transfer rate when the network bandwidth utilization rate is low; when the network bandwidth utilization rate is high, it ensures the normal operation of other key businesses. After that, the file transfer rate is updated every 30 seconds according to the new bandwidth utilization calculation result. In this way, the file transfer method provided by the embodiment of the present invention can dynamically optimize the transmission process according to the changes in the actual network environment to ensure the efficiency and stability of file transmission.
[0095] Since the aforementioned SNMP protocol is a conventional protocol, it will not be described in detail here.
[0096] It should be noted that the aforementioned dynamic transmission rate control module can not only determine the transmission rate of any one of multiple sub-data blocks to be transmitted, but also determine other key transmission parameters, which may include: an upper limit value of the transmission rate and an initial value of the transmission rate.
[0097] like Figure 2 , which is a schematic diagram of a file transmission method for network bandwidth in a specific application scenario.
[0098] like Figure 2 As shown in the figure, the file transfer process is described as follows:
[0099] After the source file is compressed, a compressed file is obtained; the compressed file is used as the file to be transmitted, and the data block corresponding to the file to be transmitted is divided into multiple sub-data blocks to be transmitted according to a preset size; because each sub-data block to be transmitted needs to apply for and obtain a token (first token) in a token bucket before transmission; only after the corresponding token is applied for and obtained, can it be transmitted; at this time, it is necessary to determine whether the tokens in the token bucket are sufficient. If the tokens in the token bucket are sufficient, any one of the multiple sub-data blocks to be transmitted applies for and obtains a token in the token bucket, and transmits the sub-data block to be transmitted to the corresponding destination; otherwise, if the tokens in the token bucket are exhausted, wait for the generation of a new token (second token) until a new token is generated, so that all new tokens are stored in the token bucket, and it is determined that there are enough new tokens in the token bucket, then repeat the above steps, any one of the sub-data blocks to be transmitted applies for and obtains a new token in the corresponding token bucket, and transmits the sub-data block to be transmitted to the corresponding destination.
[0100] In addition, in Figure 2 In the file transfer process shown, the process of dynamically determining the transmission rate of any one of the multiple sub-data blocks to be transmitted through the dynamic transmission rate control module also uses the network bandwidth share threshold of 50%. For the description of this part, please refer to the description of the same or similar part mentioned above, which will not be repeated here.
[0101] It should be noted that the file transfer method provided in the embodiment of the present invention can be applied to application scenarios with limited network bandwidth, especially application scenarios with limited airport network bandwidth, but it is not limited to airport network application scenarios, and other specific application scenarios will not be listed one by one.
[0102] The file transmission method for network bandwidth provided by the embodiment of the present invention transmits the sub-data block to be transmitted to the corresponding destination only when there are enough first tokens in the token bucket and any sub-data block to be transmitted applies for and obtains a token in the token bucket, thereby avoiding possible network congestion and realizing a fast, stable and controllable file transmission process.
[0103] In addition, the file transmission method provided by the embodiment of the present invention also has the following advantages, which are specifically described as follows:
[0104] Advantage 1: Adaptive network bandwidth: It has the ability to dynamically adjust the transmission rate and can better adapt to changing network conditions.
[0105] Advantage 2: Efficient use of network bandwidth: When network bandwidth is available, the transmission rate can be automatically increased to complete file transfer faster, thereby improving transmission efficiency. Under high load conditions, the transmission rate can be reduced to avoid network congestion and ensure that other key businesses are not affected.
[0106] Advantage 3: Optimize network traffic management: Combining file compression and current limiting methods can not only reduce the transmission time required to transmit compressed files, but also reasonably allocate network resources and prevent excessive consumption of bandwidth to keep the network smooth and without lag.
[0107] Advantage 4: Enhanced transmission reliability: By continuously monitoring network conditions and adjusting the transmission speed strategy, it is possible to maintain stable performance in various network environments to reduce the risk of transmission interruption, thereby enhancing the reliability of network transmission.
[0108] In the above-mentioned embodiment, a file transmission method for network bandwidth is provided, and correspondingly, the present invention also provides a file transmission device for network bandwidth. The file transmission device for network bandwidth provided in the embodiment of the present invention can implement the above-mentioned file transmission method for network bandwidth, and the file transmission device for network bandwidth can be implemented by software, hardware, or a combination of software and hardware. For example, the file transmission device for network bandwidth can include integrated or separate functional modules or units to perform the corresponding steps in the above-mentioned methods.
[0109] Example 2
[0110] Please refer to Figure 3 , which shows a schematic diagram of a file transmission device for network bandwidth provided by some embodiments of the present invention. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0111] like Figure 3 As shown, the file transmission device 300 for network bandwidth may include:
[0112] The compression module 301 is used to compress the source file to be transmitted by using a target compression method to obtain a compressed file;
[0113] A splitting module 302 is used to split the data block corresponding to the file to be transmitted into a plurality of sub-data blocks to be transmitted according to a preset size after the compressed file is used as the file to be transmitted;
[0114] A determination module 303 is used to determine whether there is a first token greater than or equal to a first preset threshold in the token bucket;
[0115] The transmission module 304 is used to transmit the sub-data block to the corresponding destination when it is determined that there is a first token greater than or equal to the first preset threshold in the token bucket and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token.
[0116] In some implementations of the embodiments of the present invention, the file transmission device 300 for network bandwidth provided by the embodiments of the present invention may further include:
[0117] Token generation module (in Figure 3 ), for responding to the tokens in the token bucket being exhausted, waiting for and generating a second token, so as to store all the second tokens in the token bucket;
[0118] The determination module 303 is further used to: determine whether there is a second token greater than or equal to a second preset threshold in the token bucket;
[0119] The transmission module 304 is also used to: when it is determined that there is a second token greater than or equal to a second preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding second token, transmit the sub-data block to be transmitted to the corresponding destination.
[0120] In some implementations of the embodiments of the present invention, the file transmission device 300 for network bandwidth provided by the embodiments of the present invention may further include:
[0121] Monitoring module (in Figure 3 (not shown) for real-time monitoring of current network restrictions and current network bandwidth usage;
[0122] Transmission rate determination module (in Figure 3 ), which is used to dynamically determine the transmission rate of each of the multiple sub-data blocks to be transmitted according to the current network constraints and the current network bandwidth usage.
[0123] In some implementations of the embodiments of the present invention, the compression module 301 is specifically used to:
[0124] Get the target suffix that matches the target compression method;
[0125] The source file to be transmitted is compressed by a target compression method to obtain a compressed file with a target suffix.
[0126] In some implementations of the embodiments of the present invention, the file transmission device 300 for network bandwidth provided by the embodiments of the present invention may further include:
[0127] Create a module (in Figure 3 ), which is not shown in the figure, is used to create an internal buffer to store the compressed file through the internal buffer.
[0128] In some implementations of the embodiments of the present invention, in some implementations of the embodiments of the present invention, the file transmission device 300 for network bandwidth provided by the embodiments of the present invention is based on the same inventive concept and has the same beneficial effects as the file transmission method for network bandwidth provided by the aforementioned embodiments of the present invention.
[0129] Example 3
[0130] An embodiment of the present invention provides a computer device, including a memory and a processor, wherein the processor is used to read instructions stored in the memory, and the instructions can execute a file transmission method for network bandwidth in any of the above method embodiments.
[0131] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD ROM, optical storage, etc.) containing computer-usable program codes.
[0132] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can 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 instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0133] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0135] Example 4
[0136] This embodiment provides a computer-readable storage medium, wherein the computer storage medium stores computer-executable instructions, and the computer-executable instructions can execute a file transmission method for network bandwidth in any of the above method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD) or a solid state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.
[0137] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A file transmission method for network bandwidth, characterized in that: The method comprises: Compressing the source file to be transmitted by using a target compression method to obtain a compressed file; After the compressed file is used as the file to be transmitted, the data block corresponding to the file to be transmitted is divided into a plurality of sub-data blocks to be transmitted according to a preset size; Determine whether there is a first token greater than or equal to a first preset threshold in the token bucket; When it is determined that there are the first tokens greater than or equal to the first preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token, the sub-data block to be transmitted is transmitted to the corresponding destination end.
2. The file transmission method according to claim 1, characterized in that: The method further comprises: In response to the tokens in the token bucket being exhausted, waiting for and generating second tokens to store all the second tokens in the token bucket; Determine whether there is a second token in the token bucket that is greater than or equal to a second preset threshold; After determining that there is a second token greater than or equal to the second preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding second token, the sub-data block to be transmitted is transmitted to the corresponding destination.
3. The file transmission method according to claim 1 or 2, characterized in that: The method further comprises: Real-time monitoring of current network limitations and current network bandwidth usage; The transmission rate of each of the plurality of sub-data blocks to be transmitted is dynamically determined according to the limitation of the current network and the usage of the current network bandwidth.
4. The file transmission method according to claim 1, characterized in that: The method of compressing the source file to be transmitted by a target compression method to obtain a compressed file includes: Obtain a target suffix that matches the target compression mode; The source file to be transmitted is compressed using the target compression method to obtain the compressed file with the target suffix.
5. The file transmission method according to claim 1, characterized in that: The method further comprises: An internal buffer is created to store the compressed file through the internal buffer.
6. A file transmission device for network bandwidth, characterized in that: The device comprises: A compression module is used to compress the source file to be transmitted by using a target compression method to obtain a compressed file; A splitting module, used for splitting the data block corresponding to the file to be transmitted into a plurality of sub-data blocks to be transmitted according to a preset size after taking the compressed file as the file to be transmitted; A determination module, used to determine whether there is a first token greater than or equal to a first preset threshold in the token bucket; A transmission module is used to transmit the sub-data block to be transmitted to the corresponding destination end when it is determined that there is the first token greater than or equal to the first preset threshold in the token bucket and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding first token.
7. The file transmission device according to claim 6, characterized in that: The device also includes: A token generation module, configured to wait for and generate second tokens in response to the tokens in the token bucket being exhausted, so as to store all the second tokens in the token bucket; The determination module is further used to: determine whether there is a second token greater than or equal to a second preset threshold in the token bucket; The transmission module is also used to: when it is determined that there is a second token greater than or equal to the second preset threshold in the token bucket, and any one of the multiple sub-data blocks to be transmitted applies for and obtains the corresponding second token, transmit the sub-data block to be transmitted to the corresponding destination end.
8. The file transmission device according to claim 6 or 7, characterized in that: The device also includes: Monitoring module, used to monitor the current network restrictions and current network bandwidth usage in real time; The transmission rate determination module is used to dynamically determine the transmission rate of each of the multiple sub-data blocks to be transmitted according to the limitation of the current network and the usage of the current network bandwidth.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to execute the file transmission method according to any one of claims 1 to 5.
10. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing executable instructions for the processor; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the file transmission method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Data transmission method and device, electronic equipment and medium
CN111669364A
Data distribution transmission method and device in multiple wireless access systems, computer equipment and storage medium
CN111884946A
Data transmission method and device, electronic equipment, storage medium and program product
CN113938435A
Data transmission method and device, storage medium and electronic equipment
CN116016357A
Data transmission method and apparatus
US20200053590A1