You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Salehithal, Vinay S. (IS Consultant)" <VS...@consultantemail.com> on 2006/12/07 17:18:24 UTC

Commons net 1.4.1 FTPClient java.net.SocketTimeoutException: Read timed out

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?

Re: Commons net 1.4.1 FTPClient java.net.SocketTimeoutException: Read timed out

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Salehithal, Vinay S. (IS Consultant) skrev  den 07-12-2006 17:18:
> 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
>         :		
> =======
>   

>             lFtpClient.setDataTimeout(1000);
>   

Perhaps this value is too low?  Any particular reason for explicitly 
setting it?

-- 
  Thorbjørn