CN105491160B - processing method and device for network transmission file - Google Patents

processing method and device for network transmission file Download PDF

Info

Publication number
CN105491160B
CN105491160B CN201610029757.2A CN201610029757A CN105491160B CN 105491160 B CN105491160 B CN 105491160B CN 201610029757 A CN201610029757 A CN 201610029757A CN 105491160 B CN105491160 B CN 105491160B
Authority
CN
China
Prior art keywords
queue
file
acquired
network transmission
confirmed
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.)
Active
Application number
CN201610029757.2A
Other languages
Chinese (zh)
Other versions
CN105491160A (en
Inventor
柏昆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baishi Software (beijing) Co Ltd
Original Assignee
Baishi Software (beijing) Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Baishi Software (beijing) Co Ltd filed Critical Baishi Software (beijing) Co Ltd
Priority to CN201610029757.2A priority Critical patent/CN105491160B/en
Publication of CN105491160A publication Critical patent/CN105491160A/en
Application granted granted Critical
Publication of CN105491160B publication Critical patent/CN105491160B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

the invention discloses a processing method and a processing device for network transmission files, relates to the technical field of software development, and aims to solve the problem that errors occur in reading file contents in file transmission in the prior art. The method comprises the following steps: storing a network transmission file to be acquired into a first queue, wherein the first queue comprises a file name and the last modification time of the network transmission file to be acquired; confirming whether a second queue is an empty queue or not, wherein the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed; and traversing the second queue if the second queue is a non-empty queue, confirming whether the last modification time of the file to be confirmed included in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, and if so, confirming that the file to be confirmed is not successfully acquired.

Description

Processing method and device for network transmission file
Technical Field
The invention relates to the technical field of software development, in particular to a method and a device for processing network transmission files.
Background
A file transfer is the transfer of a file or a part thereof from one computer system to another. File transfers may be transferring a file to another computer for storage, or accessing a file on a remote computer, or transferring a file to another computer for execution (as a program) or processing (as data), or transferring a file to a printer for printing.
in the prior art, a File is generally transmitted through protocols such as FTP (File Transfer Protocol, chinese abbreviation: File Transfer Protocol), HTTP (Hyper Text Transfer Protocol, chinese abbreviation: hypertext Transfer Protocol), and the like, and after the File is transmitted to a server, a program on the server can read the File to complete transmission service processing, and the transmission mode is asynchronous transmission. In the above transmission method, since the program on the server cannot determine whether the asynchronously transmitted file is completely transmitted, and directly reading the file may read the file being written, the content of the read file may be incorrect.
disclosure of Invention
The embodiment of the invention provides a processing method and a processing device for network transmission files, which are used for solving the problem that errors occur in reading file contents in file transmission in the prior art.
The embodiment of the invention provides a method for processing network transmission files, which comprises the following steps:
Storing a network transmission file to be acquired into a first queue, wherein the first queue comprises a file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired;
confirming whether a second queue is an empty queue or not, wherein the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed;
and traversing the second queue if the second queue is a non-empty queue, confirming whether the last modification time of the file to be confirmed included in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, and if so, confirming that the file to be confirmed is not successfully acquired.
preferably, the method further comprises the following steps:
And if the second queue is an empty queue, confirming the last modification time of the network transmission file to be acquired in the first queue, and transmitting the network transmission file to be acquired with the minimum time difference to the second queue.
preferably, the method further comprises the following steps:
and if the last modification time of the file to be confirmed in the second queue is different from the last modification time of the network transmission file to be acquired in the first queue, confirming that the file to be confirmed is successfully acquired.
An embodiment of the present invention further provides a device for processing a network transmission file, including:
the device comprises a storage unit, a first queue and a second queue, wherein the storage unit is used for storing the network transmission file to be acquired into the first queue, and the first queue comprises the file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired;
The device comprises a first confirming unit, a second confirming unit and a control unit, wherein the first confirming unit is used for confirming whether a second queue is an empty queue or not, and the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed;
And a second confirming unit, configured to traverse the second queue if the second queue is a non-empty queue, confirm whether a last modification time of the to-be-confirmed file included in the second queue is the same as a last modification time of the to-be-acquired network transmission file in the first queue, and confirm that the to-be-confirmed file is not successfully acquired if the last modification time is the same.
Preferably, the first confirmation unit is further configured to:
And if the second queue is an empty queue, confirming the last modification time of the network transmission file to be acquired in the first queue, and transmitting the network transmission file to be acquired with the minimum time difference to the second queue.
preferably, the second confirmation unit is further configured to:
And if the last modification time of the file to be confirmed in the second queue is different from the last modification time of the network transmission file to be acquired in the first queue, confirming that the file to be confirmed is successfully acquired.
in the embodiment of the invention, a network transmission file to be acquired is stored in a first queue, wherein the first queue comprises the file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired; confirming whether a second queue is an empty queue or not, wherein the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed; and traversing the second queue if the second queue is a non-empty queue, confirming whether the last modification time of the file to be confirmed included in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, and if so, confirming that the file to be confirmed is not successfully acquired. In the above embodiment, because the second queue of the file to be confirmed is added on the basis of the existing transmission, the network transmission file to be acquired, which cannot be judged whether the transmission is completed, is temporarily stored in the second queue of the file to be confirmed, and the transmission of the network transmission file to be acquired is further judged whether the transmission is completed subsequently by comparing the last modification time of the file in the second queue of the file to be confirmed.
drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
fig. 1 is a schematic flow chart illustrating a processing method for network transmission files according to an embodiment of the present invention;
Fig. 2 is a schematic structural diagram of a device for processing network-transmitted files according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart illustrating a processing method for network transmission files according to an embodiment of the present invention, where the method is at least applicable to software development.
as shown in fig. 1, a method for processing a network transmission file according to an embodiment of the present invention includes the following steps:
step 101, storing a network transmission file to be acquired into a first queue, wherein the first queue comprises a file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired;
step 102, confirming whether a second queue is an empty queue or not, wherein the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed;
Step 103, if the second queue is a non-empty queue, traversing the second queue, determining whether the last modification time of the file to be determined included in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, and if so, determining that the file to be determined is not successfully acquired.
in step 101, a process flow for reading the network transmission file to be acquired includes file names and last modification times of all network transmission files in the directory to be acquired, and all files in the directory to be acquired are stored in a first queue, where the first queue includes the file names of the network transmission files to be acquired and the last modification times of the network transmission files to be acquired.
It should be noted that the last modification time of the network transmission file to be acquired is a time corresponding to when the network transmission file in each directory to be acquired is stored in the first queue.
In the embodiment of the invention, the problem that the content of the read file is wrong due to the fact that the file is directly read in the asynchronous transmission in the prior art is avoided. And the server reads the last modification time of the network transmission file to be acquired by adopting a polling mode to judge whether the network transmission file to be acquired is received.
Specifically, in step 102, a second queue is created, wherein the second queue comprises the file name of the file to be confirmed and the last modification time of the file to be confirmed.
in the server polling process, it is necessary to determine whether the second queue is an empty queue, and if the second queue is a non-empty queue, the second queue includes the file to be determined. Further, it is necessary to determine whether the file to be confirmed has completed transmission according to the last modification time of the file to be confirmed included in the second queue.
specifically, when the second queue is a non-empty queue, traversing the second queue, determining the last modification time of all files to be determined included in the second queue, and according to the last modification time of all files to be determined in the second queue, determining whether the last modification time of all files to be determined in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, if the last modification time of the file to be determined in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, determining that the file to be determined is not successfully acquired, and re-placing the network transmission file which is not successfully acquired into the first queue to wait for the next acquisition; if the last modification time of the file to be confirmed in the second queue is different from the last modification time of the file to be transmitted in the first queue, it can be confirmed that the file to be confirmed in the second queue has been successfully acquired, and the network file which is successfully acquired can be deleted from the second queue.
Further, if the second queue is an empty queue, all the network transmission files to be acquired in the first queue may be sorted according to the last modification time, and a certain network transmission file to be acquired or a plurality of network transmission files to be acquired having the smallest time difference with the current time may be transmitted to the second queue.
In the embodiment of the present invention, if the file to be confirmed stored in the second queue is a certain network transmission file to be acquired in the first queue, which has a minimum time difference with the current time, the other network transmission files to be acquired may be read from the first queue, where it should be noted that the "other network transmission files to be acquired" is a file other than the certain network transmission file to be acquired stored in the second queue.
Further, after all the other network transmission files to be acquired in the first queue have confirmed that the acquisition is successful, if the last modification time of a certain network transmission file to be acquired in the first queue stored in the second queue, which has the smallest time difference with the current time, is still consistent with the last modification time of the network transmission file to be acquired stored in the first queue, the certain network transmission file to be acquired in the first queue stored in the second queue, which has the smallest time difference with the current time, is continuously stored in the first queue, and it is waited for the next time to confirm whether the network transmission file to be acquired is successfully acquired.
In the embodiment of the present invention, according to the processing flow, all the network transmission files to be acquired in the first queue may be successively and successfully acquired by a polling method.
based on the same inventive concept, embodiments of the present invention provide a processing apparatus for network transmission files, and because the principle of the apparatus for solving the technical problem is similar to a method for acquiring network transmission files, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not repeated.
as shown in fig. 2, a schematic structural diagram of a processing apparatus for network file transmission according to an embodiment of the present invention includes: a storage unit 201, a first validation unit 202 and a second validation unit 203.
A storage unit 201, configured to store a network transmission file to be acquired into a first queue, where the first queue includes a file name of the network transmission file to be acquired and a last modification time of the network transmission file to be acquired;
A first confirming unit 202, configured to confirm whether a second queue is an empty queue, where the second queue includes a file name of a file to be confirmed and a last modification time of the file to be confirmed;
a second determining unit 203, configured to traverse the second queue if the second queue is a non-empty queue, determine whether a last modification time of the to-be-determined file included in the second queue is the same as a last modification time of the to-be-obtained network transmission file in the first queue, and if so, determine that the to-be-determined file is not successfully obtained.
preferably, the first confirmation unit 202 is further configured to:
And if the second queue is an empty queue, confirming the last modification time of the network transmission file to be acquired in the first queue, and transmitting the network transmission file to be acquired with the minimum time difference to the second queue.
preferably, the second confirming unit 203 is further configured to:
And if the last modification time of the file to be confirmed in the second queue is different from the last modification time of the network transmission file to be acquired in the first queue, confirming that the file to be confirmed is successfully acquired.
It should be understood that the above processing apparatus for network transmission files includes only logical partitions according to the functions implemented by the device apparatus, and in practical applications, the above units may be stacked or split. The functions implemented by the processing apparatus for network transmission files provided in this embodiment correspond to the processing method for network transmission files provided in the above embodiment one to one, and for a more detailed processing flow implemented by the apparatus, detailed description is already made in the above method embodiment, and detailed description is not given here.
as will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (2)

1. a processing method for network transmission files is characterized by comprising the following steps:
Storing a network transmission file to be acquired into a first queue, wherein the first queue comprises a file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired;
Confirming whether a second queue is an empty queue or not, wherein the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed;
if the second queue is a non-empty queue, traversing the second queue, confirming whether the last modification time of the file to be confirmed included in the second queue is the same as the last modification time of the network transmission file to be acquired in the first queue, and if so, confirming that the file to be confirmed is not successfully acquired;
If the second queue is an empty queue, confirming the last modification time of the network transmission file to be acquired in the first queue, and transmitting the network transmission file to be acquired with the smallest time difference with the current time difference into the second queue;
if the last modification time of the file to be confirmed included in the second queue is different from the last modification time of the network transmission file to be acquired in the first queue, confirming that the file to be confirmed is successfully acquired;
the server reads the last modification time of the network transmission file to be acquired by adopting a polling mode to judge whether the network transmission file to be acquired is received;
In the server polling process, whether the second queue is an empty queue needs to be confirmed, if the second queue is a non-empty queue, the second queue comprises files to be confirmed; further, it is necessary to determine whether the file to be confirmed has completed transmission according to the last modification time of the file to be confirmed included in the second queue;
If the last modification time of the file to be confirmed in the second queue is different from the last modification time of the file to be transmitted in the first queue, the file to be confirmed in the second queue can be confirmed to be successfully acquired, and the successfully acquired network file can be deleted from the second queue;
the last modification time of the network transmission file to be acquired is the time corresponding to the time when the network transmission file in each directory to be acquired is stored in the first queue.
2. A device for processing a network-transmitted file, comprising:
The device comprises a storage unit, a first queue and a second queue, wherein the storage unit is used for storing the network transmission file to be acquired into the first queue, and the first queue comprises the file name of the network transmission file to be acquired and the last modification time of the network transmission file to be acquired;
the device comprises a first confirming unit, a second confirming unit and a control unit, wherein the first confirming unit is used for confirming whether a second queue is an empty queue or not, and the second queue comprises the file name of a file to be confirmed and the last modification time of the file to be confirmed;
A second determining unit, configured to traverse the second queue if the second queue is a non-empty queue, determine whether a last modification time of the to-be-determined file included in the second queue is the same as a last modification time of the to-be-obtained network transmission file in the first queue, and if the last modification time is the same, determine that the to-be-determined file is not successfully obtained;
The first validation unit is further configured to: if the second queue is an empty queue, confirming the last modification time of the network transmission file to be acquired in the first queue, and transmitting the network transmission file to be acquired with the smallest time difference with the current time difference into the second queue;
The second validation unit is further configured to: if the last modification time of the file to be confirmed included in the second queue is different from the last modification time of the network transmission file to be acquired in the first queue, confirming that the file to be confirmed is successfully acquired;
The server reads the last modification time of the network transmission file to be acquired by adopting a polling mode to judge whether the network transmission file to be acquired is received;
In the server polling process, whether the second queue is an empty queue needs to be confirmed, if the second queue is a non-empty queue, the second queue comprises files to be confirmed; further, it is necessary to determine whether the file to be confirmed has completed transmission according to the last modification time of the file to be confirmed included in the second queue;
if the last modification time of the file to be confirmed in the second queue is different from the last modification time of the file to be transmitted in the first queue, the file to be confirmed in the second queue can be confirmed to be successfully acquired, and the successfully acquired network file can be deleted from the second queue;
the last modification time of the network transmission file to be acquired is the time corresponding to the time when the network transmission file in each directory to be acquired is stored in the first queue.
CN201610029757.2A 2016-01-01 2016-01-01 processing method and device for network transmission file Active CN105491160B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610029757.2A CN105491160B (en) 2016-01-01 2016-01-01 processing method and device for network transmission file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610029757.2A CN105491160B (en) 2016-01-01 2016-01-01 processing method and device for network transmission file

Publications (2)

Publication Number Publication Date
CN105491160A CN105491160A (en) 2016-04-13
CN105491160B true CN105491160B (en) 2019-12-17

Family

ID=55677870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610029757.2A Active CN105491160B (en) 2016-01-01 2016-01-01 processing method and device for network transmission file

Country Status (1)

Country Link
CN (1) CN105491160B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0770964A1 (en) * 1995-10-26 1997-05-02 Matsushita Electric Industrial Co., Ltd. File system
CN103473076A (en) * 2013-09-25 2013-12-25 中国联合网络通信集团有限公司 Issuing method and issuing system for code version
CN105183749A (en) * 2015-07-13 2015-12-23 北京奇虎科技有限公司 Method and device for crawling promotion content and providing crawled promotion content for use in search
CN105187533A (en) * 2015-09-10 2015-12-23 浪潮软件股份有限公司 Data transmission method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0770964A1 (en) * 1995-10-26 1997-05-02 Matsushita Electric Industrial Co., Ltd. File system
CN103473076A (en) * 2013-09-25 2013-12-25 中国联合网络通信集团有限公司 Issuing method and issuing system for code version
CN105183749A (en) * 2015-07-13 2015-12-23 北京奇虎科技有限公司 Method and device for crawling promotion content and providing crawled promotion content for use in search
CN105187533A (en) * 2015-09-10 2015-12-23 浪潮软件股份有限公司 Data transmission method and device

Also Published As

Publication number Publication date
CN105491160A (en) 2016-04-13

Similar Documents

Publication Publication Date Title
CN112000355B (en) Method and device for firmware upgrading and household appliance
CN108108127B (en) File reading method and system
CN110493342B (en) File transmission method and device, electronic equipment and readable storage medium
CN102165739B (en) Reliable reception of messages written via RDMA using hashing
CN112822260B (en) File transmission method and device, electronic equipment and storage medium
CN104079623B (en) Multistage cloud storage synchronisation control means and system
CN109800005A (en) A kind of hot update method of client and device
CN111984733A (en) Data transmission method and device based on block chain and storage medium
CN108038127B (en) Data synchronization method, device, terminal equipment and storage medium
US20160301763A1 (en) Network data transmission method, device and system
CN105491160B (en) processing method and device for network transmission file
CN105656980A (en) File processing method, device and system
CN109542917B (en) Data reading method and computer readable medium
CN111147226B (en) Data storage method, device and storage medium
US20120331037A1 (en) Validating download success
RU2698766C1 (en) Method and device for transmitting, sending and receiving information
CN113672776B (en) Fault analysis method and device
US20240012831A1 (en) Data exchange method and apparatus, readable storage medium, and data exchange system
CN110677497B (en) Network medium distribution method and device
CN107071548B (en) Video processing method and system
CN114138786A (en) Method, device, medium, product and equipment for duplicate removal of online transaction message
CN113282475A (en) Method and device for evaluating interactive performance of interactive system
CN107026888B (en) Large-capacity data transmission device and method
CN110597766A (en) Data transmission method and device
CN116436836B (en) Domain name data synchronous detection method, device and equipment

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
DD01 Delivery of document by public notice

Addressee: BAISHI SOFTWARE (BEIJING) Co.,Ltd. Person in charge of patents

Document name: payment instructions