This application claims priority to Chinese Patent Application No. 201310208783.8 filed on May 30, 2013 in the China Intellectual Property Office, the contents of which are incorporated by reference herein.
The subject matter herein generally relates to data transmission, and particularly to a method, a system, and a computing device to download files from the computing device to client computers.
In a network situation, files can be stored in a file server, such as a file transfer protocol (FTP) server and client computers can download the files from the file server. How to download the files from the file server conveniently is a problem to be solved.
Implementations of the present technology will now be described, by way of example only, with reference to the attached figures.
It will be appreciated that for simplicity and clarity of illustration, where appropriate, reference numerals have been repeated among the different figures to indicate corresponding or analogous elements. In addition, numerous specific details are set forth in order to provide a thorough understanding of the embodiments described herein. However, it will be understood by those of ordinary skill in the art that the embodiments described herein can be practiced without these specific details. In other instances, methods, procedures, and components have not been described in detail so as not to obscure the related relevant feature being described. The drawings are not necessarily to scale and the proportions of certain parts may be exaggerated to better illustrate details and features. The description is not to be considered as limiting the scope of the embodiments described herein.
Several definitions that apply throughout this disclosure will now be presented.
The term “module” refers to logic embodied in computing or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an erasable programmable read only memory (EPROM). The modules described herein may be implemented as either software and/or computing modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives. The term “comprising” means “including, but not necessarily limited to”; it specifically indicates open-ended inclusion or membership in a so-described combination, group, series and the like.
The database 11 can be installed in the computing device 1 or be externally connected to the computing device 1. The database 11 stores various files that can be downloaded by the client computers 2.
The file download system 10 can include a plurality of function modules (shown in
The control device 12 can be a processor, an application-specific integrated circuit (ASIC), or a field programmable gate array (FPGA), for example. The control device 12 can execute computerized codes of the function modules of the file download system 10 to realize the functions of the computing device 1.
The storage device 13 can include some type(s) of non-transitory computer-readable storage medium, for example a hard disk drive, a compact disc, a digital video disc, or a tape drive. The storage device 13 stores the computerized codes of the function modules of the file download system 10.
The generation module 100 generates a download address for each file stored in the database 11 by which each file can be downloaded. The first process module 101, in response to a first request received from the client computer 2, retrieves a certain file from the database 11, transforms the certain file into a data stream, reads data blocks with a specific length one by one from the data stream, and transmits the data blocks to the client computer 2. The second process module 102, in response to a second request received from the client computer 2, records an offset address of a data block that is being transmitted to the client computer 2, and suspends transmission of the data blocks to the client computer 2. The third process module 103, in response to a third request received from the client computer 2, reads data blocks of the data stream from the offset address, and resumes the transmission of the data blocks to the client computer 2. The fourth process module 104, in response to a fourth request received from the client computer 2, stops the transmission of the data blocks to the client computer 2.
Referring to
At block 302, a generation module generates a download address for each file stored in a database or other storage system of a computing device by which each file can be downloaded. According to the download address, each file stored in the database is accessible by a plurality of client computers. In one embodiment, the download address of a file is a uniform resource locator (URL), such as http://xx.xx.xxx.xx/File/a.doc.
In response to a first request from a client computer for starting a download of a certain file stored in the database, at block 304, a first process module retrieves the certain file from the database according to the download address of the certain file, and transforms the certain file into a data stream. In one embodiment, the first process module can determine whether the first request is approved. If the first request is not approved, the flow ends. If the first request is approved, the first process module retrieves the certain file from the database and transforms the certain file into a data stream.
At block 306, the first process module reads data blocks with a specific length (for example, 1024 KB) from the data stream, and transmits the data blocks to the client computer. In one embodiment, the first process module can transmit the data blocks to the client computer via a WCF interface. The first process module can read the data blocks of the data stream one by one. After a data block has been read, the first process module transmits the data block to the client computer. After a data block has been the data block has been transmitted to the client computer, the first process module reads a next data block.
In response to a second request from the client computer for suspending the download of the certain file, at block 308, a second process module records an offset address of a data block that is being transmitted, and suspends transmission of the data blocks to the client computer. In one embodiment, the second process module can determine whether the second request is approved. If the second request is not approved, the flow ends. If the second request is approved, the second process module records the offset address of the current data block that is being transmitted, and suspends the transmission of all data blocks to the client computer.
In response to a third request from the client computer for resuming the download of the certain file, at block 310, a third process module reads data blocks of the data stream from the offset address, and transmits the data blocks to the client computer. In one embodiment, the third process module can determine whether the third request is approved. If the third request is not approved, the flow ends. If the second request is approved, the third process module reads the data blocks of the data stream from the offset address, and resumes the transmission of the data blocks to the client computer.
In response to a fourth request from the client computer for stopping the download of the certain file, at block 312, a fourth process module stops the transmission of data blocks to the client computer. In one embodiment, the fourth process module can determine whether the fourth request is approved. If the fourth request is not approved, the flow ends. If the fourth request is approved, the fourth process module stops the further transmission of any data block to the client computer.
The embodiments shown and described above are only examples. Even though numerous characteristics and advantages of the present technology have been set forth in the foregoing description, together with details of the structure and function of the present disclosure, the disclosure is illustrative only, and changes may be made in the detail, including in particular the matters of shape, size and arrangement of parts within the principles of the present disclosure, up to and including the full extent established by the broad general meaning of the terms used in the claims.
Number | Date | Country | Kind |
---|---|---|---|
2013102087838 | May 2013 | CN | national |