I'm using edtFTPj v1.5.3 and
I encountered a problem with the FTPClient when connecting to a server with a Sun operating system.
This is what the program does:
public void getFile(String host, String user, String password, String file) throws FTPException
{
FTPClient ftp = null;
try
{
ftp = new FTPClient();
// the host is a SunOS server
ftp.setRemoteHost(host);
ftp.connect();
ftp.login(user, password);
// "c:/temp/user" is a directory that exists on my local file system, and I know this statement will throw an Exception
ftp.get("c:/temp/user", file);
}
catch (IOException e)
{
e.printStackTrace();
ftp.quit();
}
catch (com.enterprisedt.net.ftp.FTPException e)
{
e.printStackTrace();
ftp.quit();
}
}
}
After an IOException is thrown from the get statement every action I try to perform
on the client (for example: quit()) causes the client to hang (and as a result the program is stuck).
After I debugged the program it turned out the the exception that is thrown is actually a SocketTimeoutException
and this only happens when connecting to a SunOS server (on other servers like HP a FileNotFoundException
is thrown).
Is this a bug?
what can I do to resolve this?