public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Cc: John Scott <jscott@posteo.net>
Subject: Re: calls to socket() fail when calling getaddrinfo() with IPPROTO_TCP
Date: Fri, 30 Jul 2021 10:44:08 -0600	[thread overview]
Message-ID: <19768b02-3f4e-1041-e42a-0016c8e3badd@SystematicSw.ab.ca> (raw)
In-Reply-To: <1f5c0302c156c9391d294ea9df84d93b8742a500.camel@posteo.net>

On 2021-07-29 16:41, John Scott via Cygwin wrote:
> I was wondering why my daytime server doesn't work when built for
> Cygwin, and I have been able to narrow it down to this reproducible
> test case:
...
> This code fails with "Failed to create socket: Invalid argument". Does
> anyone have an idea why this happens, given that the arguments to
> socket() come directly from the call to getaddrinfo()? Remarkably,
> changing the service from "daytime" to "http" seems to fix it, which
> seems quite strange.
> 
> I'm not subscribed, so please CC me on replies.

These obsolete legacy time services have always been available built 
into the inetd server in the inetutils package:

$ info inetutils inetd built-in

"daytime
      Send back the current date and time in a human readable form.  Any
      input is discarded.

time
      Send back the current date and time as a 32-bit integer number,
      nrepresenting the number of seconds since midnight, January 1,
      1900."

You could download the source package to study the implementation.

The time protocol client rdate is available from:

	https://github.com/openbsd/src/tree/master/usr.sbin/rdate

As daytime is text in arbitrary display format (likely ctime(3), 
asctime(3)) telnet, netcat, etc. to the service port was probably used.

For currently supported network time services, Meinberg has for many 
years provided native Windows service ports of the latest releases of 
the ntp.org NTP V4 client/server daemon, including a kernel serial 
driver interface supporting GPS devices with PPS signal pins, the latest 
OpenSSL, a Windows installer, and an interactive monitor to control and 
display service daemon NTP info, and view loopstats and peerstats graphs:

	https://www.meinbergglobal.com/english/sw/ntp.htm#ntp_stable

	https://www.meinbergglobal.com/english/sw/ntp-server-monitor.htm

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

      parent reply	other threads:[~2021-07-30 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 22:41 John Scott
2021-07-30  9:34 ` Corinna Vinschen
2021-07-30 10:47   ` Corinna Vinschen
2021-07-30 11:02     ` John Scott
2021-07-30 16:44 ` Brian Inglis [this message]

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=19768b02-3f4e-1041-e42a-0016c8e3badd@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    --cc=jscott@posteo.net \
    /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).