TCP_KEEPINVTL and TCP_KEEPIDLE - Socket Keep Alives not working

Cary Lewis cary.lewis@gmail.com
Sun Jun 7 18:56:01 GMT 2020


Thanks very much for the reply - I will wait for Corinna's take on this as
well - the patch shouldn't be too hard.

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
imagine there must be a translation between the POSIX sockets and winsock
in the fhandler_socket.

I will attempt to download the cygwin source code - I've never built it, so
I don't know how hard it will be.

I am surprised that no one else has ever needed the low level TCP keep
alives to work.



On Sun, Jun 7, 2020 at 2:21 PM Ken Brown via Cygwin <cygwin@cygwin.com>
wrote:

> On 6/7/2020 9:20 AM, Cary Lewis via Cygwin wrote:
> > These constants are usually defined in  netinet/tcp.h but are not defined
> > anywhere in cygwin.
>  >
> > As a result there does not seem to be a way to enable the socket level
> keep
> > alives in cygwin.
> >
> > One result of this is curl's --keepalive-time option does not work, but
> it
> > would affect any attempt to enable socket keep alives.
> >
> > Windows' sockets do support keep alives, and indeed the win32 version of
> > curl works correctly.
> >
> > Can someone explain why the TCP keep alive constants are not defined
>
> I'm not an expert on sockets, but I'll just make a couple of comments
> until
> Corinna has a chance to give a definitive reply.
>
> Cygwin's netinet/tcp.h was derived from the FreeBSD version of the file
> dated
> 2000/01/09.  It has hardly been touched since it was imported into Cygwin
> in
> 2002.  FreeBSD didn't add keepalive support until 2012.
>
> > Is it possible to add this functionality?
>
> If you're asking someone else to do it, the question is whether one of the
> Cygwin developers has the time and expertise to do it.  If you're
> volunteering
> to do it, patches are always welcome.
>
> > Where in the cygwin source code does the actual posix socket to winsock
> > translation take place?
>
> Cygwin's socket support is in the fhandler_socket* files.
>
> Ken
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
>


More information about the Cygwin mailing list