问题描述
我想建立一个 FTP 连接(最好使用 Coldfusion 8,但 Java 也可以),它将文件复制到远程服务器.
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.
这可能吗?如果是的话,您会推荐什么 FTP API,因为我了解 Sun 的实现可能有点欠缺.
Is this possible, and if so what FTP API would you recommend as I understand the Sun implementation may be a bit lacking.
提前致谢!
PS:在传输文件时,我可以让另一个进程/线程通过 Web 服务调用轮询目标计算机上的文件大小,但这并不理想.通过 FTP API 获取它是最好的解决方案.
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.
推荐答案
这个关于 CodeRanch 的讨论 包含的片段展示了如何结合 Apache commons FtpClient 实现进度监视器.
This discussion on CodeRanch includes snippets that show how a progress monitor can be implemented in conjunction with Apache commons FtpClient.
这篇关于FTP - 以编程方式确定剩余时间或传输字节的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!