commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
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 <3F8A9E26.5000400@imap.cc>, 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?

Yes.

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

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.

daniel



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


Mime
View raw message