Hi Chris,

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 )
{
#ifdef WIN32
    WSACleanup();
#endif
}

Of course it could be made more complicated, 
checking for -
#ifdef _WINSOCK2API_
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 -
+  Socket::initSockets();

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

Regards,
Geoff.

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 <ubu...@geoffair.info> 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.
> >



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to