home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!elroy.jpl.nasa.gov!usc!howland.reston.ans.net!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!csus.edu!netcom.com!bilan
- From: bilan@netcom.com (Steve Bilan)
- Subject: Re: Sockets: How do I detect when it has unexpectedly closed
- Message-ID: <1993Jan12.234227.29729@netcom.com>
- Organization: Netcom
- References: <1993Jan11.200716.14442@bvl.pt> <1993Jan12.114400.3620@bvl.pt>
- Date: Tue, 12 Jan 1993 23:42:27 GMT
- Lines: 26
-
- vasco@bvl.pt (antonio vasconcelos) writes:
- >ejohnson@void.ncsa.uiuc.edu (Eric E. Johnson) writes:
- >: I know how to close a connection. That's easy. My question is: how do
- >: I detect that a socket (AF_INET, SOCK_STREAM) has been unexpectedly
- >: disconnected from its remote client? I'm assuming a case where the
- >: remote client has crashed and was unable to send out a "closing"
- >: message.
- >
- >then, in the main() you just have to setup signal handlers.
- >
- > signal(SIGINT,byebye);
- > signal(SIGPIPE,snifserver);
- >
- >By the way, if the client dies, the server should recive a SIGPIPE too.
-
-
- That works fine for an app with one socket, but if you have an
- app with two (or more) sockets open, how can you detect an abnormal
- socket close and know which socket it's on?
-
-
-
-
- M, BATR..
- ..Steve Bilan
-
-