unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23615@debbugs.gnu.org
Subject: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)?
Date: Sat, 28 May 2016 13:18:27 -0400	[thread overview]
Message-ID: <8906f53e-95c4-cf5d-0e93-56a9f080a1ea@cornell.edu> (raw)
In-Reply-To: <83twhixrvn.fsf@gnu.org>

On 5/28/2016 8:57 AM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown@cornell.edu>

>> Test program attached.  It simulates the situation of bug 23606 (before
>> the bug was fixed).  Here's what happens on Cygwin:
>>
>> $ gcc -o socket_test socket_test.c
>>
>> $ ./socket_test.exe
>> Server listening on port 50176.
>> Attempting client connection...failure: Connection refused.
>
> With MinGW, I get this instead:
>
>   D:\usr\eli\data>socket_test
>   Server listening on port 2213.
>   Attempting client connection...success.
>
> Do we have to have a failure in this case?  Or is the above a valid
> outcome?

It's a valid outcome.  I think the reason the connection is refused on 
Cygwin (and apparently on RHEL 7.2) is that the first addrinfo structure 
returned by getaddrinfo has an IPv6 address.  There's no reason to 
expect this to happen on all platforms.

> Of course, I needed to hack the code quite a lot to get it compile on
> MS-Windows; the result is attached below.  Maybe I broke the code
> while doing that?

No, you didn't.  I get the same results as before with your version, 
after fixing a couple of typos that don't affect the MinGW build.  (You 
forgot a semicolon at the end of line 41, and you misspelled "strerror" 
in line 126.)

> (I don't think calling 'connect' after 'listen' is supposed to work;
> on Windows it predictably fails with EINVAL, as documented on MSDN.)

I think on Posix systems it fails with EISCONN.  I put the call in 
because it's done in the code in process.c that I was imitating, but 
omitting it as you did is fine also.

Thanks for testing.

Ken





  reply	other threads:[~2016-05-28 17:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  0:26 bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)? Ken Brown
2016-05-25 16:24 ` Eli Zaretskii
2016-05-25 19:21   ` Ken Brown
2016-05-28 12:57     ` Eli Zaretskii
2016-05-28 17:18       ` Ken Brown [this message]
2016-05-28 17:48         ` Eli Zaretskii
2016-06-02 16:00 ` Paul Eggert
2016-06-02 17:17   ` Ken Brown
2016-06-02 17:55     ` Ken Brown
2016-06-02 18:55       ` Ken Brown
2016-06-10 12:38         ` Ken Brown
2016-06-10 17:48           ` Paul Eggert

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8906f53e-95c4-cf5d-0e93-56a9f080a1ea@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=23615@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).