TCP_KEEPINVTL and TCP_KEEPIDLE - Socket Keep Alives not working
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Jun 30 11:12:15 GMT 2020
On Jun 7 14:56, Cary Lewis via Cygwin wrote:
> Thanks very much for the reply - I will wait for Corinna's take on this as
> well - the patch shouldn't be too hard.
It's not that easy, but not too hard either:
- Windows 10 1709 and later actually support the TCP_KEEPIDLE,
TCP_KEEPINTVL and TCP_KEEPCNT options natively, so all is fine here.
- Older OS versions require the use of a single call
WSAIoctl(SIO_KEEPALIVE_VALS), while TCP_KEEPIDLE, TCP_KEEPINTVL and
TCP_KEEPCNT are three distinct calls, with TCP_KEEPCNT being no-op on
pre W10 1709.
> In fact the source code for curl in the lib/connect.c file has code to
> enable the winsock options, so hopefully that code could be helpful. I
But, here's the question:
Even if neither one of SIO_KEEPALIVE_VALS, TCP_KEEPIDLE, TCP_KEEPINTVL
and TCP_KEEPCNT are available, curl *still* uses SO_KEEPALIVE to enable
TCP keep-alive. Given TCP keep-alive has default settings on Windows,
too (2 hours, 1 sec, 10 times), and given SO_KEEPALIVE is supported on
Cygwin as well, why isn't that sufficient?
Keep in mind that none of the above WSAIoctl/setsockopt options are
portable, only SO_KEEPALIVE is. So why should that work on, say,
Solaris, but not on Windows?
Corinna
--
Corinna Vinschen
Cygwin Maintainer
More information about the Cygwin
mailing list