commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [net] Re: SocketClient.setDefaultTimeout has no effect (Bug#: 23746 ) (maybe I got it :)
Date Tue, 14 Oct 2003 04:03:02 GMT

In message <>, cthulhu writes:
>So the purpose of setDefaultTimeout is to set SoTimeout when the socket 
>has not yet been opened, and the purpose of setSoTimeout is to set 
>SoTimeout when socket has been opened, right?


>If so, I found the API description of setDefaultTimeout a little bit 

I agree and that's why I don't want to close the report.  I just haven't
thought of how to reword it.

>and another tought; why is  necessary to have 2 different 
>methods doing the same thing? I mean, why not having only setSoTimeout 
>and making it able to set SoTimout before and after socket is opened?

The reason is that it is very common to create a SocketClient instance
(say FTPClient for example) and reuse the object to establish
connections.  setDefaultTimeout is just a convenience method so you
can set the timeout once and have it set every time you establish
a connection.

>I then browsed a little the Socket API and Sun forum and it seems 
>there's no way(at least I found none) to set how long it takes for a 

There's a connect method in J2SE 1.4 that takes a timeout argument.
The problem is that we haven't decided to break compatibility with
earlier Java versions, so we haven't added a comparable method to
SocketClient.  But you're free to change the source to SocketClient
and add a setDefaultConnectTimeout method or a connect method that
takes a timeout argument to suit your purposes.


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

View raw message