On Sun, 11 Jan 2004, Marcus Andree S. Magalhaes wrote:
> > The other problem is actually enforcing this connection timeout when
> > creating a real connection. As far as I can see there is no means
> > before the 1.4 jvm to put a timeout value on creating a Socket
> > connection. Then for the whole connection and authentication process you
> > would need to call setSoTimeout on the Socket. This would be incredibly
> > ugly because to enfore a setLoginTimeout of 4 seconds you couldn't
> > simply use a 4 second timeout on the socket's read and write calls
> > because each one of many could take 3.9 seconds. You would have to
> > continually monitor the time elapsed and keep calling setSoTimeout with
> > the remaing time left.
> >
> > Kris Jurka
> >
>
> Kris, checking Sun's javadoc pages, it seemes that setSoTimeout and
> setSoLinger is abailable since jdk 1.1. My guess is, if anyone wants
> to provide a solution to this "problem", the best answer would be to
> use both the loop limit and socket timeouts.
setSoTimeout is only for read() calls on the InputStream, it won't help us
during establishing a connection.
setSoLinger is only relevent for closing the connection which isn't
related to setLoginTimeout.
The idea of continually setting setSoTimeout with the remaining time left
is something I mentioned as the only way I saw to do it, not something I
would want to consider actually doing.
Kris Jurka