Re: WSAEnumProtocols call

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.