Hi,
I'm using version 1.5.2 of edtFtpJ with java 1.4.2 and am experiencing occassional hanging when issuing a get. Most of the time it hangs for 8 or 9 minutes and then appears to complete the get with a number of files being transferred. The problem happens around once an hour, sometimes more sometimes less. I can't see a real pattern here. The size of files being transferred are usually quite small. Usually just a single xml file and sometimes some jpegs. The usual sequence of events is as follows
1. Connect to the ftp server
2. Grab a particular known file (The filename is known because we have previously connected to the server and done a directory listing)
3. Perform a directory listing
4. Put together a list of files from the directory that match certain criteria (e.g. *.jpeg, *.mpeg)
5. For each file that matches this criteria issue the mod() command to determine modify time
6. Once all mod() commands are issued we then issue multiple get() commands for each of these files.
7. Disconnect.
The server that this code is running from tries to connect to the ftp server and must go through a firewall. The firewall rules have been configured to allow our connections. I don't think that the firewall is a problem since quite a lot of the transfers are successful. I connect to the ftp server in passive mode.
I can't work out what I'm doing wrong here and am not sure if there is a problem with the external ftp server that I am connecting to. Could it be that connecting and disconnecting multiple times is causing the external server to halt transactions for a while?
Aside from investigating this issue with the people who have setup this ftp server I would also like to add my own failsafes. What I would like to do is set a timeout on the connection so that if I issue a get command and nothing happens for 30 seconds or 1 minute then I can just disconnect from the server, reconnect and try doing the get again. Will the use of the setTimeout() method allow me to do this? What I'm concerned about is what will happen when transferring a large file e.g. a large mpeg. If a transfer like this will take 5 minutes will the timeout of 1 minute stop the transfer from occurring? Or is the client smart enough to know that if bytes are being transferred then there is no problem?
I've also read some documentation that says that the code is not thread safe however is it acceptable if I have different threads each creating their own FtpClient instances and potentially using them at the same time?
Thanks for your help.