public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: TCP_KEEPINVTL and TCP_KEEPIDLE - Socket Keep Alives not working
Date: Tue, 30 Jun 2020 13:12:15 +0200	[thread overview]
Message-ID: <20200630111215.GE3499@calimero.vinschen.de> (raw)
In-Reply-To: <CAEF1h+UuQmXz-ntG6YMed+DKFgikJT_aJN5Hu94ZnZ8_LGxMjQ@mail.gmail.com>

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

  reply	other threads:[~2020-06-30 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 13:20 Cary Lewis
2020-06-07 18:19 ` Ken Brown
2020-06-07 18:56   ` Cary Lewis
2020-06-30 11:12     ` Corinna Vinschen [this message]
2020-06-30 13:46       ` Cary Lewis
2020-06-30 16:53         ` Corinna Vinschen
2020-07-01 19:50           ` Corinna Vinschen
2020-07-02 14:52             ` Cary Lewis
2020-07-13 13:05               ` Cary Lewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200630111215.GE3499@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).