Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BSD Sockets - Detecting when client disconnected

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
GB
Hi,

how is it possible that i can detect when a client has disconnected from a socket? In windows a SocketClose event is raised, but in standard BSD sockets, how can i do that?

 
But if you are writing on a socket which is closed at other end you will get SIGPIPE signal on second write. On first write other end will send RST i.e. socket is already closed and on second write SIGPIPE signal would get generated.
Ofcourse, if you use read then 0 would get return.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top