I recently downloaded your FTP package to replace jakarta-net because I wanted to include a progress monitor for long running downloads. It seems to work fine on Windows XP but when I test on W98 it hangs at the very end of the download. Here is what I have:
FTPClient ftp = new FTPClient(server, 21);
ftp.setConnectMode(FTPConnectMode.PASV);
ftp.login(user, password);
log.append("\nDownloading to " + tmpOutput.getCanonicalFile());
log.setCaretPosition(log.getText().length());
// monitor transfer progress
ftp.setProgressMonitor(new ProgressMonitor(fileSize), (fileSize / 100) + 1);
ftp.setType(FTPTransferType.BINARY);
progressBar.setIndeterminate(false);
progressBar.setVisible(true);
// Download the file
ftp.get(new FileOutputStream(tmpOutput), this.file);
log.append("\nDownload complete.");
ftp.quit();
...
/**
* @see com.enterprisedt.net.ftp.FTPProgressMonitor#bytesTransferred(long)
*/
public void bytesTransferred(long count) {
try {
percentComplete += 1;
float completion = ((((System.currentTimeMillis() - startTime) / percentComplete) * (100
- percentComplete)) / 1000F);
float minutes = completion / 60F;
float seconds = completion % 60F;
if (seconds >= 60) {
seconds -= 60;
minutes += 1;
}
progressBar.setValue(percentComplete);
progressBar.setString(new DecimalFormat("####0").format(minutes) + ":"
+ new DecimalFormat("00").format(seconds) + " to completion");
}
catch (Throwable t) {
log.append("\nError \"" + t.getLocalizedMessage()
+ "\" occured monitoring download.");
}
}
In this case the file looks like it is completely downloaded (however it is two bytes bigger than the original) and the log line after the ftp.get never runs.
Thanks for any help,
David Morris