[2736] in java-interest
Re: JDK: Socket write that never returns
daemon@ATHENA.MIT.EDU (Anselm.BairdSmith)
Thu Oct 12 07:02:20 1995
Date: Thu, 12 Oct 1995 09:56:48 +0100
From: "Anselm.BairdSmith" <Anselm.Baird_Smith@inria.fr>
To: ekim@wheel.bellcore.com (Michael Mills)
Cc: java-interest@java.sun.com
In-Reply-To: <199510111725.NAA04338@wheel.bellcore.com>
Michael Mills writes:
>
> > >
> > > Has anyone had a beta socket write throw an Exception of any kind
> > > for them?
> > >
> > I beleive I have had no problems with my socket code bailing out
> > when the other side breaks the connection.
>
> I had the opposite experience. If the socket was blocked on a read or
> write it would stay there forever...
Same for me, I am looking for any mean (ugly or not) to block on a
read() for a given duration. For the time being, in 1a3 I do the
following:
Thread1: blocks in read()
Thread2: close the Socket read by Thread1 and post a ThreadDeath - or
whatever - exception to Thread1 through
Thread.postException().
I hoped that closing the socket behind Thread1 would make the read()
trigger some sort of IOException, but this doesn't work as expected: I
still have to close the 'client' socket to get out of the read().
If any one has some solution (I really need it) to this problem, even
for the beta socket API, it would be great.
Anselm.
Anselm.BairdSmith@inria.fr - http://www.inria.fr/koala/abaird.html
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com