commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Hufgard (JIRA)" <>
Subject [jira] Commented: (NET-141) FTPClient/DefaultSocketFactory does not regard default timeout
Date Mon, 25 Sep 2006 15:41:51 GMT
    [ ] 
Christian Hufgard commented on NET-141:

Thanks for the quick response.

Ok, should have checked the archives before :). But I think if this is a feature, it should
be documented within the API. At least I haven't found it within FTPClient and SocketClient.
DefaultSocketFactory just notices that it wrappes Socket.

Maybe SocketClient.setDefaultTimeout(int timeout) would be a good place to get this information

I still think, this behaviour is a little bit strange. We also use commons-httpclient and
there is some code that uses >jdk 1.4 feature if available and implements a custom way
for the connect timeout if they are not.
Think this would be usefull for ftpclient too.

> FTPClient/DefaultSocketFactory does not regard default timeout
> --------------------------------------------------------------
>                 Key: NET-141
>                 URL:
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4 Final
>            Reporter: Christian Hufgard
>         Attachments:
> Hi,
> If executing the following code
>  String hostname = "localhost";
>  FTPClient client = new FTPClient();
>  client.setDefaultTimeout(1000);
>  client.connect(hostname);
> against a ftp server that ignores the connection attempt (e.g. is firewalled/malfunctoned),
there will be no exception after 1000 ms. The exception will be thrown after a default timeout
of three minutes. (Three minutes on a debian/ and a suse machines. Might be different on other
> JavaDoc says:
> public void setDefaultTimeout(int timeout)
>   Set the default timeout in milliseconds to use when opening a socket.
> Digging through the code I found, that DefaultSocketFactory which is used be SocketClient
does not care about any value set with this method. It creates a new Socket with Socket(hostname,
port) and relies on the VMs behaviour.
> To get this fixed I set a custom SocketFactory with client.setSocketFactory(socketFactory);
that uses a timeout for socket connection.
> This bug is also in 1.4.1, but this value is not listed...
> Christian

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message