ftp dir returns java error

1 次查看(过去 30 天)
Matthew
Matthew 2016-8-8
I get the following error on an ftp object. help?
>> dir( fo)
Error using ftp/dir (line 64)
Java exception occurred:
java.net.SocketException: Operation timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:154)
at java.io.BufferedReader.readLine(BufferedReader.java:317)
at java.io.BufferedReader.readLine(BufferedReader.java:382)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:490)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:534)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:476)
at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1950)
>> fo
fo =
FTP Object
host: ftp.box.com
user: mdzieciuch@ucsd.edu
dir: /philsea10_data
mode: binary

回答(1 个)

Soumya Saxena
Soumya Saxena 2016-8-12
I understand that you are getting a java exception when using the “dir” command on a ftp object.
This may be caused by a firewall which is blocking an "active" ftp connection. Many firewalls are configured to allow only “passive” FTP connections.
In my opinion you can debug this issue by using an external debugger like WireShark. This will allow you to intercept the commands being sent by MATLAB to the FTP server and compare them to the commands being sent by another FTP client to the server that is working fine. In this way, you may check possible incompatibilities.

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by