[go: up one dir, main page]

CN106790709B - Ftp file transmission method and ftp client based on asynchronization read-write - Google Patents

Ftp file transmission method and ftp client based on asynchronization read-write Download PDF

Info

Publication number
CN106790709B
CN106790709B CN201710113945.8A CN201710113945A CN106790709B CN 106790709 B CN106790709 B CN 106790709B CN 201710113945 A CN201710113945 A CN 201710113945A CN 106790709 B CN106790709 B CN 106790709B
Authority
CN
China
Prior art keywords
read
ftp
write
file
message
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
CN201710113945.8A
Other languages
Chinese (zh)
Other versions
CN106790709A (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.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies 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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201710113945.8A priority Critical patent/CN106790709B/en
Publication of CN106790709A publication Critical patent/CN106790709A/en
Application granted granted Critical
Publication of CN106790709B publication Critical patent/CN106790709B/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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of ftp file transmission methods and ftp client based on asynchronization read-write, are related to FTP field of configuration.Steps of the method are: the ftp file information that ftp client is read and write as needed is locally obtaining ftp file size;Ftp file is divided into several read-write data blocks according to file size;Ftp client sends asynchronous file read-write requests message to message-driven frame, and message-driven frame obtains reading writing working thread in the thread pool pre-set;Using reading writing working thread, the data block for needing to read and write in ftp file is read according to asynchronous file read-write requests message.The present invention can will not influence the basic function of FTP, perfectly realize the software frame that FTP is included in message-driven type, be very suitable for promoting while guaranteeing message-driven frame high efficiency.

Description

Ftp file transmission method and ftp client based on asynchronization read-write
Technical field
The present invention relates to FTP field of configuration, and in particular to it is a kind of based on asynchronization read-write ftp file transmission method and Ftp client.
Background technique
In current data communication equipment, in order to improve the modularization and operational efficiency of software, kernel software is general All over the software frame using message-driven type.In order to realize basic Network Management Function, FTP (File Transfer Protocol, File Transfer Protocol) usually as a most basic software feature demand.However, FTP is included in message-driven When the software frame of type, there are the problem of are as follows: FTP belongs to file read-write intensive protocols, due to ftp file IO (input it is defeated Inefficient time-consuming (because ftp file is larger, generally 100M or so) of operation out), therefore FTP is included in message-driven frame Afterwards, the efficiency of frame entirety scheduling can be reduced by transmitting entire biggish ftp file, resulted even in other program assemblies and be difficult to just Often work.
All the time, the contradiction between the whole high efficiency of the inefficient and platform of file operation is all one more scabrous Problem.Based on this point and in order to avoid the above problem, current most software platform is abandoned FTP carrying out asynchronization It realizes, and the realization of FTP is placed in except message-driven frame, the destruction of software platform globality certainly will be will cause, Er Qiefu Miscellaneous communication mechanism can make the availability of software worse and worse.
Summary of the invention
In view of the deficiencies in the prior art, present invention solves the technical problem that are as follows: how guarantee message-driven frame FTP, is included in the software frame of message-driven type by frame high efficiency and on the basis of will not influence the basic function of FTP.
To achieve the above objectives, the ftp file transmission method provided by the invention based on asynchronization read-write, including following step It is rapid:
The ftp file information that step A:FTP client is read and write as needed is locally obtaining ftp file size;According to text Ftp file is divided into several read-write data blocks by part size, and the size of each read-write data block is 4k~2M, goes to step B;
Step B:FTP client sends asynchronous file read-write requests message to message-driven frame, and message-driven frame exists Reading writing working thread is obtained in the thread pool pre-set;Using reading writing working thread, disappeared according to asynchronous file read-write requests Breath reads the data block for needing to read and write in ftp file, goes to step C;
Step C: after the completion of data block read-write, ftp client judges whether to need to continue to read and write data block, if so, again Step B is executed, is otherwise terminated.
The ftp client based on asynchronization read-write provided by the invention for realizing the above method, including ftp file transmit mould Block, local file storage module, message-driven type frame and thread pool resource operation module;
Ftp file transmission module is used for: the ftp file information read and write as needed obtains in local file storage module Take ftp file size;Ftp file is divided into several read-write data blocks, the size of each read-write data block according to file size For 4k~2M;When needing to read and write data block, asynchronous file read-write requests message is sent to message-driven type frame;Receive message drive After message is completed in the read-write that ejector half frame is sent, if desired continues to read and write data block, then sent again to message-driven type frame Asynchronous file read-write requests message;
Local file storage module is used for: in locally-stored ftp file;
Message-driven type frame sends asynchronous file and is used for: the asynchronous file read-write that ftp file transmission module is sent is asked Message is asked to be forwarded to thread pool resource operation module;Message is completed in the read-write that thread pool resource operation module returns to be forwarded to Ftp file transmission module;
Thread pool resource operation module is used for: thread pool is pre-configured with, after receiving asynchronous file read-write requests message, pre- Reading writing working thread is obtained in the thread pool first set, reading writing working thread is read according to asynchronous file read-write requests message The data block for needing to read and write in ftp file reads and returns to read-write completion message to message-driven type frame after completing.
Compared with the prior art, the advantages of the present invention are as follows:
Referring to step A it is found that ftp file is sliced as several data blocks by the present invention, the size of each data block be 4k~ 2M;Compared with entire ftp file in the prior art, transmission data block of the present invention to FTP service end, data block is much smaller than entire Ftp file.Therefore, the present invention can guarantee the efficient performance of message-driven frame;And referring to step C it is found that data block The driving all in accordance with ftp client is read and write and sent to trigger, actual read-write operation is undertaken by independent thread, message-driven Frame only needs normally to realize that asynchronous message is distributed.
In view of this, the present invention can will not influence the basic training of FTP while guaranteeing message-driven frame high efficiency Can, the software frame that FTP is included in message-driven type is perfectly realized, is very suitable for promoting.
At the same time, the present invention reads and writes and transmits every time 1 data block, further ensures the efficient of message-driven frame Performance.
Detailed description of the invention
Fig. 1 is the flow chart of the ftp file transmission method based on asynchronization read-write in the embodiment of the present invention;
Fig. 2 is that the signal of the ftp client based on asynchronization read-write in the embodiment of the present invention connects block diagram;
Fig. 3 is the finite state machine design schematic diagram of ftp client in the embodiment of the present invention;
Fig. 4 is the flow chart that FTP order is encapsulated with the mode of Restful API.
Specific embodiment
Invention is further described in detail with reference to the accompanying drawings and embodiments.
It is shown in Figure 1, the ftp file transmission method based on asynchronization read-write in inventive embodiments, including following step It is rapid:
S1: user specifies on ftp client needs the ftp file information read and write, ftp file information include filename and File stores path, goes to S2.
S2:FTP client is locally obtaining the information such as the size of ftp file according to ftp file information;It is big according to file Small to be written and read slice to ftp file as several read-write data blocks, the size of each read-write data block is 4k~2M, goes to S3.
S3:FTP client sends asynchronous file read-write requests message to message-driven frame, and asynchronous file read-write requests disappear Breath includes ftp file, the data for needing the data block read and write label (reading at least 1 piece of data block every time) and needs to read and write Block size goes to S4.
S4: message-driven frame obtains reading writing working thread in the thread pool pre-set, utilizes reading writing working line Journey reads the data block (reading 1 piece of data block every time) for needing to read and write in ftp file according to asynchronous file read-write requests message, Go to S5.
S5: the data block that message-driven frame completes read-write is transmitted to ftp client, the number that ftp client will receive It is transmitted to FTP service end according to block, FTP service end writing data blocks go to S6.
S6:FTP client judges whether to need to continue to read and write data block according to the actual situation otherwise to tie if going to S3 Beam.
It is shown in Figure 2, the ftp client based on asynchronization read-write of the realization above method in the embodiment of the present invention, Including ftp file transmission module, local file storage module, message-driven type frame and thread pool resource operation module.
Ftp file transmission module is used for:
(1) the ftp file information (including filename and file storage path) read and write as needed, stores in local file Ftp file size is obtained in module;Ftp file is divided into several read-write data blocks, each read-write data according to file size The size of block is 4k~2M;
(2) when needing to read and write data block, asynchronous file read-write requests message, asynchronous file are sent to message-driven type frame Read-write requests message includes ftp file, 1 data block size for needing the data block read and write label and needing to read and write.
(3) after the read-write completion message for receiving the transmission of message-driven type frame, if desired continue to read and write data block, then again Start-up operation process (2).
(4) control connection and data connection are established according to standard agreement with FTP service end, receives message-driven type frame hair After message is completed in the read-write sent, by the transmission of data blocks of read-write completion to FTP service end.
FTP service end is used for: the data block of write-in ftp file transmission module transmission.
Local file storage module is used for: in locally-stored ftp file.
Message-driven type frame sends asynchronous file and is used for: the asynchronous file read-write that ftp file transmission module is sent is asked Message is asked to be forwarded to thread pool resource operation module;Message is completed in the read-write that thread pool resource operation module returns to be forwarded to Ftp file transmission module.
Thread pool resource operation module is used for: thread pool is pre-configured with, after receiving asynchronous file read-write requests message, pre- Reading writing working thread is obtained in the thread pool first set, reading writing working thread is read according to asynchronous file read-write requests message The data block for needing to read and write in ftp file reads and returns to read-write completion message to message-driven type frame after completing.
It, can be corresponding for ftp client design of the invention in order to preferably play the advantage of message-driven type frame Finite state machine makes the realization of FTP itself more suit asynchronization platform.Finite state machine is used for: according to the feelings of actual platform Ftp client is carried out state decomposition by condition, to realize the event-driven of protocol realization part;Due to specific finite state Machine is related with software platform, is not detailed here, can increase more sub- states according to the actual situation, reduce the realization of state machine Difficulty.
It participates in shown in Fig. 3, the workflow of finite state machine in the embodiment of the present invention are as follows:
Step 1: finite state machine initialization goes to step 2, if exception is established in connection, re-execute the steps one.
Step 2: establishing TCP connection, judges whether user log-in authentication succeeds, if going to step 3, otherwise holds again Row step 1.
Step 3: foundation control connection to execute basic control command, goes to step 4, if control connection appearance is different Often, then it re-execute the steps one.
Step 4: establishing data connection, to execute the transmission of file data, if exception occurs in data connection, holds again Row step 1.
By above-mentioned file read-write fragmentation, asynchronization and the design of finite state machine, can be driven not sacrificing message Under the premise of moving platform performance, FTP is included in the unified management of platform, and ensures the basic function of FTP.This method can be accelerated The unitized Evolution Tendency of software frame.
It is shown in Figure 4, the present invention by platform function, additionally it is possible to by the relevant operation of ftp client with Restful The mode of API is encapsulated and is externally provided, and remote user can be realized by the interface and be remotely operated.
Further, the present invention is not limited to the above-described embodiments, for those skilled in the art, Without departing from the principles of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as the present invention Protection scope within.The content being not described in detail in this specification belongs to existing skill well known to professional and technical personnel in the field Art.

Claims (6)

1. a kind of ftp file transmission method based on asynchronization read-write, which is characterized in that method includes the following steps:
The ftp file information that step A:FTP client is read and write as needed is locally obtaining ftp file size;It is big according to file Small that ftp file is divided into several read-write data blocks, the size of each read-write data block is 4k~2M, goes to step B;
Step B:FTP client sends asynchronous file read-write requests message to message-driven frame, and message-driven frame is preparatory Reading writing working thread is obtained in the thread pool set;Using reading writing working thread, read according to asynchronous file read-write requests message The data block for needing to read and write in ftp file is taken, step C is gone to;
Step C: after the completion of data block read-write, ftp client judges whether to need to continue to read and write data block, if so, re-executing Step B, otherwise terminates;
Wherein, asynchronous file read-write requests message described in step B include ftp file, 1 need read and write data block label, And the data block size for needing to read and write.
2. the ftp file transmission method as described in claim 1 based on asynchronization read-write, it is characterised in that: described in step A Ftp file information includes filename and file storage path.
3. as claimed in claim 1 or 2 based on asynchronization read-write ftp file transmission method, it is characterised in that: step B it Further comprising the steps of afterwards: the data block that message-driven frame completes read-write is transmitted to FTP service end, the write-in of FTP service end Data block.
4. a kind of ftp client based on asynchronization read-write for realizing any one of claims 1 to 3 the method, feature exist In: the ftp client includes ftp file transmission module, local file storage module, message-driven type frame and thread pool money Source operational module;
Ftp file transmission module is used for: the ftp file information read and write as needed obtains FTP in local file storage module File size;Ftp file is divided into several read-write data blocks according to file size, the size of each read-write data block be 4k~ 2M;When needing to read and write data block, asynchronous file read-write requests message is sent to message-driven type frame;Receive message-driven type frame After message is completed in the read-write that frame is sent, if desired continues to read and write data block, then send asynchronous text to message-driven type frame again Part read-write requests message;
Local file storage module is used for: in locally-stored ftp file;
Message-driven type frame sends asynchronous file and is used for: the asynchronous file read-write requests that ftp file transmission module is sent are disappeared Breath is forwarded to thread pool resource operation module;Message is completed into the read-write that thread pool resource operation module returns and is forwarded to FTP text Part transmission module;
Thread pool resource operation module is used for: being pre-configured with thread pool, after receiving asynchronous file read-write requests message, is set in advance Reading writing working thread is obtained in the thread pool set, reading writing working thread reads FTP text according to asynchronous file read-write requests message The data block for needing to read and write in part reads and returns to read-write completion message to message-driven type frame after completing;
The asynchronous file read-write requests message that the ftp file transmission module is sent to message-driven type frame, including FTP text Part, 1 data block size for needing the data block read and write label and needing to read and write.
5. the ftp client as claimed in claim 4 based on asynchronization read-write, it is characterised in that: the ftp file transmits mould Ftp file information in block includes filename and file storage path.
6. the ftp client as described in claim 4 or 5 based on asynchronization read-write, it is characterised in that: the ftp file passes After message is completed in the read-write that defeated module receives the transmission of message-driven type frame, by the transmission of data blocks of read-write completion to FTP service End.
CN201710113945.8A 2017-02-28 2017-02-28 Ftp file transmission method and ftp client based on asynchronization read-write Active CN106790709B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710113945.8A CN106790709B (en) 2017-02-28 2017-02-28 Ftp file transmission method and ftp client based on asynchronization read-write

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710113945.8A CN106790709B (en) 2017-02-28 2017-02-28 Ftp file transmission method and ftp client based on asynchronization read-write

Publications (2)

Publication Number Publication Date
CN106790709A CN106790709A (en) 2017-05-31
CN106790709B true CN106790709B (en) 2019-09-17

Family

ID=58960106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710113945.8A Active CN106790709B (en) 2017-02-28 2017-02-28 Ftp file transmission method and ftp client based on asynchronization read-write

Country Status (1)

Country Link
CN (1) CN106790709B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108933805A (en) * 2017-05-26 2018-12-04 武汉斗鱼网络科技有限公司 A kind of document transmission method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1320874A (en) * 2001-05-25 2001-11-07 清华大学 Program mining method and system in network environment
CN101136791A (en) * 2006-11-16 2008-03-05 中兴通讯股份有限公司 A Network Throughput Testing Method Based on File Transfer Protocol
CN102811258A (en) * 2012-07-27 2012-12-05 北京星网锐捷网络技术有限公司 Data parallel-downloading method, apparatus and network device
US8478865B2 (en) * 2007-10-09 2013-07-02 Cleversafe, Inc. Systems, methods, and apparatus for matching a connection request with a network interface adapted for use with a dispersed data storage network
CN103442037A (en) * 2013-08-09 2013-12-11 华南理工大学 Method for achieving multithreading breakpoint upload of oversized file based on FTP

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1320874A (en) * 2001-05-25 2001-11-07 清华大学 Program mining method and system in network environment
CN101136791A (en) * 2006-11-16 2008-03-05 中兴通讯股份有限公司 A Network Throughput Testing Method Based on File Transfer Protocol
US8478865B2 (en) * 2007-10-09 2013-07-02 Cleversafe, Inc. Systems, methods, and apparatus for matching a connection request with a network interface adapted for use with a dispersed data storage network
CN102811258A (en) * 2012-07-27 2012-12-05 北京星网锐捷网络技术有限公司 Data parallel-downloading method, apparatus and network device
CN103442037A (en) * 2013-08-09 2013-12-11 华南理工大学 Method for achieving multithreading breakpoint upload of oversized file based on FTP

Also Published As

Publication number Publication date
CN106790709A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN105354237B (en) A business data display method
US20240220751A1 (en) Electronic shelf label communication system and method
US20190220384A1 (en) Method, device, and computer readable medium for tracing computing system
CN107423404A (en) Flow instance data synchronizing processing method and device
CN111680078B (en) Multi-screen data control method and system during aircraft flight simulation demonstration
CN107453953B (en) Httpclient-based data updating system and method
CN111435937A (en) Refreshing method and device for monitoring platform
CN112035441A (en) Batch processing method and device for account information
CN113852610B (en) Message processing method, device, computer equipment and storage medium
CN106888264B (en) Data exchange method and device
CN106790709B (en) Ftp file transmission method and ftp client based on asynchronization read-write
CN115185919A (en) Log playback method, supercharging test method and device and computer equipment
CN101360060A (en) A processing unit and data sending/receiving method for realizing data interaction between systems
CN116074360B (en) Firmware data processing method, device, storage medium and electronic device
CN103220260B (en) The more method of new data, server, client and system
CN110022323A (en) A kind of method and system of the cross-terminal real-time, interactive based on WebSocket and Redux
CN105302789A (en) Editing method of health information shared document template buffer storage
CN113608986A (en) Method and device for testing performance of mainframe
CN104104969B (en) Video interception method and device
CN115314487B (en) Data storage method and related device for reliable transmission
Pandey et al. An automation framework for benchmarking and optimizing performance of remote desktops in the cloud
CN116305840B (en) A data interaction management platform for virtual reality servers
CN105592097B (en) A kind of client-based asynchronous interactive information approach
CN104317906A (en) Processing method for large-scale storage of reported data of GPS (global positioning system) monitoring radios
CN105357243B (en) A kind of method and apparatus with internet of things equipment remote interaction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant