You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Daniel Savarese (JIRA)" <ji...@apache.org> on 2006/09/25 17:17:51 UTC

[jira] Commented: (NET-141) FTPClient/DefaultSocketFactory does not regard default timeout

    [ http://issues.apache.org/jira/browse/NET-141?page=comments#action_12437585 ] 
            
Daniel Savarese commented on NET-141:
-------------------------------------

This is not a bug.  You used the API exactly as intended.  If you want a connect timeout, you need to create a socket factory (this has been explained multiple times on th mailing list).  Commons Net 1.4.1 is JDK 1.3 compatible. Therefore, it cannot support connect timeouts. setDefaultTimeout does exactly what it is supposed to do. It sets the socket timeout (read/write timeout). For a release that supports JDK 1.4 or 1.5 as a baseline, connect timeouts will be added.


> FTPClient/DefaultSocketFactory does not regard default timeout
> --------------------------------------------------------------
>
>                 Key: NET-141
>                 URL: http://issues.apache.org/jira/browse/NET-141
>             Project: Commons Net
>          Issue Type: Bug
>    Affects Versions: 1.4 Final
>            Reporter: Christian Hufgard
>         Attachments: CustomSocketFactory.java
>
>
> 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 platforms).
> 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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org