home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / programm / 4559 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.5 KB  |  31 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!munnari.oz.au!spool.mu.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!rstevens
  3. From: rstevens@noao.edu (W. Richard Stevens)
  4. Subject: Re: Detecting a broken socket
  5. Message-ID: <1992Sep7.220601.7136@noao.edu>
  6. Keywords: socket, SunOS, keep_alive
  7. Sender: news@noao.edu
  8. Nntp-Posting-Host: gemini.tuc.noao.edu
  9. Organization: National Optical Astronomy Observatories, Tucson, AZ, USA
  10. References: <camh.715839302@balrog>
  11. Date: Mon, 7 Sep 1992 22:06:01 GMT
  12. Lines: 17
  13.  
  14. >The situation is that I have an open socket to a comms server that
  15. >occasionally dies. When this happens I would like to close down the
  16. >connection and open a new one.
  17.  
  18. What do you mean by "dies"?  If the process dies but the host stays up
  19. (and I'm assuming you're using TCP), then the connection is closed and
  20. your end should appear readable with the read returning 0, which you
  21. indicate you've tried.  If the comms server is a dedicated box that
  22. crashes, and perhaps reboots, then maybe it's not closing the connection,
  23. which accounts for why your select didn't indicate readable.  If the comms
  24. server isn't sending out a FIN segment, your end won't detect that it's
  25. crashed.  If the comms server does reboot then the keepalive would work,
  26. but as someone else has indicated, the timer value is usually not
  27. per-process-configurable, and the recommended default is now 2 hours
  28. of inactivity on the connection before a keepalive packet is sent.
  29.  
  30.     Rich Stevens  (rstevens@noao.edu)
  31.