views:

90

answers:

2

Hi all

I want to make an FTP connection (ideally using Coldfusion 8, but Java is fine too) that will copy a file to a remote server.

Crucially however, I want to know how many bytes have been transferred so I can give some feedback to the user.

Is this possible, and if so what FTP API would you recommend as I understand the Sun implementation may be a bit lacking.

Thanks in advance!

PS: I could have another process/thread poll the file size on the destination machine via a web service call while the file is being transferred but it's not ideal. Getting it through FTP API would be the neatest solution.

+1  A: 

Some FTP frameworks for Java support progress monitoring. Since I only started looking at these a few days ago, I can't tell you whether this suits your purpose.

There's a review of the different frameworks available here :

http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html?page=1

Here's a comparison table taken from this article:

http://www.javaworld.com/javaworld/jw-04-2003/ftp/jw-0404-ftptable.html

James P.
Thanks but I found those myself earlier. With articles that old I am always wary of the state of the art!
Ciaran Archer
+2  A: 

This discussion on CodeRanch includes snippets that show how a progress monitor can be implemented in conjunction with Apache commons FtpClient.

Stephen C
Like one of the posters on that thread, I would prefer to avoid using a user interface, in fact it'd be happy just to log it to file for now. So, I guess I could just write to an OutputStream manually, byte by byte - that's my option it seems. If so it's very low level, could have preferred to have it handled by the API in some way.
Ciaran Archer
@ciaranarcher - I guess the designers of (for example) FtpClient don't think that your use-case is common enough to be worth supporting in their APIs.
Stephen C
So it seems! Thanks for the tip, you can have the answer too.
Ciaran Archer