Re: GetAdapterInfo and Usage Count Increases by Paul
Paul
Tue May 04 12:06:25 CDT 2004
What I heard from Adam's message was, "If your program calls the IPHLPAPI,
*you* should call WSAStartup() before doing that and call WSACleanup()
*yourself* before the program exits."
Paul T.
"troy anderson" <tander67@hotmail.com> wrote in message
news:ePA0ae2LEHA.3348@TK2MSFTNGP09.phx.gbl...
> It must not call WSACleanup because the it increases everytime it called
> without ever decreasing. My code calls this routine many times during its
> execution cycle and I see the count increase everytime it is called
without
> ever decreasing. Also my application calls WSAStartup at startup and
calls
> WSACleanup before exiting.
>
> "Adam Dyba [MS]" <adyba@online.microsoft.com> wrote in message
> news:OkBYKHjLEHA.3348@TK2MSFTNGP09.phx.gbl...
> > GetAdaptersInfo is an IP helper API (IPHLPAPI) function which calls
> > WSAStartup because it uses some Winsock functions - this call will
> increment
> > the usage count. IPHLPAPI actually calls WSAStartup in more than one
> place,
> > and the usage count may increase up to 3.
> >
> > Aside, any well behaved library or application using Winsock (1 or 2)
> should
> > call WSAStartup before calling any Winsock functions and call WSACleanup
> > before exiting. It is valid to call WSAStartup more than once as long as
> > there will be a corresponding WSACleanup call before library/application
> > unloads.
> >
> > Adam
> >
> > "troy anderson" <tander67@hotmail.com> wrote in message
> > news:%23R%23JtPeLEHA.3016@tk2msftngp13.phx.gbl...
> > > Why does the usage count on WinSock increase every time I invoke
> > > GetAdapterInfo but not for other WinSock APIs like send, recv, etc.?
> > >
> > > What happens when the Usage Count raps? Will WinSock unload if it
wraps
> > to
> > > 0?
> > >
> > >
> >
> >
>
>