Socket's close() doesn't close connection (old bug?)
Martin Egholm Nielsen
martin@egholm-nielsen.dk
Wed Nov 9 19:28:00 GMT 2005
Hi Daney,
>>> In my eager to reproduce another bug I've stumbled across yet another
>>> strange issue - namely that Socket's close() doesn't close underlying
>>> socket (with no traffic), nor "wake up" a blocked read-thread (as a
>>> consequence)...
>>>>>> Blah blah blah, this turned out to be reported already:
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15430
>>>> Unfortunately still open ;-)
> Check the above PR for my little C program the demonstrates how by
> adding a call to shutdown() before the close() that the blocked read()
> returns. I think with a small amount of hacking we can use this
> technique to terminate the blocked thread with the proper exception
> being thrown.
Really?! Reading here:
http://www.ecst.csuchico.edu/~beej/guide/net_old/#closedown
shutdown(s, SHUT_RDWR);
and
close(s);
are identical...
But maybe invoking it two times in a row does the magic?!
// Martin
More information about the Java
mailing list