发现java库的一个错误

| | Comments (0)
好久以前写的FTP搜索的spider程序,今天拿出来部署,结果运行通不过。分析了一下,是其中的改变目录的cd函数(sun.net.ftp.FtpClient类的)不能正确运行,于是自己开了serv-u,然后逐条分析cd函数的运行过程,执行过程是这样的:
[2] Sun 11Sep05 20:11:57 - (000004) CWD /机器人/遥控机器人_10184314/ [6] Sun 11Sep05 20:11:57 - (000004) 250 Directory changed to /机器人/遥控机器人_10184314 [2] Sun 11Sep05 20:11:57 - (000004) EPSV ALL [6] Sun 11Sep05 20:11:57 - (000004) 500 'EPSV': command not understood. [2] Sun 11Sep05 20:11:57 - (000004) PASV [6] Sun 11Sep05 20:11:57 - (000004) 227 Entering Passive Mode (192,168,205,215,10,108) [2] Sun 11Sep05 20:11:57 - (000004) LIST

总共是执行四条FTP指令,分别是CWD,EPSV ALL,PASV,LIST.
问题就出在"EPSV ALL"和"PASV"上,并不是所有的FTP服务器都支持这两条指令,例如我的机器就不支持"EPSV ALL",所以导致了连接上出错。

后来仔细研究了ftpclient的各个函数,发现每条之行完之后都会执行一次"EPSV ALL"和"PASV",这是函数执行出错的根本原因!

研究了一个晚上,还没有解决方案,待续~~

2005-12-6补注
时间有点久了,注释一下吧。后来我换了一个第三方库,把代码重新写了一遍,问题解决了。

// added in sep.15th 2005
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;

Leave a comment

About this Entry

This page contains a single entry by 空空 published on September 11, 2005 8:09 PM.

无聊 was the previous entry in this blog.

what is life? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01