commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregor Schmidt" <gregor.schm...@utanet.at>
Subject Re: [net] FTP client fails if a modem connection is used
Date Thu, 26 Jul 2012 19:52:04 GMT
Hello,

These are the faults I found with a low bitrate channel:


1. Upload of a file to the server

Line 590   input = new FileInputStream(pathFilename);
Line 591   result = ftpC.storeFile(serverFilename, input);

An exception is thrown with line 591 and caught by this catch block:
catch(SocketTimeoutException ste) {
    text1 = ste.getMessage();
    text2 = ste.getCause();
    ste.printStackTrace();
}

text1 = Read timed out
text2 = null
printStackTrace():
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
        at sun.nio.cs.StreamDecoder.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.BufferedReader.fill(Unknown Source)
        at java.io.BufferedReader.read(Unknown Source)
        at 
org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:58)
        at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:310)
        at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:290)
        at org.apache.commons.net.ftp.FTP.getReply(FTP.java:632)
        at 
org.apache.commons.net.ftp.FTPClient.completePendingCommand(FTPClient.java:1561)
        at 
org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:581)
        at 
org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1704)
        at InternetServer.putServerFiles(InternetServer.java:591)


2. Download of a file from the server:

Line 510   output = new FileOutputStream(pathFilename);
Line 511   result = ftpC.retrieveFile(serverFilename, output);

The method retrieveFile() returns false, no exception is thrown.


3. Logout from the server

Line 218   ftpC.logout();

An exception is thrown with line 218 and caught by this catch block:
catch(IOException ioe) {
    ioe.printStackTrace();
}

printStackTrace():
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(Unknown Source)
        at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
        at sun.nio.cs.StreamDecoder.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.BufferedReader.fill(Unknown Source)
        at java.io.BufferedReader.read(Unknown Source)
        at 
org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:58)
        at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:310)
        at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:290)
        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:474)
        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:547)
        at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:596)
        at org.apache.commons.net.ftp.FTP.quit(FTP.java:804)
        at org.apache.commons.net.ftp.FTPClient.logout(FTPClient.java:941)
        at InternetServer.ftp(InternetServer.java:218)


-----Urspr√ľngliche Nachricht----- 
From: sebb
Sent: Thursday, July 26, 2012 10:44 AM
To: Commons Users List
Subject: Re: [net] FTP client fails if a modem connection is used

On 25 July 2012 18:56, Gregor Schmidt <gregor.schmidt@utanet.at> wrote:
> Hello,
>
> I use the FTPClient class (API 3.0.1) for FTP file transfers. It works 
> fine as long as the internet connection is fast enough, e. g. 150 kbit/s 
> and above. With a modem connection at 56 kbit/s I can connect the server 
> but I get a read time out after the transfer of the file to the server 
> (size 31 kByte). Files on the server couldn't be downloaded at all. 
> Available FTP programs (WS-FTP etc.) don't have any problems with such a 
> low bitrate connection.
>
> It may be that an appropriate setting of the various timeout values could 
> solve the problem. Unfortunately I'm not a specialist in FTP or networking 
> in general. The current settings are:
> DefaultTimeout = 0 (default)
> SocketTimeout = 0 (default)
> ConnectTimeout = 0 (default)
> ControlKeepAliveTimeout = 300 seconds, set according to the example in the 
> API description
> ControlKeepAliveReplyTimeout = 1000 milliseconds (default)
>
> Does somebody know an appropriate setting of the timeouts or a different 
> solution for my problem?

What is the exact error you are getting?

> Best regards,
> Gregor

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message