CN105357305B - File sending method and device, file receiving method and device and terminal equipment - Google Patents
File sending method and device, file receiving method and device and terminal equipment Download PDFInfo
- Publication number
- CN105357305B CN105357305B CN201510781731.9A CN201510781731A CN105357305B CN 105357305 B CN105357305 B CN 105357305B CN 201510781731 A CN201510781731 A CN 201510781731A CN 105357305 B CN105357305 B CN 105357305B
- Authority
- CN
- China
- Prior art keywords
- file
- queue
- sent
- files
- blocks
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 54
- 230000005540 biological transmission Effects 0.000 claims abstract description 89
- 230000008569 process Effects 0.000 claims abstract description 14
- 230000004044 response Effects 0.000 claims description 38
- 238000004321 preservation Methods 0.000 claims description 9
- 230000005611 electricity Effects 0.000 claims description 3
- 239000002699 waste material Substances 0.000 description 13
- 238000010586 diagram Methods 0.000 description 12
- 230000006870 function Effects 0.000 description 9
- 230000007257 malfunction Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention provides a file sending method and device, a file receiving method and device and terminal equipment, wherein the file sending method is applied to the terminal equipment as a sender and comprises the following steps: sequentially reading at least two file blocks of a file to be sent through a reading thread sequence, and putting the read file blocks into a queue to be sent; and in the process of putting the read file blocks into the queue to be sent through the reading thread, acquiring the file blocks from the queue to be sent through the sending thread according to a first-in first-out principle, and sending the acquired file blocks. By the invention, the reading and sending of the file block in the sender are respectively executed in parallel in the two threads, so that the time wasted by the forced waiting of the operation of sending the file block when the file block is read is reduced, and the receiving and the saving of the data block in the receiver are respectively executed in parallel in the two threads, so that the time wasted by the forced waiting of the operation of saving the data block when the data block is received is reduced, the transmission speed of the file is improved, and the user experience is improved.
Description
Technical field
The present invention relates to technical field of data transmission more particularly to a kind of document sending methods and device, file reception side
Method and device and terminal device.
Background technique
Existing file transmission, when sending file, sender opens file, and file is divided into n block by regular length, reads
The content of a block file block is taken to send by network, the reading for being then further continued for next blocks of files is sent, until file
The end of transmission.And when receiving file, recipient receives the content of file to be received from network, then writes received content
Enter disk.
In this way, the reading of sender's blocks of files and being sent in same thread serially carries out, same recipient's message in-coming waiting
The reception and preservation of part also serially carry out in the same thread, and time-consuming more, transmission speed is slower.
Summary of the invention
The purpose of the present invention is intended to solve at least some of the technical problems in related technologies.
For this purpose, the first purpose of this invention is to propose a kind of document sending method.In this way, sender's file
The reading and transmission of block are executed in two thread parallels respectively, when reducing execution reading blocks of files, send the operation of blocks of files
It is forced to wait and the time of waste, improves the transmission speed of file, improve user experience.
Second object of the present invention is to propose a kind of document receiving method, in this way, receiving side data block
It receives and saves and executed respectively in two thread parallels, when reducing execution reception data block, the operation for saving data block is forced
The time for waiting and wasting, the reception speed of file is improved, user experience is improved.
Third object of the present invention is to propose a kind of file sending device.
Fourth object of the present invention is to propose a kind of file reception device.
5th purpose of the invention is to propose a kind of terminal device.
To achieve the goals above, the document sending method of first aspect present invention embodiment is applied to be used as sender
Terminal device in, including:At least two blocks of files for being successively read file to be sent by reading thread order, by reading
Blocks of files is put into queue to be sent;During the blocks of files of reading is put into queue to be sent by the reading thread,
Blocks of files is obtained from the queue to be sent according to the principle of first in, first out by sending thread, sends the blocks of files of acquisition.
With reference to first aspect, in the first possible implementation of the first aspect, the file to be sent includes extremely
Few two files;The method also includes:By the reading thread by first file at least two file
Blocks of files reading finishes, and is all put into after the queue to be sent, in the original by the transmission thread according to first in, first out
During then obtaining blocks of files from the queue to be sent, continue to read at least two text by the reading thread
The blocks of files of second file of reading is put into the queue to be sent by the blocks of files of second file in part.
The possible implementation of with reference to first aspect the first, in second of possible implementation of first aspect
In, the method also includes:The response of file transmission success is received after the equal end of transmission of at least two files;Or
Person receives the response of file loading error occurring in file loading error occurring.
With reference to first aspect or the first or second of possible implementation of first aspect, in first aspect
In the third possible implementation, at least two blocks of files for being successively read file to be sent by reading thread order
Before, further include:The description information that the file to be sent is read by the reading thread, by retouching for the file to be sent
It states information and is put into the queue to be sent;The file to be sent is obtained from the queue to be sent by the transmission thread
Description information, send the description information of the file to be sent of acquisition.
In the document sending method of the embodiment of the present invention, file to be sent is successively read at least by reading thread order
The blocks of files of reading is put into queue to be sent by two blocks of files, is being put into the blocks of files of reading by above-mentioned reading thread
During queue to be sent, file is obtained from above-mentioned queue to be sent according to the principle of first in, first out by sending thread
Block sends the blocks of files of acquisition, so as to so that the reading and sending of sender's blocks of files is executed in two thread parallels respectively,
When reducing execution reading blocks of files, the operation for sending blocks of files is forced waiting and the time of waste, improves the transmission of file
Speed improves user experience.
To achieve the goals above, the document receiving method of second aspect of the present invention embodiment is applied to be used as recipient
Terminal device in, including:Received data block is put into be saved by the data block that file to be received is received by receiving thread
Queue;During received data block is put into queue to be saved by the receiving thread, by save thread according to
The principle of first in, first out obtains data block from the queue to be saved, and corresponding file is written in the data block that will acquire.
In conjunction with second aspect, in the first possible implementation of the second aspect, the length of the queue to be saved
Greater than the length of the queue to be sent of corresponding sender.
In conjunction with second aspect, in a second possible implementation of the second aspect, the method also includes:Will be to
After reception file reception finishes, the response to sender's feedback file transmission success;Alternatively, receiving the file to be received
Response when error, to sender's feedback file loading error occurring.
In conjunction with the first or second of possible implementation of second aspect or second aspect, in second aspect
In the third possible implementation, before the data block that file to be received is received by receiving thread, further include:Pass through
The receiving thread receives the description information of the file to be received, after the description information receives, by the description
Information is put into the queue to be saved;The description information is obtained from the queue to be saved by the preservation thread.
In the document receiving method of the embodiment of the present invention, the data block of file to be received is received by receiving thread, will be connect
The data block of receipts is put into queue to be saved, in the process that received data block is put into queue to be saved by above-mentioned receiving thread
In, data block is obtained from above-mentioned queue to be saved according to the principle of first in, first out by saving thread, the data block that will acquire
Corresponding file is written, so as to so that the reception and preservation of receiving side data block are reduced respectively in two thread parallels execution
It executing when receiving data block, the operation for saving data block is forced to wait and the time of waste, the reception speed of file is improved,
Improve user experience.
To achieve the goals above, the file sending device of third aspect present invention embodiment is arranged as sender
Terminal device in, including:Read module, for being sequentially successively read at least two blocks of files of file to be sent;It is put into mould
Block, the blocks of files for reading the read module are put into queue to be sent;Module is obtained, for inciting somebody to action in the module that is put into
During the blocks of files that the read module is read is put into queue to be sent, according to the principle of first in, first out from described to be sent
Blocks of files is obtained in queue;Sending module, the blocks of files obtained for sending the acquisition module.
In conjunction with the third aspect, in the first possible implementation of the third aspect, the file to be sent includes extremely
Few two files;The read module is also used to read by the blocks of files of first file at least two file
Finish, it is described to be put into after the blocks of files of first file of reading is all put into the queue to be sent by module, it is obtained described
During modulus block obtains blocks of files from the queue to be sent according to the principle of first in, first out, it is described at least to continue reading
The blocks of files of second file in two files;It is described to be put into module, it is also used to second text for reading the read module
The blocks of files of part is put into the queue to be sent.
In conjunction with the first possible implementation of the third aspect, in second of possible implementation of the third aspect
In, described device further includes:Receiving module, for after the equal end of transmission of at least two files receive file transmission at
The response of function;Alternatively, receiving the response of file loading error occurring in file loading error occurring.
In conjunction with the first or second of possible implementation of the third aspect or the third aspect, in the third aspect
In the third possible implementation, the read module is also used to sequentially be successively read at least two of file to be sent
Before blocks of files, the description information of the file to be sent is read;It is described to be put into module, it is also used to read the read module
The description information of file to be sent be put into the queue to be sent;The acquisition module is also used to from the queue to be sent
The middle description information for obtaining the file to be sent;The sending module is also used to send the described of the acquisition module acquisition
The description information of file to be sent.
In the file sending device of the embodiment of the present invention, read module sequence is successively read at least two of file to be sent
Blocks of files is put into module for the blocks of files that read module is read and is put into queue to be sent, and acquisition module will in the above-mentioned module that is put into
During the blocks of files that above-mentioned read module is read is put into queue to be sent, according to the principle of first in, first out from queue to be sent
Middle acquisition blocks of files, then sending module, which is sent, obtains the blocks of files that module obtains, so as to so that file sending device Chinese
The reading and transmission of part block are executed in two thread parallels respectively, when reducing execution reading blocks of files, send the behaviour of blocks of files
Make to be forced to wait and the time of waste, improves the transmission speed of file, improve user experience.
To achieve the goals above, the file reception device of fourth aspect present invention embodiment is arranged as recipient
Terminal device in, including:Receiving module, for receiving the data block of file to be received;It is put into module, is used for the reception
The received data block of module is put into queue to be saved;Module is obtained, for being put into module described and receiving the receiving module
Data block be put into queue to be saved during, obtain data from the queue to be saved according to the principle of first in, first out
Block;Corresponding file is written in writing module, the data block for obtaining the acquisition module.
In conjunction with fourth aspect, in the first possible implementation of the fourth aspect, the length of the queue to be saved
Greater than the length of the queue to be sent of corresponding file sending device.
In conjunction with fourth aspect, in the second possible implementation of the fourth aspect, described device further includes:Feed back mould
Block, for being passed to corresponding file sending device feedback file after the receiving module finishes file reception to be received
Defeated successful response;Alternatively, when the receiving module receives the document lending to be received, to corresponding file sending device
The response of feedback file loading error occurring.
In conjunction with the first or second of possible implementation of fourth aspect or fourth aspect, in fourth aspect
In the third possible implementation, the receiving module is also used to before the data block for receiving file to be received, receives institute
State the description information of file to be received;It is described to be put into module, it is also used to after the description information receives, by the description
Information is put into the queue to be saved;The acquisition module is also used to obtain the description information from the queue to be saved.
In the file reception device of the embodiment of the present invention, receiving module receives the data block of file to be received, is put into module
The received data block of receiving module is put into queue to be saved, module is obtained and is being put into module for the received data block of receiving module
During being put into queue to be saved, data block is obtained from above-mentioned queue to be saved according to the principle of first in, first out, mould is written
Corresponding file is written in the data block that block obtains above-mentioned acquisition module, so as to so that data block connects in file reception device
It receives and saves and executed respectively in two thread parallels, when reducing execution reception data block, the operation for saving data block is forced
To and waste time, improve the reception speed of file, improve user experience.
To achieve the goals above, the terminal device of fifth aspect present invention embodiment, including:Shell, processor, storage
Device, transmitter, circuit board and power circuit, wherein the circuit board is placed in the space interior that the shell surrounds, the place
Device, the memory and the transmitter is managed to be arranged on the circuit board;The power circuit, for being the terminal device
Each circuit or device power supply;The memory is for storing executable program code;The processor passes through described in reading
The executable program code stored in memory runs program corresponding with executable program code, for executing following step
Suddenly:At least two blocks of files for being successively read file to be sent by reading thread order, the blocks of files of reading are put into pending
Send queue;During the blocks of files of reading is put into queue to be sent by the reading thread, pressed by sending thread
Blocks of files is obtained from the queue to be sent according to the principle of first in, first out;The transmitter, for sending the transmission thread
The blocks of files of acquisition.
In the terminal device of the embodiment of the present invention, processor is successively read file to be sent extremely by reading thread order
Few two blocks of files, are put into queue to be sent for the blocks of files of reading, are being put the blocks of files of reading by above-mentioned reading thread
During entering queue to be sent, file is obtained from above-mentioned queue to be sent according to the principle of first in, first out by sending thread
Block, then transmitter sends the blocks of files that above-mentioned transmission thread obtains, so as to so that in terminal device the reading of blocks of files and
Send and executed respectively in two thread parallels, when reducing execution and reading blocks of files, the operation for sending blocks of files be forced to wait and
The time of waste improves the transmission speed of file, improves user experience.
To achieve the goals above, the terminal device of sixth aspect present invention embodiment, including:Shell, processor, storage
Device, receiver, circuit board and power circuit, wherein the circuit board is placed in the space interior that the shell surrounds, the place
Device, the memory and the receiver is managed to be arranged on the circuit board;The power circuit, for being the terminal device
Each circuit or device power supply;The memory is for storing executable program code;The receiver, it is waiting for receiving
The data block of message in-coming part;The processor is run by reading the executable program code stored in the memory and can be held
The corresponding program of line program code, for executing following steps:By receiving thread by the received data block of the receiver
It is put into queue to be saved;During received data block is put into queue to be saved by the receiving thread, pass through guarantor
It deposits thread and obtains data block from the queue to be saved according to the principle of first in, first out, the data block write-in that will acquire is corresponding
File.
In the terminal device of the embodiment of the present invention, after receiver receives the data block of file to be received, processor passes through
The received data block of above-mentioned receiver is put into queue to be saved by receiving thread, by above-mentioned receiving thread by received data
During block is put into queue to be saved, obtained from above-mentioned queue to be saved by saving thread according to the principle of first in, first out
Corresponding file is written in data block, the data block that will acquire, so as to so as to the reception of data block and save point in terminal device
It is not executed in two thread parallels, when reducing execution and receiving data block, the operation for saving data block is forced to wait and waste
Time improves the reception speed of file, improves user experience.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partially become from the following description
Obviously, or practice through the invention is recognized.
Detailed description of the invention
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments
Obviously and it is readily appreciated that, wherein:
Fig. 1 is the flow chart of document sending method one embodiment of the present invention;
Fig. 2 is the flow chart of document receiving method one embodiment of the present invention;
Fig. 3 is the structural schematic diagram of file sending device one embodiment of the present invention;
Fig. 4 is the structural schematic diagram of another embodiment of file sending device of the present invention;
Fig. 5 is the structural schematic diagram of file reception device one embodiment of the present invention;
Fig. 6 is the structural schematic diagram of another embodiment of file reception device of the present invention;
Fig. 7 is the structural schematic diagram of terminal device one embodiment of the present invention;
Fig. 8 is the structural schematic diagram of another embodiment of terminal device of the present invention.
Specific embodiment
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end
Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached
The embodiment of figure description is exemplary, and for explaining only the invention, and is not considered as limiting the invention.On the contrary, this
The embodiment of invention includes all changes fallen within the scope of the spiritual and intension of attached claims, modification and is equal
Object.
Fig. 1 is the flow chart of document sending method one embodiment of the present invention, and this document sending method is applied as hair
In the terminal device for the side of sending.
As shown in Figure 1, this document sending method may include:
Step 101, at least two blocks of files for being successively read file to be sent by reading thread order, by the text of reading
Part block is put into queue to be sent.
Wherein, above-mentioned queue to be sent can be lock-free queue, or have lock queue, the present embodiment is to above-mentioned pending
The form of queue is sent to be not construed as limiting, only lock-free queue is more efficient.
Step 102, during the blocks of files of reading is put into queue to be sent by above-mentioned reading thread, pass through hair
Line sending journey obtains blocks of files from above-mentioned queue to be sent according to the principle of first in, first out, sends the blocks of files of acquisition.
In the present embodiment, the file of sender is read and network transmission executes in two threads respectively, the text of sender
Part input and output (Input Output;Hereinafter referred to as:I/O) thread (i.e. reading thread) is in the blocks of files for reading file to be sent
Afterwards, the blocks of files of reading is put into queue to be sent, in the process, network I/O thread (i.e. transmission thread) is from team to be sent
Blocks of files is obtained in column to send.That is, the reading and transmission of blocks of files are executed in two thread parallels respectively.
Further, before step 101, the description letter of above-mentioned file to be sent can also be read by above-mentioned reading thread
The description information of above-mentioned file to be sent is put into above-mentioned queue to be sent by breath, and by sending thread from above-mentioned to be sent
The description information that above-mentioned file to be sent is obtained in queue sends the description information of the above-mentioned file to be sent of acquisition.Thus may be used
See, the mode that sender sends foregoing description information is identical as the mode of blocks of files is sent, and the reading thread of sender is being read
After the description information of above-mentioned file to be sent, the description information of reading is put into queue to be sent, send thread from team to be sent
Description information is obtained in column to send.
Wherein, the description information of above-mentioned file to be sent can be the filename of file to be sent and/or file size etc.
Information.Foregoing description information is sent before sending blocks of files, is in order to by the filename and/or file size of file to be sent
Etc. information inform recipient, such recipient just would know which file will received be, and will received file
The information such as length.
In the present embodiment, above-mentioned file to be sent may include at least two files, then above-mentioned document sending method may be used also
To include:The blocks of files reading of first file in above-mentioned at least two file is being finished by above-mentioned reading thread, all
Be put into after above-mentioned queue to be sent, by above-mentioned transmission thread according to the principle of first in, first out from above-mentioned queue to be sent
During obtaining blocks of files, continue the file for reading second file in above-mentioned at least two file by above-mentioned reading thread
The blocks of files of second file of reading is put into above-mentioned queue to be sent by block.Further, equal in above-mentioned at least two file
The response of file transmission success is received after end of transmission;Alternatively, receiving the sound of file loading error occurring in file loading error occurring
It answers.
That is, the reading thread of sender is running through first in above-mentioned at least two file in the present embodiment
File and after all putting the blocks of files included by it into queue, the blocks of files for being not to wait for first file is sent completely, but is connect
Read the blocks of files of second file in above-mentioned at least two file and continue to be placed into queue.The transmission thread of sender exists
After the blocks of files of first file in queue is sent, in addition to sending necessary other information, continue to send above-mentioned queue
In second file blocks of files.In the case where file transmission does not malfunction, sender is until the last one file is transferred
Finish, just waits the result feedback of recipient.
In the present embodiment, sender can after the above-mentioned equal end of transmission of at least two files, receive file transmission at
The response of function;Alternatively, sender can also receive the response of file loading error occurring in file loading error occurring, transmitted out in file
It staggers the time, receiving direction sender's feedback file loading error occurring, after sender receives the response of file loading error occurring, file is passed
Defeated stopping, at this moment, user can voluntarily select the file of the file for retransmitting loading error occurring and loading error occurring to have not been transmitted below
File.
In above-mentioned document sending method, at least two files of file to be sent are successively read by reading thread order
The blocks of files of reading is put into queue to be sent by block, and the blocks of files of reading is being put into team to be sent by above-mentioned reading thread
During column, blocks of files is obtained from above-mentioned queue to be sent according to the principle of first in, first out by sending thread, transmission obtains
The blocks of files taken, so as to so that the reading and transmission of sender's blocks of files reduce and hold respectively in two thread parallels execution
When row reads blocks of files, the operation for sending blocks of files is forced to wait and the time of waste, improves the transmission speed of file, improves
User experience;Further, sender is when sending at least two files, in the case where file transmission does not malfunction, until
By the last one file end of transmission, the result feedback of recipient is just waited, is wasted to reduce because synchronizing intermediate result
Time, further improve the transmission speed of file, improve user experience.
Fig. 2 is the flow chart of document receiving method one embodiment of the present invention, and this document method of reseptance, which is applied to be used as, to be connect
In the terminal device of debit.
As shown in Fig. 2, above-mentioned document receiving method may include:
Step 201, received data block is put into team to be saved by the data block that file to be received is received by receiving thread
Column.
Step 202, during received data block is put into queue to be saved by above-mentioned receiving thread, pass through guarantor
It deposits thread and obtains data block from above-mentioned queue to be saved according to the principle of first in, first out, the data block write-in that will acquire is corresponding
File.
Wherein, above-mentioned queue to be saved can be lock-free queue, or have lock queue, the present embodiment is to above-mentioned wait protect
The form for depositing queue is not construed as limiting, and only lock-free queue is more efficient.
In the present embodiment, the network of recipient is received and file write-in executes in two threads respectively, the net of recipient
Network I/O thread (i.e. receiving thread) receives the queue to be saved for putting recipient after data block into, file I/O thread from network
(i.e. preservation thread) obtains data block out of above-mentioned queue to be saved and writes into corresponding file.
Further, before step 201, can also include:The description of file to be received is received by above-mentioned receiving thread
Information;After foregoing description information receives, foregoing description information is put into above-mentioned queue to be saved;By save thread from
Foregoing description information is obtained in above-mentioned queue to be saved.Specifically, the receiving thread of recipient is only by file to be received
Description information receive after, foregoing description information can be just put into above-mentioned queue to be saved, then the preservation of recipient
Thread obtains foregoing description information out of above-mentioned queue to be saved.
Wherein, the description information of above-mentioned file to be received can be the filename of file to be received and/or file size etc.
Information.Recipient receives after foregoing description information, so that it may know it will received will be which file, and will be received
The information such as the length of file.
In the present embodiment, the length of above-mentioned queue to be saved is greater than the length of the queue to be sent of corresponding sender.This
In embodiment, for the not reciprocity queue of wireless network environment design recipient and sender, so as to reduce recipient team
Full probability is arranged, the waiting time is reduced, improves file transfer speed.
Further, the response after finishing file reception to be received, to sender's feedback file transmission success;Or
Person, the response when receiving above-mentioned document lending to be received, to sender's feedback file loading error occurring.That is, this implementation
In example, when transmitting at least two files, recipient can all received file to be received and then to sender
The response of feedback file transmission success;Alternatively, recipient can also be when receiving document lending to be received, to sender's feedback text
The response of part loading error occurring, after sender receives the response of file loading error occurring, file transmission stops, at this moment, Yong Huke
With the file for voluntarily selecting the file of the file for retransmitting loading error occurring and loading error occurring to have not been transmitted below.
In above-mentioned document receiving method, the data block of file to be received is received by receiving thread, by received data block
It is put into queue to be saved, during received data block is put into queue to be saved by above-mentioned receiving thread, passes through guarantor
It deposits thread and obtains data block from above-mentioned queue to be saved according to the principle of first in, first out, the data block write-in that will acquire is corresponding
File, so as to so that the reception and preservation of receiving side data block reduce respectively in two thread parallels execution and execute reception
When data block, the operation for saving data block is forced to wait and the time of waste, improves the reception speed of file, improves user
Experience;Further, when transmitting at least two files, in the case where file transmission does not malfunction, until by the last one text
Part receives, and receives feedback file transmission just now as a result, to reduce the time wasted because synchronizing intermediate result, into one
Step improves the transmission speed of file, improves user experience.
Fig. 3 is the structural schematic diagram of file sending device one embodiment of the present invention, and the file in the present embodiment sends dress
Setting can be set in the terminal device as sender, realize the process of embodiment illustrated in fig. 1 of the present invention.
Wherein, above-mentioned terminal device can be the terminal devices such as computer or mobile phone, and the present embodiment is to above-mentioned terminal device
Form is not construed as limiting.
As shown in figure 3, above-mentioned file sending device may include:Read module 31 is put into module 32, obtains 33 and of module
Sending module 34;
Wherein, read module 31, for being sequentially successively read at least two blocks of files of file to be sent;
It is put into module 32, the blocks of files for reading read module 31 is put into queue to be sent;
Wherein, above-mentioned queue to be sent can be lock-free queue, or have lock queue, the present embodiment is to above-mentioned pending
The form of queue is sent to be not construed as limiting, only lock-free queue is more efficient.
Module 33 is obtained, in the mistake for being put into module 32 for the blocks of files that read module 31 is read and being put into queue to be sent
Cheng Zhong obtains blocks of files from above-mentioned queue according to the principle of first in, first out;
Sending module 34, for sending the blocks of files for obtaining module 33 and obtaining.
In the present embodiment, the file of file sending device is read and network transmission executes in two threads respectively, file
The read module 31 of sending device is put into the text that module 32 reads read module 31 after the blocks of files for reading file to be sent
Part block puts queue to be sent into, in the process, obtains module 33 and obtains blocks of files, sending module out of above-mentioned queue to be sent
34 send the blocks of files for obtaining the acquisition of module 33.That is, the reading and transmission of blocks of files exist respectively in file sending device
Two thread parallels execute.
Further, read module 31, be also used at least two blocks of files for being sequentially successively read file to be sent it
Before, read the description information of above-mentioned file to be sent;
It is put into module 32, the description information for the file to be sent for being also used to read read module 31 is put into above-mentioned to be sent
Queue;
Module 33 is obtained, is also used to obtain the description information of above-mentioned file to be sent from above-mentioned queue to be sent;
Sending module 34 is also used to send the description information for obtaining the above-mentioned file to be sent that module 33 obtains.
It can be seen that the mode that file sending device sends foregoing description information is identical as the mode of blocks of files is sent, text
The read module 31 of part sending device is put into module 32 for read module 31 after the description information for reading above-mentioned file to be sent
The description information of reading puts queue to be sent into, obtains module 33 and obtains description information out of above-mentioned queue to be sent, sends mould
Block 34 sends the description information of above-mentioned file to be sent.
Wherein, the description information of above-mentioned file to be sent can be the filename of file to be sent and/or file size etc.
Information.Foregoing description information is sent before sending blocks of files, is in order to by the filename and/or file size of file to be sent
Etc. information inform file reception device, it will received be that such file reception device just would know that for which file, and will
The information such as the length of received file.
In the present embodiment, above-mentioned file to be sent may include at least two files;
At this moment, read module 31 are also used to read by the blocks of files of first file in above-mentioned at least two file
Finish, is put into after the blocks of files of first file of reading is all put into above-mentioned queue to be sent by module 32, is obtaining module
During 33 obtain blocks of files from above-mentioned queue to be sent according to the principle of first in, first out, continue to read above-mentioned at least two
The blocks of files of second file in file;
It is put into module 32, the blocks of files for second file for being also used to read read module 31 is put into above-mentioned team to be sent
Column.
Fig. 4 is the structural schematic diagram of another embodiment of file sending device of the present invention, sends and fills with file shown in Fig. 3
It sets and compares, the difference is that, file sending device shown in Fig. 4 can also include:Receiving module 35;
Wherein, receiving module 35, for receiving file transmission success after the above-mentioned equal end of transmission of at least two files
Response;Alternatively, receiving the response of file loading error occurring, in file loading error occurring, file reception in file loading error occurring
Device is to file sending device feedback file loading error occurring, after receiving module 35 receives the response of file loading error occurring, text
Part transmission stops, and at this moment, user can voluntarily select not pass also behind the file of re-transmission loading error occurring and the file of loading error occurring
Defeated file.
In above-mentioned file sending device, 31 sequence of read module is successively read at least two blocks of files of file to be sent,
It is put into module 32 and the blocks of files that read module is read is put into queue to be sent, acquisition module 33 will be upper in the above-mentioned module 32 that is put into
State the reading of read module 31 blocks of files be put into queue to be sent during, according to the principle of first in, first out from queue to be sent
Middle acquisition blocks of files, then sending module 34, which is sent, obtains the blocks of files that module 33 obtains, so as to so that file sending device
The reading and transmission of middle blocks of files are executed in two thread parallels respectively, when reducing execution reading blocks of files, send blocks of files
Operation be forced wait and waste time, improve the transmission speed of file, improve user experience;Further, file
Sending device is when sending at least two files, until by the last one file end of transmission, ability pending file reception device
As a result it feeds back, to reduce the time wasted because synchronizing intermediate result, further improves the transmission speed of file, improve
User experience.
Fig. 5 is the structural schematic diagram of file reception device one embodiment of the present invention, and file reception device shown in fig. 5 can
To be arranged in as in the terminal device of recipient, the process of embodiment illustrated in fig. 2 of the present invention is realized.
Wherein, above-mentioned terminal device can be the terminal devices such as computer or mobile phone, and the present embodiment is to above-mentioned terminal device
Form is not construed as limiting.
As shown in figure 5, above-mentioned file reception device may include:Receiving module 51 is put into module 52, obtains 53 and of module
Writing module 54;
Wherein, receiving module 51, for receiving the data block of file to be received;
It is put into module 52, for the received data block of receiving module 51 to be put into queue to be saved;Wherein, above-mentioned to be saved
Queue can be lock-free queue, or have lock queue, the present embodiment is not construed as limiting the form of above-mentioned queue to be saved, only
It is the more efficient of lock-free queue.
Module 53 is obtained, in the mistake for being put into module 52 for the received data block of receiving module 51 and being put into queue to be saved
Cheng Zhong obtains data block from above-mentioned queue to be saved according to the principle of first in, first out;
Corresponding file is written in writing module 54, the data block for will acquire the acquisition of module 53.
In the present embodiment, the network of file reception device is received and file write-in executes in two threads respectively, file
After the receiving module 51 of reception device receives data block from network, module 52 is put by the received data block of receiving module 51
It puts above-mentioned queue to be saved into, in the process, obtains module 53 and obtain data block out of above-mentioned queue to be saved, and by being written
Module 54 writes into corresponding file.
Further, receiving module 51 are also used to before the data block for receiving file to be received, are received above-mentioned to be received
The description information of file;
It is put into module 52, is also used to after foregoing description information receives, foregoing description information is put into above-mentioned wait protect
Deposit queue;
Module 53 is obtained, is also used to obtain foregoing description information from above-mentioned queue to be saved.
Specifically, the receiving module 51 of file reception device is only received by the description information of file to be received
Later, can just foregoing description information be put into above-mentioned queue to be saved by being put into module 52, then the acquisition mould of file reception device
Block 53 obtains foregoing description information out of above-mentioned queue to be saved.
Wherein, the description information of above-mentioned file to be received can be the filename of file to be received and/or file size etc.
Information.File reception device receives after foregoing description information, so that it may know it will received will be which file, and will
The information such as the length of received file.
Wherein, the length of above-mentioned queue to be saved is greater than the length of the queue to be sent of corresponding file sending device.This
In embodiment, for the not reciprocity queue of wireless network environment design document reception device and file sending device, so as to
The probability of file reception device queue full is reduced, the waiting time is reduced, improves file transfer speed.
Fig. 6 is the structural schematic diagram of another embodiment of file reception device of the present invention, is filled with file reception shown in fig. 5
It sets and compares, the difference is that, file reception device shown in fig. 6 can also include:
Feedback module 55, for after receiving module 51 finishes above-mentioned file reception to be received, to corresponding file
The response of sending device feedback file transmission success;Alternatively, when receiving module 51 receives above-mentioned document lending to be received, to right
The response for the file sending device feedback file loading error occurring answered.
That is, when transmitting at least two files, feedback module 55 can be incited somebody to action in receiving module 51 in the present embodiment
File to be received all receives and then the response to file sending device feedback file transmission success;Alternatively, feedback mould
Block 55 can also be when receiving document lending to be received, response to file sending device feedback file loading error occurring, file hair
After sending device to receive the response of file loading error occurring, file transmission stops, and at this moment, user can voluntarily select to retransmit and transmit
The file that the file of error and the file of loading error occurring have not been transmitted below.
In above-mentioned file reception device, receiving module 51 receives the data block of file to be received, and being put into module 52 will receive
The received data block of module 51 is put into queue to be saved, obtains module 53 and is being put into module 52 for the received data of receiving module 51
During block is put into queue to be saved, data block is obtained from above-mentioned queue to be saved according to the principle of first in, first out, is written
Corresponding file is written in the data block that module 54 obtains above-mentioned acquisition module 53, so as to so that data in file reception device
The reception and preservation of block are executed in two thread parallels respectively, when reducing execution reception data block, save the operation of data block
It is forced to wait and the time of waste, improves the reception speed of file, improve user experience;Further, it is transmitting at least
When two files, in the case where file transmission does not malfunction, until the last one file reception is finished, feedback module 55 is just anti-
The transmission of feedback file further improves the transmission speed of file as a result, to reduce the time wasted because synchronizing intermediate result
Degree, improves user experience.
Fig. 7 is the structural schematic diagram of terminal device one embodiment of the present invention, and the terminal device in the present embodiment can be made
The process of embodiment illustrated in fig. 1 of the present invention is realized for the terminal device of sender, wherein above-mentioned terminal device can be computer or
The terminal devices such as mobile phone, the present embodiment are not construed as limiting the form of above-mentioned terminal device.
As shown in fig. 7, above-mentioned terminal device may include:Shell 71, processor 72, memory 73, transmitter 74, circuit
Plate 75 and power circuit 76, wherein circuit board 75 is placed in the space interior that shell 71 surrounds, processor 72,73 and of memory
Transmitter 74 is arranged on foregoing circuit plate 75;Power circuit 76, for each circuit or the device confession for above-mentioned terminal device
Electricity;Memory 73 is for storing executable program code;Processor 72 is by reading the executable program stored in memory 73
Code runs program corresponding with executable program code, for executing following steps:By reading thread order successively
The blocks of files of reading is put into queue to be sent by least two blocks of files for reading file to be sent;Passing through above-mentioned read line
During the blocks of files of reading is put into queue to be sent by journey, by send thread according to first in, first out principle from it is above-mentioned to
Blocks of files is obtained in transmit queue;Wherein, above-mentioned queue to be sent can be lock-free queue, or have lock queue, this reality
It applies example to be not construed as limiting the form of above-mentioned queue to be sent, only lock-free queue is more efficient.
Transmitter 74, the blocks of files obtained for sending above-mentioned transmission thread.
In the present embodiment, the file of above-mentioned terminal device is read and network transmission executes in two threads respectively, above-mentioned
The reading thread of terminal device puts the blocks of files of reading into queue to be sent after the blocks of files for reading file to be sent,
During this, transmission thread obtains blocks of files out of queue to be sent and sends.That is, file in above-mentioned terminal device
The reading and transmission of block are executed in two thread parallels respectively.
Further, processor 72 can also read the description information of above-mentioned file to be sent by above-mentioned reading thread,
The description information of above-mentioned file to be sent is put into above-mentioned queue to be sent, and by above-mentioned transmission thread from above-mentioned to be sent
The description information of above-mentioned file to be sent is obtained in queue, transmitter 74 sends the above-mentioned text to be sent that above-mentioned transmission thread obtains
The description information of part.It can be seen that above-mentioned terminal device sends the mode of foregoing description information and the mode phase for sending blocks of files
Together, above-mentioned processor 72 is by reading thread after the description information for reading above-mentioned file to be sent, by the description information of reading
It puts queue to be sent into, and obtains description information out of queue to be sent by sending thread, and sent out by transmitter 74
It goes.
Wherein, the description information of above-mentioned file to be sent can be the filename of file to be sent and/or file size etc.
Information.Foregoing description information is sent before sending blocks of files, is in order to by the filename and/or file size of file to be sent
Etc. information inform recipient, such recipient just would know which file will received be, and will received file
The information such as length.
In the present embodiment, above-mentioned file to be sent may include at least two files;
At this moment, processor 72, be also used to by above-mentioned reading thread by first file in above-mentioned at least two file
Blocks of files reading finish, after the blocks of files of first file of reading is all put into above-mentioned queue to be sent, passing through
During above-mentioned transmission thread obtains blocks of files from above-mentioned queue to be sent according to the principle of first in, first out, pass through above-mentioned reading
Line taking journey continues to read the blocks of files of second file in above-mentioned at least two file, and by the file of second file of reading
Block is put into above-mentioned queue to be sent.
Further, above-mentioned terminal device can also include:Receiver 77;
Wherein, receiver 77, for receiving file transmission success after the above-mentioned equal end of transmission of at least two files
Response;Alternatively, the response of file loading error occurring is received in file loading error occurring, in file loading error occurring, as recipient
Terminal device to the terminal device feedback file loading error occurring as sender, receiver 77 receives file loading error occurring
After response, file transmission stops, and at this moment, user can voluntarily select to retransmit the file of loading error occurring and the file of loading error occurring
The file having not been transmitted below.
In the present embodiment, above-mentioned terminal device can also include network interface card, which can be wireless network card, or have
Gauze card, but the present embodiment is illustrated by taking wireless network card as an example.Specifically, transmitter 74 can be sent out by above-mentioned wireless network card
Blocks of files is sent, receiver 77 can receive blocks of files by above-mentioned wireless network card.
In above-mentioned terminal device, processor 72 is successively read at least two texts of file to be sent by reading thread order
The blocks of files of reading is put into queue to be sent by part block, to be sent being put into the blocks of files of reading by above-mentioned reading thread
During queue, blocks of files is obtained from above-mentioned queue to be sent according to the principle of first in, first out by sending thread, by sending out
Send device 74 send obtain blocks of files, so as to so that in terminal device blocks of files reading and send respectively two threads simultaneously
It goes and executes, when reducing execution reading blocks of files, the operation for sending blocks of files is forced waiting and the time of waste, improves file
Transmission speed, improve user experience;Further, above-mentioned terminal device is passed when sending at least two files in file
It is defeated do not malfunction in the case where, until by the last one file end of transmission, just grade to be used as the terminal device of recipient result
Feedback further improves the transmission speed of file, improves use to reduce the time wasted because synchronizing intermediate result
Family experience.
Fig. 8 is the structural schematic diagram of another embodiment of terminal device of the present invention, and the terminal device in the present embodiment can be with
The process of embodiment illustrated in fig. 2 of the present invention is realized as the terminal device of recipient, wherein above-mentioned terminal device can be computer
Or the terminal devices such as mobile phone, the present embodiment are not construed as limiting the form of above-mentioned terminal device.
As shown in figure 8, above-mentioned terminal device may include:Shell 81, processor 82, memory 83, receiver 84, circuit
Plate 85 and power circuit 86, wherein circuit board 85 is placed in the space interior that shell 81 surrounds, processor 82,83 and of memory
Receiver 84 is arranged on circuit board 85;Power circuit 86, for each circuit or the device power supply for above-mentioned terminal device;It deposits
Reservoir 83 is for storing executable program code;
Receiver 84, for receiving the data block of file to be received;
Processor 82 is run by reading the executable program code stored in memory 83 and executable program code
Corresponding program, for executing following steps:The received data block of receiver 84 is put into team to be saved by receiving thread
Column;During received data block is put into queue to be saved by above-mentioned receiving thread, by saving thread according to elder generation
Enter the principle first gone out and obtain data block from above-mentioned queue to be saved, corresponding file is written in the data block that will acquire.Wherein, on
Stating queue to be saved can be lock-free queue, or have a lock queue, the present embodiment to the form of above-mentioned queue to be saved not
It limits, only lock-free queue is more efficient.
In the present embodiment, the network of above-mentioned terminal device is received and file write-in executes in two threads respectively, above-mentioned
After the receiver 84 of terminal device receives data block from network, processor 82 is received by receiver 84 by receiving thread
Data block puts the queue to be saved of above-mentioned terminal device into, and in the process, processor 82 is by saving thread from above-mentioned wait protect
It deposits and obtains data block in queue and write into corresponding file.
Further, receiver 84 can also receive the description information of file to be received;It is received in foregoing description information
After, foregoing description information is put into above-mentioned queue to be saved by above-mentioned receiving thread by processor 82;And by above-mentioned
It saves thread and obtains foregoing description information from above-mentioned queue to be saved.Specifically, only in receiver 84 by text to be received
After the description information of part receives, processor 82 just can by above-mentioned receiving thread by foregoing description information be put into it is above-mentioned to
Queue is saved, then obtains foregoing description information out of above-mentioned queue to be saved by above-mentioned preservation thread.
Wherein, the description information of above-mentioned file to be received can be the filename of file to be received and/or file size etc.
Information.After receiver 84 receives foregoing description information, it will received be that processor 82 just would know that for which file, and
Will received file the information such as length.
In the present embodiment, the length of above-mentioned queue to be saved is greater than the length of the queue to be sent of corresponding sender.This
In embodiment, the queue of the terminal device of recipient is configured as wireless network environment and as the terminal device of sender
Not reciprocity queue reduces the waiting time so as to reduce the probability of the terminal device queue full as recipient, improves text
Part transmission speed.
Further, processor 82 are also used to after finishing file reception to be received, are passed to sender's feedback file
Defeated successful response;Alternatively, the response when receiving above-mentioned document lending to be received, to sender's feedback file loading error occurring.
That is, in the present embodiment, when transmitting at least two files, above-mentioned terminal device can be by message in-coming waiting
Part all receives and then the response to sender's feedback file transmission success;Alternatively, above-mentioned terminal device can also be
When receiving document lending to be received, response to sender's feedback file loading error occurring, sender receives file loading error occurring
Response after, file transmission stop, at this moment, user can voluntarily select retransmit loading error occurring file and loading error occurring text
The file that part has not been transmitted below.
In the present embodiment, above-mentioned terminal device can also include network interface card, which can be wireless network card, or have
Gauze card, but the present embodiment is illustrated by taking wireless network card as an example.Specifically, receiver 84 can be clamped by above-mentioned wireless network
Receive data block.
In above-mentioned terminal device, receiver 84 receives the data block of file to be received, and processor 82 will by receiving thread
The received data block of receiver 84 is put into queue to be saved, to be saved being put into received data block by above-mentioned receiving thread
During queue, processor 82 obtains data from above-mentioned queue to be saved according to the principle of first in, first out by saving thread
Corresponding file is written in block, the data block that will acquire, so as to so that receiving side data block reception and save respectively at two
Thread parallel executes, and when reducing execution reception data block, the operation for saving data block is forced waiting and the time of waste, improves
The reception speed of file, improves user experience;Further, when transmitting at least two files, do not go out in file transmission
In the case where mistake, until the last one file reception is finished, the transmission of 82 ability feedback file of processor as a result, to reduce because
The time for synchronizing intermediate result and wasting, the transmission speed of file is further improved, user experience is improved.
It should be noted that in the description of the present invention, term " first ", " second " etc. are used for description purposes only, without
It can be interpreted as indication or suggestion relative importance.In addition, in the description of the present invention, unless otherwise indicated, the meaning of " multiple "
It is two or more.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes
It is one or more for realizing specific logical function or process the step of executable instruction code module, segment or portion
Point, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discussed suitable
Sequence, including according to related function by it is basic simultaneously in the way of or in the opposite order, to execute function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
It should be appreciated that each section of the invention can be realized with hardware, software, firmware or their combination.Above-mentioned
In embodiment, software that multiple steps or method can be executed in memory and by suitable instruction execution system with storage
Or firmware is realized.It, and in another embodiment, can be under well known in the art for example, if realized with hardware
Any one of column technology or their combination are realized:With for realizing the logic gates of logic function to data-signal
Discrete logic, with suitable combinational logic gate circuit specific integrated circuit, programmable gate array
(Programmable Gate Array;Hereinafter referred to as:PGA), field programmable gate array (Field Programmable
Gate Array;Hereinafter referred to as:FPGA) etc..
Those skilled in the art are understood that realize all or part of step that above-described embodiment method carries
It suddenly is that relevant hardware can be instructed to complete by program, the program can store in a kind of computer-readable storage medium
In matter, which when being executed, includes the steps that one or a combination set of embodiment of the method.
In addition, each functional module in each embodiment of the present invention can integrate in a processing module, it is also possible to
Modules physically exist alone, and can also be integrated in a module with two or more modules.Above-mentioned integrated module
Both it can take the form of hardware realization, can also have been realized in the form of software function module.If the integrated module
In the form of software function module realize and when sold or used as an independent product, also can store can in a computer
It reads in storage medium.
Storage medium mentioned above can be read-only memory, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example
Point is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are not
Centainly refer to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be any
One or more embodiment or examples in can be combined in any suitable manner.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is example
Property, it is not considered as limiting the invention, those skilled in the art within the scope of the invention can be to above-mentioned
Embodiment is changed, modifies, replacement and variant.
Claims (10)
1. a kind of document sending method, applied in the terminal device as sender, which is characterized in that including:
At least two blocks of files for being successively read file to be sent by reading thread order, the blocks of files of reading are put into pending
Send queue;
During the blocks of files of reading is put into queue to be sent by the reading thread, by sending thread according to elder generation
Enter the principle first gone out and obtain blocks of files from the queue to be sent, sends the blocks of files of acquisition;
Wherein, the file to be sent includes at least two files;
The method also includes:The blocks of files of first file at least two file is being read by the reading thread
Take complete, be all put into after the queue to be sent, by the transmission thread according to the principle of first in, first out from described
During obtaining blocks of files in queue to be sent, continue to read second at least two file by the reading thread
The blocks of files of second file of reading is put into the queue to be sent by the blocks of files of a file;
The response of file transmission success is received after the equal end of transmission of at least two files.
2. the method according to claim 1, wherein described be successively read text to be sent by reading thread order
Before at least two blocks of files of part, further include:
The description information that the file to be sent is read by the reading thread, the description information of the file to be sent is put
Enter the queue to be sent;
The description information for obtaining the file to be sent from the queue to be sent by the transmission thread, sends acquisition
The description information of the file to be sent.
3. a kind of document receiving method, applied in the terminal device as recipient, which is characterized in that including:
Received data block is put into queue to be saved by the data block that file to be received is received by receiving thread;
During received data block is put into queue to be saved by the receiving thread, by saving thread according to elder generation
Enter the principle first gone out and obtain data block from the queue to be saved, corresponding file is written in the data block that will acquire;
Wherein, the length of the queue to be saved is greater than the length of the queue to be sent of corresponding sender;
The method also includes:Response after finishing file reception to be received, to sender's feedback file transmission success.
4. according to the method described in claim 3, it is characterized in that, the data for receiving file to be received by receiving thread
Before block, further include:
The description information that the file to be received is received by the receiving thread will after the description information receives
The description information is put into the queue to be saved;
The description information is obtained from the queue to be saved by the preservation thread.
5. a kind of file sending device, is arranged in the terminal device as sender, which is characterized in that including:
Read module, for being sequentially successively read at least two blocks of files of file to be sent;
It is put into module, the blocks of files for reading the read module is put into queue to be sent;
Module is obtained, in the process for being put into module and the blocks of files that the read module is read being put into queue to be sent
In, blocks of files is obtained from the queue to be sent according to the principle of first in, first out;
Sending module, the blocks of files obtained for sending the acquisition module;
Wherein, the file to be sent includes at least two files;
The read module is also used to finish by the blocks of files reading of first file at least two file, described
It is put into after the blocks of files of first file of reading is all put into the queue to be sent by module, is pressed in the acquisition module
According to first in, first out principle obtain blocks of files from the queue to be sent during, continue to read at least two file
In second file blocks of files;
Described to be put into module, the blocks of files for second file for being also used to read the read module is put into the team to be sent
Column;
The file sending device further includes:
Receiving module, for receiving the response of file transmission success after the equal end of transmission of at least two files.
6. device according to claim 5, which is characterized in that
The read module is also used to before being sequentially successively read at least two blocks of files of file to be sent, described in reading
The description information of file to be sent;
Described to be put into module, the description information for the file to be sent for being also used to read the read module is put into described to be sent
Queue;
The acquisition module is also used to obtain the description information of the file to be sent from the queue to be sent;
The sending module is also used to send the description information for the file to be sent that the acquisition module obtains.
7. a kind of file reception device, is arranged in the terminal device as recipient, which is characterized in that including:
Receiving module, for receiving the data block of file to be received;
It is put into module, for the received data block of the receiving module to be put into queue to be saved;
Module is obtained, in the process for being put into module and the received data block of the receiving module being put into queue to be saved
In, data block is obtained from the queue to be saved according to the principle of first in, first out;
Corresponding file is written in writing module, the data block for obtaining the acquisition module;
Wherein, the length of the queue to be saved is greater than the length of the queue to be sent of corresponding file sending device;
The file reception device further includes:
Feedback module, for after the receiving module finishes file reception to be received, to corresponding file sending device
The response of feedback file transmission success.
8. device according to claim 7, which is characterized in that
The receiving module is also used to before the data block for receiving file to be received, receives the description of the file to be received
Information;
It is described to be put into module, it is also used to after the description information receives, the description information is put into described to be saved
Queue;
The acquisition module is also used to obtain the description information from the queue to be saved.
9. a kind of terminal device, which is characterized in that including:Shell, processor, memory, transmitter, circuit board and power supply electricity
Road, wherein the circuit board is placed in the space interior that the shell surrounds, the processor, the memory and the hair
Device is sent to be arranged on the circuit board;The power circuit, for each circuit or the device power supply for the terminal device;Institute
Memory is stated for storing executable program code;The processor is by reading the executable program stored in the memory
Code runs program corresponding with executable program code, for executing following steps:By reading thread order successively
The blocks of files of reading is put into queue to be sent by least two blocks of files for reading file to be sent;Passing through the read line
During the blocks of files of reading is put into queue to be sent by journey, by send thread according to first in, first out principle from it is described to
Blocks of files is obtained in transmit queue;
The transmitter, the blocks of files obtained for sending the transmission thread;
Wherein, the file to be sent may include at least two files;
The processor, be also used to by the reading thread by the blocks of files of first file at least two file
Reading finishes, and after the blocks of files of first file of reading is all put into the queue to be sent, is passing through the transmission
During thread obtains blocks of files from the queue to be sent according to the principle of first in, first out, by the reading thread after
It resumes studies and takes the blocks of files of second file at least two file, and the blocks of files of second file of reading is put into institute
State queue to be sent;
The terminal device can also include:Receiver;
The receiver, for receiving the response of file transmission success after the equal end of transmission of at least two files.
10. a kind of terminal device, which is characterized in that including:Shell, processor, memory, receiver, circuit board and power supply electricity
Road, wherein the circuit board is placed in the space interior that the shell surrounds, and the processor, the memory and described connects
Device is received to be arranged on the circuit board;The power circuit, for each circuit or the device power supply for the terminal device;Institute
Memory is stated for storing executable program code;
The receiver, for receiving the data block of file to be received;
The processor is run by reading the executable program code stored in the memory and executable program code
Corresponding program, for executing following steps:The received data block of the receiver is put by receiving thread to be saved
Queue;During received data block is put into queue to be saved by the receiving thread, by save thread according to
The principle of first in, first out obtains data block from the queue to be saved, and corresponding file is written in the data block that will acquire;
Wherein, the length of the queue to be saved is greater than the length of the queue to be sent of corresponding sender;
The processor is also used to after finishing file reception to be received, to the sound of sender's feedback file transmission success
It answers.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510781731.9A CN105357305B (en) | 2015-11-13 | 2015-11-13 | File sending method and device, file receiving method and device and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510781731.9A CN105357305B (en) | 2015-11-13 | 2015-11-13 | File sending method and device, file receiving method and device and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105357305A CN105357305A (en) | 2016-02-24 |
CN105357305B true CN105357305B (en) | 2018-11-20 |
Family
ID=55333164
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510781731.9A Expired - Fee Related CN105357305B (en) | 2015-11-13 | 2015-11-13 | File sending method and device, file receiving method and device and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105357305B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107231284B (en) * | 2016-03-23 | 2020-06-05 | 阿里巴巴集团控股有限公司 | Message sending method and terminal equipment |
CN107172181B (en) * | 2017-06-07 | 2020-12-04 | 河南辉煌城轨科技有限公司 | File transmission method based on double threads |
CN107589990B (en) * | 2017-10-26 | 2021-03-26 | 苏州浪潮智能科技有限公司 | Data communication method and system based on thread pool |
CN107896248B (en) * | 2017-11-13 | 2019-11-22 | 中山大学 | A parallel file system application method based on client communication |
CN114721830A (en) * | 2022-04-20 | 2022-07-08 | Oppo广东移动通信有限公司 | File receiving method, device, storage medium and terminal |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102663104A (en) * | 2012-04-16 | 2012-09-12 | 苏州阔地网络科技有限公司 | Document transmission method and document transmission system |
CN103475899A (en) * | 2013-07-30 | 2013-12-25 | 深圳市融创天下科技股份有限公司 | Data distribution method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2469299B (en) * | 2009-04-07 | 2011-02-16 | Imagination Tech Ltd | Ensuring consistency between a data cache and a main memory |
-
2015
- 2015-11-13 CN CN201510781731.9A patent/CN105357305B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102663104A (en) * | 2012-04-16 | 2012-09-12 | 苏州阔地网络科技有限公司 | Document transmission method and document transmission system |
CN103475899A (en) * | 2013-07-30 | 2013-12-25 | 深圳市融创天下科技股份有限公司 | Data distribution method and device |
Also Published As
Publication number | Publication date |
---|---|
CN105357305A (en) | 2016-02-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105357305B (en) | File sending method and device, file receiving method and device and terminal equipment | |
CN110741342B (en) | Blockchain transaction commit ordering | |
KR101371936B1 (en) | Methods for controlling host memory access with memory devices and systems | |
CN106502932B (en) | Method based on interconnecting interface and its write operation and read operation between layered | |
CN102156682B (en) | High speed interface for non-volatile memory | |
KR101417543B1 (en) | Packet deconstruction/reconstruction and link-control | |
CN101150486A (en) | A management method for receiving network data of zero copy buffer queue | |
JPS5992652A (en) | Electronic document distributing system | |
CN1288544A (en) | Data transferring in source-synchronous and common clock protocols | |
TW200901028A (en) | Message queuing system for parallel integrated circuit architecture and related method of operation | |
CN107209743A (en) | The reception clock alignment of universal serial bus | |
EP2312457A2 (en) | Data processing apparatus, data processing method and computer-readable medium | |
CN102271033A (en) | Method and device for implementing hybrid automatic repeat request memory dynamic scheduling | |
TW200839514A (en) | Memory management apparatus | |
CN101150488A (en) | A receiving method for zero copy network packet | |
US11803391B2 (en) | Self-scheduling threads in a programmable atomic unit | |
CN105554081B (en) | A kind of transmission method and device of file delta | |
CN116627869B (en) | Data transmission method and device applied to electronic equipment | |
CN101394349B (en) | Data transmission method and system in communication of different interface devices | |
CN109101662A (en) | Block generation method, device, equipment and storage medium | |
CN104615558B (en) | A kind of data transferring method and electronic device | |
JPH0567009A (en) | File transfer processing method | |
CN105229622B (en) | Using the communication system and method between hardware device | |
CN110278265A (en) | Processing method, device, storage medium and the electronic equipment of the upper transmitting file of user | |
CN1682202A (en) | data transmission device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20181120 |
|
CF01 | Termination of patent right due to non-payment of annual fee |