問題描述
我想建立一個 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 - 以編程方式確定剩余時間或傳輸字節的方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!