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 WSAStartup
doc, the WSAStartup
/WSACleanup
perform internal reference counting. Therefore all you need to do is call WSAStartup
twice.
Thus, when your library calls WSACleanup
, it will only reduce the internal count by one and not release all resources.