Thread View: comp.unix.wizards
2 messages
2 total messages
Started by Wouter Visscher
Wed, 27 Jan 1993 14:14
Detection broken tcp connection
Author: Wouter Visscher
Date: Wed, 27 Jan 1993 14:14
Date: Wed, 27 Jan 1993 14:14
24 lines
1296 bytes
1296 bytes
Dear wizards, I have te following situation: A tcp connect, with keep_alive option and non blocking mode. If the ethernet fails ( pull out a drop cable for instance) I want my application to detect a broken connection. Want can I expect in my application: A - from a select B - from a send C - form a recv D - signals E - Any other means to determine the broken connection Also a indication of the times involved on sunos 4.1 . The manuals are not to clear on this subject, testing showed the above calls i.e. select, send, recv did not return error codes indicating a problem. Mind you if an error code is only return once I might have missed it during this test #include <stddisclaimer.h> This might not be the view of my employer.
Re: Detection broken tcp connection
Author: Eric E. Johnson
Date: Wed, 27 Jan 1993 21:09
Date: Wed, 27 Jan 1993 21:09
31 lines
1658 bytes
1658 bytes
wv@dasc.nl (Wouter Visscher) writes: >The manuals are not to clear on this subject, testing showed the above calls >i.e. select, send, recv did not return error codes indicating a problem. >Mind you if an error code is only return once I might have missed it during >this test Lucky you. I just learned the answer to this question last week. If your sockets are... Blocking... then just wait for a read to return zero bytes, indicating a broken connection. I don't use blocking sockets, so I have no experience with this method. NonBlocking... Watch for select() to claim that one of the sockets can be read from by setting the appropriate descriptor bit. Then, when you go to read the socket via a non blocking read, you will get zero bytes back when the socket connection is broken. Keep in mind that normally, a zero means, "No new data". It only means "Broken connection" when select() indicates that the socket should be read from. This should do the trick. Eric -- Eric E Johnson | "Sigsoft is a black hole of ambition, everything ejohnson@a.cs.uiuc.edu | gets sucked in, and nothing comes out." - Me
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads