detecting dropped client socket connections

Rajpaul Bagga (rajpaul@hp866a.lanl.gov)
Tue, 5 Jan 1999 17:21:46 -0700 (MST)


Hello all.
I'm trying to develop a network server/client setup where the server
periodically checks for messages from the client. The socket is set for
non-blockin i/o so that when it tries to receive a message if nothing is
there it can go on to do other things.

The problem occurs when the client drops the connection. I need to assume
that it will not always send a nice message requesting to drop the
connection. After the client has dropped a connection, if I issues a
socket->Recv() command, I get a SIGSEGV signal. Is there someway to
detect whether the client has dropped the connection before trying to
receive a message?

Thanks,
-Rajpaul

------------------------------------------------------------------
Rajpaul Bagga email: rajpaul@hp866a.lanl.gov
P-25, M.S. H846 phone: (505) 665-8568
Los Alamos National Laboratory
Los Alamos, NM 87545