简体   繁体   中英

The client side listeners of the Apache mina FtpServer

Trying to implement a FTP server/client using the mina framework. Now the server side of it all is very easy and very well explained. How to make it a standalone windows service and what not.

But I'm having a very hard time discovering information about the client whether it would suit my needs or not. What I need, is for the client to check whether a file appears on the ftp directory in a certain folder, if it does, download it. After download finished, do something with the file. At the same time the client will also have to upload a file. All automatically. now I was thinking of making a java application with threads running. One thread for the uploading when conditions were met while another thread for the checking if file was available. So periodically check if a file was available, and if so download it. I would however like it, if there were another way? Without having to 'poll' every other minute or so? Is it possible or am I just wishful thinking?

Also, I have looked around to how to exactly implement the client and am having a bit trouble finding documentation about it and placing it a bit as well. From what I have gathered, now don't shoot if it's wrong, but the client will be a standard Java application having access to the functionalities using the jars and what not of the framework right?

I'm not aware of Apache Mina having an FTP client. The Apache project already has an FTP client in the Apache Commons Net library.

As for your approach, it seems like it will work just fine. The alternative would be for your client application to have a callback mechanism that the server could call when it detects that a new file appears. I'd recommend you do the polling first, and if you see that it's a problem then try the callback approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM