Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in Java FTP by
Hi,

I got the time out error during the constructor of FTPClient(ipAddress). I am using 1.4.5, and the error stack is attached. I could use the FTP client from Solaris to connect to the same FTP server without any problem. So, is it possible to use setTimeout() to address the issue? If yes, I might have to upgrade to 1.5.2, in order to call FTPClient.setTimeout() before the actual connection occur. Is it correct?

Thank you so much for the help !

Steven



java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.enterprisedt.net.ftp.FTPControlSocket.<init>(FTPControlSocket.java:170)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:436)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:373)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:344)

1 Answer

0 votes
by (162k points)
You can't use setTimeout() here.

Why is it timing out? The only reason really is that the IP address or hostname resolution is incorrect, or the host is not reachable. Address that issue.

If you must have a timeout, hack the code to use the Java 1.4 socket constructor that permits a timeout when connecting a socket. We'll add this eventually - have not done so for backwards compatibility, will do so via reflection.

Hi,

I got the time out error during the constructor of FTPClient(ipAddress). I am using 1.4.5, and the error stack is attached. I could use the FTP client from Solaris to connect to the same FTP server without any problem. So, is it possible to use setTimeout() to address the issue? If yes, I might have to upgrade to 1.5.2, in order to call FTPClient.setTimeout() before the actual connection occur. Is it correct?

Thank you so much for the help !

Steven



java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.enterprisedt.net.ftp.FTPControlSocket.<init>(FTPControlSocket.java:170)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:436)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:373)
at com.enterprisedt.net.ftp.FTPClient.<init>(FTPClient.java:344)

Categories

...