You are right to question why 1.1, but I guess since
SG/FG family mainly follows POSIX (Berkely/BSD) sockets,
no Microsoft extensions are used or needed, so
requesting 1.1 seems ok, so this is deliberate...
In all code cases checked, we do however include
WinSock2.h, except in some cases where windows.h
is included first, which will load winsock.h unless
WIN32_LEAN_AND_MEAN has been declared...
And the link is against ws2_32.lib, so yes maybe
the WSACancelBlockingCall() could be removed, making
the net_exit() with no error check - it is only called
atexit() - so maybe simply :-
static void net_exit ( void )
Of course it could be made more complicated,
checking for -
indicating that we could use version 2.2, but
maybe this is not needed... 1.1 works fine...
But thanks... this is the 'standard' I will follow in
future in my windows coding where I want the code
portable to other platforms... ;=))
And thanks to James for pushing to metar_main.cxx -
Maybe you should also consider the above net_exit
change in the sgio library... unless you have already
done it, and I missed the change... ;=))
On Sat, 2012-07-28 at 10:03 +1200, Chris Forbes wrote:
> Geoff, your patch is asking for the quirky old win95-era winsock1.1.
> Is this intentional? WSACancelBlockingCall and friends don't exist in
> modern winsock.
> -- Chris
> On Sat, Jul 28, 2012 at 5:03 AM, Geoff McLane <ubuntu@...> wrote:
> > On Fri, 2012-07-27 at 17:39 +0100, James Turner wrote:
> >> On 27 Jul 2012, at 16:37, Geoff McLane wrote:
> >> > For a long, LONG time the small utility program
> >> > metar.exe has failed to work in windows...
> >> >
> >> > It turns out WSAStartup() is NOT called, thus the
> >> > HTTP request always fails...
> >> >
> >> > Applied this simple patch below, and all is
> >> > well ;=))
> >> >
> >> > Hope this can get into fg git, and I hope pushed
> >> > to Release/2.8.0 as well, and thus get into
> >> > the next fgrun release 2.8 windows install...
> >> There's an even simpler fix: call:
> >> int simgear::Socket::initSockets()
> >> Which does whatever platform-specific socket initialisation is required.
> >> James
> > Hi James,
> > Just as my patch does... SAME code except
> > for the throw sg_exception() ;=))
> > So 6 to one, and half dozen to the other...
> > Just hope one of them gets pushed ;=))
> > Regards,
> > Geoff.