Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FileZilla的Java FTP连接问题_Java_Windows_Url_Ftp_Filezilla - Fatal编程技术网

FileZilla的Java FTP连接问题

FileZilla的Java FTP连接问题,java,windows,url,ftp,filezilla,Java,Windows,Url,Ftp,Filezilla,我在本地测试一个简单的JavaURL FTP连接时遇到了一个奇怪的问题。 以下代码片段已删除,请重试/捕获: URL url = new URL("ftp://127.0.0.1/subOne/subTwo/subThree/subFour"); URLConnection conn = url.openConnection(); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); InputStream is = conn.g

我在本地测试一个简单的JavaURL FTP连接时遇到了一个奇怪的问题。 以下代码片段已删除,请重试/捕获:

URL url = new URL("ftp://127.0.0.1/subOne/subTwo/subThree/subFour");
URLConnection conn = url.openConnection();
conn.setConnectTimeout(30000);
conn.setReadTimeout(30000);

InputStream is = conn.getInputStream(); /// And here flies the IOException!
。。。实际的IOException原因是subOne/subTwo/subThree/subfur,但有趣的事情发生在服务器端:

(000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> Connected, sending welcome message...
(000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> 220 Blabla
(000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> USER anonymous
(000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> 331 Password required for anonymous
(000012)23.02.2011 13:01:05 - (not logged in) (127.0.0.1)> PASS *************
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 230 Logged on
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> TYPE I
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 200 Type set to I
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> CWD das
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 250 CWD successful. "/subOne" is current directory.
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> CWD 2011
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 250 CWD successful. "/subOne/subTwo" is current directory.
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> CWD 02
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 250 CWD successful. "/subOne/subTwo/subThree" is current directory.
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> EPSV ALL
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 229 Entering Extended Passive Mode (|||3881|)
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> EPSV
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 229 Entering Extended Passive Mode (|||3882|)
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> RETR subFour
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 550 File not found
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> CWD subOne
(000012)23.02.2011 13:01:05 - anonymous (127.0.0.1)> 550 CWD failed. "/subOne/subTwo/subThree/subOne": directory not found.
(000012)23.02.2011 13:03:06 - anonymous (127.0.0.1)> 421 Connection timed out.
(000012)23.02.2011 13:03:06 - anonymous (127.0.0.1)> disconnected.
我完全不明白,为什么测试人员试图进入扩展被动模式,为什么在无法检索子文件夹后添加子目录

我刚刚安装了FileZilla服务器,并设置了匿名用户和共享驱动器。我通过浏览器和FileZilla客户端检查FTP目录是否可以访问,当然是相同的登录名,仅此而已。 所有设备都在同一台机器上安装和运行

再也不知道了


谢谢你的帮助

这种连接到FTP的方式非常有限,文档也不清楚。我可以先给你一个关于EPSV的答案。连接是由内部实现建立的,在我的JDK中,内部实现恰好是sun.net.www.protocol.ftp.FtpURLConnection

当连接到服务器时,首先尝试EPSV和PASV默认为被动模式,如果无法建立被动模式,则返回主动模式-端口。您可以看到实现细节

解释您的一个问题的基本意见是:

 /**
  * Here is the idea:
  *
  * - First we want to try the new (and IPv6 compatible) EPSV command
  *   But since we want to be nice with NAT software, we'll issue the
  *   EPSV ALL cmd first.
  *   EPSV is documented in RFC2428
  * - If EPSV fails, then we fall back to the older, yet OK PASV command
  * - If PASV fails as well, then we throw an exception and the calling method
  *   will have to try the EPRT or PORT command
  */
至于你的第二个问题。。。检索子文件夹失败。。。嗯,乍一看,它的行为似乎是这样的,因为它是马车。但我现在无法安装正确的环境来验证这一点。此外,你还有一个例外。我猜问题是在第455行尝试再次导航到完整路径时引发的。FTP连接的完整源是

我建议您使用该库进行FTP操作。它的使用更加先进和直接


干杯,如果你愿意,祝你快乐

这种连接到FTP的方式非常有限,文档也不清楚。我可以先给你一个关于EPSV的答案。连接是由内部实现建立的,在我的JDK中,内部实现恰好是sun.net.www.protocol.ftp.FtpURLConnection

当连接到服务器时,首先尝试EPSV和PASV默认为被动模式,如果无法建立被动模式,则返回主动模式-端口。您可以看到实现细节

解释您的一个问题的基本意见是:

 /**
  * Here is the idea:
  *
  * - First we want to try the new (and IPv6 compatible) EPSV command
  *   But since we want to be nice with NAT software, we'll issue the
  *   EPSV ALL cmd first.
  *   EPSV is documented in RFC2428
  * - If EPSV fails, then we fall back to the older, yet OK PASV command
  * - If PASV fails as well, then we throw an exception and the calling method
  *   will have to try the EPRT or PORT command
  */
至于你的第二个问题。。。检索子文件夹失败。。。嗯,乍一看,它的行为似乎是这样的,因为它是马车。但我现在无法安装正确的环境来验证这一点。此外,你还有一个例外。我猜问题是在第455行尝试再次导航到完整路径时引发的。FTP连接的完整源是

我建议您使用该库进行FTP操作。它的使用更加先进和直接


干杯,如果你愿意,祝你快乐

谢谢你的时间和回答!我担心这一个可能会埋在JDK的深处,以解决简单。。。我将试用Apache Commons。。。再次感谢!谢谢你的时间和回答!我担心这一个可能会埋在JDK的深处,以解决简单。。。我将试用Apache Commons。。。再次感谢!