This thread isn't exactly topical to Java-Linux, but I'll throw in my 2
bits to bring
it some closure, I hope.
It is true that Socket.setSoTimeout(int timeout) causes reads to throw
an
InterruptedIOException, but the problem he is trying to solve is that it
does NOT
cause connects to throw an exception, or timeout in any other way. It
will timeout
eventually, depending on the OS, but there is no control over it.
When I need to do this, I use another thread to check the timeout, and
if it has
expired, I close the Socket. That tends to work to unblock the thread
doing the connect.
Actually, there is an On-Topic question for you... Does closing the
Socket on the Linux
JDK port cause the connect statement to throw an Exception of some kind?
I've never
tried it in Linux...

Juergen Sonnauer wrote:
> 
> What about Socket.setSoTimeout(int timeout)? Should throw a
> InterruptedIOException after specified milliseconds on read method.
> 

-- 
Craig West         Ph: (905) 821-8300   |  It's not a bug,
Pulse Microsystems Fx: (905) 821-7331   |  It's a feature...
2660 Meadowvale Blvd, Unit #10          | [EMAIL PROTECTED]
Mississauga, Ont., Canada L5N-6M6       | [EMAIL PROTECTED]

Reply via email to