I have application that is running TCP server. To initialize TCP I run WSAStartup(). Then I need to load third party dll. Dll is also does some TCP job and has some bug - it runs WSACleanup() without running WSAStartup(). This bug brakes my TCP server since dll's WSACleanup() kills it.
I can't fix dll. How to avoid this situation. Looks run use dll and my TCP server in different threads doesn't helps
As you can see in the
WSAStartupdoc, theWSAStartup/WSACleanupperform internal reference counting. Therefore all you need to do is callWSAStartuptwice.Thus, when your library calls
WSACleanup, it will only reduce the internal count by one and not release all resources.