recv and errno during a connection reset/closed by peer

Joris van der Sande cone@pulserate.com
Fri Mar 25 14:24:00 GMT 2005


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/



More information about the Cygwin mailing list