This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recv and errno during a connection reset/closed by peer


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]