i tried this solution but no luck !
when i catch an exception i call this method :
private synchronized void retry(File file) throws FileUploadException {
while (attempts < r.MAXRETRIES) {
util.Trace.log("File transfer failure ! reconnecting (attempt "
+ attempts + ")...");
try {
client.quitImmediately();
makeConnection();
client.resume();
putFile(file);
break;
} catch (Exception e) {
attempts++;
System.out.println("attempts="+attempts);
continue;
}
}
if (attempts == r.MAXRETRIES) {
throw new FileUploadException("File Upload Failed ");
}
}
any Ideas how to solve this ?
thanks.
debug trace:
----------
DEBUG [FTPControlSocket] 5 Jul 2007 19:17:15.256 : ---> PASV
DEBUG [FTPControlSocket] 5 Jul 2007 19:17:15.334 : 227 Entering Passive Mode (209,203,246,34,6,242)
DEBUG [FTPControlSocket] 5 Jul 2007 19:17:15.381 : ---> STOR A-group006.jpg
DEBUG [FTPControlSocket] 5 Jul 2007 19:17:15.428 : 150 File status okay; about to open data connection.
DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:15.428 : 16384 transferred
DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:15.428 : 32768 transferred
DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:15.444 : 49152 transferred
DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:15.444 : 65536 transferred
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.DataOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.write(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.putData(FTPClient.java:1896)
at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1595)
at com.enterprisedt.net.ftp.FTPClient.put(FTPClient.java:1568)ERROR [FTPClient] 5 Jul 2007 19:17:23.131 : Caught and
------------------------------------------------------
DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:26.444 : connecting to server...
DEBUG [FTPClient] 5 Jul 2007 19:17:26.444 : Connecting to /209.203.246.34:21
DEBUG [SocketUtils] 5 Jul 2007 19:17:26.444 : Invoking connect with timeout=60000
java.net.NoRouteToHostException: No route to host: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)DEBUG [upload.FTPUploadThread] 5 Jul 2007 19:17:28.444 : Problems connecting to ftp server: No route to host: connect
[/code]