用于Java的Apache FTPClient显示已运行的FTP命令 [英] Apache FTPClient for Java show FTP Commands that were run

查看:754
本文介绍了用于Java的Apache FTPClient显示已运行的FTP命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我正在使用Apache Commons FTP客户端,并且我想显示FTP客户端使用的FTP命令,当我使用changeWorkingDirectory时,它应该向我显示它使用的FTP命令:CODEOFCOMMAND CHD .....



或者当我上传一个文件时,它会显示我:CODEOFCOMMAND PUT ....



有没有可能要做到这一点?

解决方案

您可以在 Apache Commons Net常见问题解答

问:我如何调试FTP应用程序?

b
$ b

答:您可以添加一个协议命令侦听器;例如:

  ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out),true)); 


Hello I am using Apache Commons FTP Client and I want to show the FTP Commands that the FTP Client uses so like when I use changeWorkingDirectory it should show me the FTP Command that it used like: CODEOFCOMMAND CHD .....

or when I upload a File it should show me: CODEOFCOMMAND PUT ....

Is there any possibility to do this ?

解决方案

You can find it in the Apache Commons Net FAQ :

Q: How do I debug FTP applications?

A: You can add a protocol command listener; for example:

ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));

这篇关于用于Java的Apache FTPClient显示已运行的FTP命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆