Hello,
I have written a simple java program that recursively downloads a directory structure from a webserver, excluding specific file types. When I run the program on my machine, it works fine. When I have my end user run it on her's, it fails with the below exceptions. She is running over wireless, which I thought may be a consideration, but I tried over my wireless network (even with a very poor connection) and the program runs to completion. We are using the same level of the jre. She consistently sees the problem. I cannot reproduce it to debug, so am asking for some advice.
This exception occurs on a given get() call:
com.enterprisedt.net.ftp.FTPException: Timeout (no new data for 900 seconds)
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:800)
at com.enterprisedt.net.ftp.FTPClient.initGet(FTPClient.java:1687)
at com.enterprisedt.net.ftp.FTPClient.getData(FTPClient.java:1731)
at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:1639)
at com.MyCom.ftp.DownloadSite.processDir(DownloadSite.java:156)
at com.MyCom.ftp.DownloadSite.processDir(DownloadSite.java:114)
at com.MyCom.ftp.DownloadSite.main(DownloadSite.java:85)
The above exception is caught and printed, and the program continues...the next get() attempt results in the following:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.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.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:681)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:649)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketPASV(FTPControlSocket.java:530)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:401)
at com.enterprisedt.net.ftp.FTPClient.initGet(FTPClient.java:1672)
at com.enterprisedt.net.ftp.FTPClient.getData(FTPClient.java:1731)
at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:1639)
at com.MyCom.ftp.DownloadSite.processDir(DownloadSite.java:156)
at com.MyCom.ftp.DownloadSite.main(DownloadSite.java:85)
1) Any ideas why the timeout occurs?
2) Could I handle it by wrapping the get() in a try/catch and trying to execute it again in the event the FTPException occurs
3) After catching the FTPException, what do I need to do before trying the get() again to prevent the SocketException? ftpClient.connect()?...ftpClient.login()?...both?
4) As the FTPException states, the timout takes about 15 minutes. I assume I could get this to happen faster if I set the ftpClient.setTimeout()? What is a reasonable timout value to set? (I never wait with the connection open for future operations...the downloads are processed one after another, and then the client connection ended.)
Sorry if this is too much to ask, but since I am not able to reproduce, I will need to have the user test a fix....would like to have some confidence in a fix before trying again. Any help anybody could provide would be great.
Thanks!