I have a c++ win32 program that uses sockets to download some data from a server.
Before using sockets on Windows, WSAStartup must be called. MSDN says: "There must be a call to WSACleanup for each successful call to WSAStartup. Only the final WSACleanup function call performs the actual cleanup."
The easiest way for me is to call WSAStartup/WSACleanup each time I download a peace of data form the server. Most of the time there will be only one connection at a time, so that WSACleanup will perform an actual cleanup.
That is why I'm wondering, what the cost of WSAStartup and WSACleanup is? I means for performing an actual cleanup. If the calls to WSAStartup and WSACleanup only last a short time in comparison to the whole socket connection, then I can use the easy way. If not, I should take care to call WSACleanup only when exiting the program.