ftp dir returns java error

7 views (last 30 days)
Matthew
Matthew on 8 Aug 2016
Answered: Soumya Saxena on 12 Aug 2016
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 Comment
Walter Roberson
Walter Roberson on 8 Aug 2016
Are you using a proxy? ftp does not support proxy.

Sign in to comment.

Answers (1)

Soumya Saxena
Soumya Saxena on 12 Aug 2016
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.

Tags

Community Treasure Hunt

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

Start Hunting!