Shouldn't the entire process be blocked, on a blocking IO
call?  Thus, another user level thread wouldn't make a difference, as the
socket open attempt would block all threads belonging to the process.

Of course, this all changes when the JDK is written with native threads.


On Wed, 12 Aug 1998, A. Craig West wrote:

> Date: Wed, 12 Aug 1998 15:24:09 -0400
> From: "A. Craig West" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: Socket connect timeout?
> Resent-Date: Wed, 12 Aug 1998 15:31:42 -0400
> Resent-From: [EMAIL PROTECTED]
> 
> 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