Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.6k views
in Java FTP by (260 points)
In addition to the error in logappender (posted in other message) we have another exception in our ftpclient, which we would like some help to figure out.

We are trying to connect to a ftpserver at f.x 20050802010848

ftpClient = new FTPClient();
ftpClient.setControlPort(xx);
ftpClient.setRemoteHost(xx);
ftpClient.setTimeout((int)xx);
ftpClient.connect();

At
20050802011348 we receive an exception :


Stacktrace:  java.io.InterruptedIOException: Read timed out
   at java.net.SocketInputStream.socketRead(Native Method)
   at java.net.SocketInputStream.read(SocketInputStream.java(Compiled Code))
   at java.net.SocketInputStream.read(SocketInputStream.java(Compiled Code))
   at java.io.InputStreamReader.fill(InputStreamReader.java(Compiled Code))
   at java.io.InputStreamReader.read(InputStreamReader.java(Compiled Code))
   at java.io.BufferedReader.fill(BufferedReader.java(Compiled Code))
   at java.io.BufferedReader.readLine(BufferedReader.java(Compiled Code))
   at java.io.BufferedReader.readLine(BufferedReader.java(Inlined Compiled Code))
   at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java(Compiled Code))
   at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java(Inlined Compiled Code))
   at com.enterprisedt.net.ftp.FTPClient.user(FTPClient.java(Inlined Compiled Code))
   at com.enterprisedt.net.ftp.FTPClient.login(FTPClient.java(Compiled Code))
   at dk.dannet.stdftp.ftpservice.ftpclient.ExchangeFiles.ftpLogin(ExchangeFiles.java(Compiled Code))
   at dk.dannet.stdftp.ftpservice.ftpclient.ExchangeFilesImplUpload.sendFiles(ExchangeFilesImplUpload.java(Compiled Code))
   at dk.dannet.stdftp.ftpservice.ftpclient.FtpClientWorker.doJob(FtpClientWorker.java(Compiled Code))
   at dk.dannet.stdftp.ftpservice.StdFtpWorker.loopIteration(StdFtpWorker.java(Compiled Code))
   at dk.dannet.stdftp.ftpservice.StdFtpWorker.run(StdFtpWorker.java:240)
   at java.lang.Thread.run(Thread.java:513)



It is the same ftpserver which we connect and upload 1-2000 files a day, but 5 - 20 times a day, we get this exception.

The client is running on an Unix with Java 1.3.1

Where could the problem be ??

3 Answers

0 votes
by (162k points)
Sorry, there isn't an obvious reply to make here. The socket read timed out, which means the server didn't respond correctly. A network glitch perhaps, or overloaded server, or ?

With FTP in this scenario it is wise to write your code to catch exceptions, perhaps wait for a minute, and then retry.

In addition to the error in logappender (posted in other message) we have another exception in our ftpclient, which we would like some help to figure out.

0 votes
by (260 points)
The problem with these Exceptions (InterruptedIOException and SocketExceptions) is that we dont know whether the transfer was ok or not.

We have had incidents that the file actually did come through, even though we received a SocketException.

but perhaps we have to live with that.
0 votes
by (162k points)
You could catch the exception and attempt to delete the file before retrying, or just retry every time an exception is thrown.

The problem with these Exceptions (InterruptedIOException and SocketExceptions) is that we dont know whether the transfer was ok or not.

We have had incidents that the file actually did come through, even though we received a SocketException.

but perhaps we have to live with that.

Categories

...