This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: recv and errno during a connection reset/closed by peer
- From: Joris van der Sande <cone at pulserate dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 25 Mar 2005 08:40:28 +0100
- Subject: Re: recv and errno during a connection reset/closed by peer
- References: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAUKQItienSEKG+9226yKd5cKAAAAQAAAAABEV8lCYiUqikvlg/nhWLAEAAAAA@sbcglobal.net>
Peter,
This works for me:
/* Detect dead connections */
int keepalive = 1 ;
r = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(char *)&keepalive,
sizeof(keepalive)) ;
recv() will now return ECONNABORTED when the host
disconnects.
Best regards,
Joris
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/