Socket's close() doesn't close connection (old bug?)
David Daney
ddaney@avtrex.com
Tue Nov 8 18:06:00 GMT 2005
Tom Tromey wrote:
>>>>>>"Martin" == Martin Egholm Nielsen <martin@egholm-nielsen.dk> writes:
>
>
>>>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15430
>
>
> Martin> So I guess it's only a matter of interrupting any blocking thread when
> Martin> close() is invoked - then everything will be good?!
>
> I've always thought this bug to be rather strange, as I would have
> expected the kernel to notify all read()ers on an fd that was closed
> out from under them. Most likely this just points out some flaw in my
> understanding though.
>
> I wonder whether using select before the read would help.
>
There would still be a window of lossage between the select and read
calls unless the socket were made non-blocking and the operation was
done in a loop, but that might open another can of worms.
David Daney
More information about the Java
mailing list