Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in Java FTP by (160 points)
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?

3 Answers

0 votes
by (162k points)
Sorry, missed this post somehow. Can you post a log file please?
0 votes
by (160 points)
Here's the log:

java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:753)
at com.enterprisedt.net.ftp.FTPClient.validateTransfer(FTPClient.java:1350)
at com.enterprisedt.net.ftp.FTPClient.validateTransferOnError(FTPClient.java:1375)
at com.enterprisedt.net.ftp.FTPClient.get(FTPClient.java:1655)
at tests.ftp.FTPTest.main(FTPTest.java:29)
--== FTP Log dump --==
220 snv588 FTP server ready.
---> USER danny
331 Password required for danny.
---> PASS ********
230 User danny logged in.
---> PASV
227 Entering Passive Mode (10,234,52,35,35,45)
---> RETR danny.log
150 Opening ASCII mode data connection for danny.log (45771 bytes).

--== End Log Dump ==--
0 votes
by (162k points)
As the problem happens on a data transfer, it looks like a firewall problem. You could try active mode, or talk to your network admin.

Categories

...