Re: Library 5.0a : Feedback & Questions

> >> The preemptive version (blocking sockets) do not need an event loop as
> >> libwww in this mode blocks while waiting on IO.
> >>
> >Maybe I wasn't clear. W/O a WSA Startup DNS lookups fail. I only found 
> >WSAStartup() called from HTEventInit(). As such -- my preemptive failed 
> >to run *unless I called HTEventInit()*.
> 
> Eric is more into the windows event management - what would you suggest?

I would call this a bug. According to the WinSock spec, the application is
responsible for calling the WSAStartup and WSACleanup routines. There are
no
analogous requirements on unix so a library routine to handle this would
look like this:

PUBLIC HTSetupSockets(void)
{
#ifdef _WINSOCKAPI_
        WSADATA            wsadata;
        if (WSAStartup(DESIRED_WINSOCK_VERSION, &wsadata)) {
            if (WWWTRACE)
                HTTrace("HTEventInit. Can't initialize WinSoc\n");
            WSACleanup();
            return NO;
        }
        if (wsadata.wVersion < MINIMUM_WINSOCK_VERSION) {
            if (WWWTRACE)
                HTTrace("HTEventInit. Bad version of WinSoc\n");
            WSACleanup();
            return NO;
        }
        if (APP_TRACE)
            HTTrace("HTEventInit. Using WinSoc version \"%s\".\n", 
                    wsadata.szDescription);
#endif
/* _WINSOCKAPI_ */
}

but it seems a little spurious as the application might as well do this on
its own. BTW: The ifdef could be on WWW_MSWINDOWS to stick with
the ones we define, but if _WINSOCKAPI_ is defined to work when you are
compiling for winsock. Just a matter of taste or cointoss.

-eric

Received on Sunday, 20 October 1996 20:18:01 UTC