Hello,
Am using the Commons net 1.4.1 FTPClient (code runs on on Java
5/solaris) to retrieve some text files from an FTP server. Occasionally,
I see the following exception:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at
java.io.BufferedInputStream.read(BufferedInputStream.java:235)
at java.io.FilterInputStream.read(FilterInputStream.java:66)
at
java.io.PushbackInputStream.read(PushbackInputStream.java:120)
at
org.apache.commons.net.io.FromNetASCIIInputStream.__read(FromNetASCIIInp
utStream.java:75)
at
org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInput
Stream.java:170)
at
org.apache.commons.net.io.FromNetASCIIInputStream.read(FromNetASCIIInput
Stream.java:134)
at org.apache.commons.net.io.Util.copyStream(Util.java:98)
at
org.apache.commons.net.ftp.FTPClient.retrieveFile(FTPClient.java:1295)
:
:
=======
The part of the code that am using is as follows:
lFtpClient = new FTPClient();
//The default timeout in milliseconds that is used when
opening a data connection socket.
lFtpClient.setDataTimeout(1000);
lFtpClient.connect(FTP_SERVER);
lFtpClient.login(FTP_USER,lPassword);
lFtpClient.setFileType(FTP.ASCII_FILE_TYPE);
lFtpClient.retrieveFile(FTP_FILENAME,lBufferedOutputStream);
It seems like the file is retrieved parrtially (I can see the partial
file on destination) and then it fails with the above exception.
I checked the archives/list and didn't find any similar scenarios. Any
suggestions?