Subject: Re: bug#23615: 25.1.50; Which platforms can safely use getsockopt(,,SO_ERROR,,)?

From: Eli Zaretskii <[email-masked]>
Date: Sat, 28 May 2016 15:57:00 +0300

> Cc: [email-masked]
> From: Ken Brown <[email-masked]>
> Date: Wed, 25 May 2016 15:21:56 -0400
> 
> On 5/25/2016 12:24 PM, Eli Zaretskii wrote:
> > Perhaps you or someone could write a small test program, and then
> > people here could run it various platforms and provide feedback.
> 
> 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?

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?

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