Skip to Content.
Sympa Menu

freetds - Re: [freetds] WSAEnumProtocols call

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] WSAEnumProtocols call
  • Date: Wed, 11 Feb 2009 08:59:57 -0500

Frediano Ziglio wrote:
> I don't understand why we call WSAEnumProtocols in
> winsock_initialized. I never used this function but I can guarantee
> that WSAStartup is sufficient.

I was looking for a safe way to answer this question: Has winsock been
initialized?

I'm not sure what the effect is of calling WSAStartup twice. There isn't
any documented error from WSAStartup that means, "hey, dummy, you already
called WSAStartup and I'm initialized already!".

I thought it was safer to call WSAEnumProtocols to discover if winsock is
not initialized. It must be cheap; it's only returning its configuration
data. And it returns a very clear answer as to whether or not winsock is
working.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page