Re: Strange Socket problem?
Tom Hawtin wrote:
Knute Johnson wrote:
Reads have always been a reliable way to detect disconnects in the past.
Reads generally aren't great. They generate no traffic, so you wouldn't
even expect the remote end to respond. You might get an ICMP no route to
host message if you are lucky. What you can do is send some form of NOP
periodically. (Can't remember if flush will actually send an empty packet.)
Oh and one more tidbit is that on the new project I'm working on the
hang occurred with the host and client on the same machine.
So probably not a network failure then.
Having a brief look at the code closing a socket close the file
descriptor which then presumably that closes the streams. The path is
direct, so I can't claim out of hand that it is your fault...
Tom Hawtin
Thanks Matt and Tom. I hate it when I have a lot of coincidental
happenings. Makes me start to think that this stuff runs on voodoo.
Two of my three programs in the field locked up again this morning so
I've got another fix to put in tonight. One of the threads only reads
so I'm going to try closing its socket instead of the output stream. I
reorganized some other code so maybe I'll get it cured. I know that the
server end has been having some problems as this code worked flawlessly
for almost a year before it started giving me fits.
Thanks again,
--
Knute Johnson
email s/nospam/knute/