I have a C ++ win32 program that uses sockets to load some data from a server.
Before using sockets on Windows, WSAStartup is called. MSDN says: "There must be a WSACleanup call for every successful WSAStartup call. Only the final call to the WSACleanup function does the actual cleanup."
The easiest way for me is to call WSAStartup / WSACleanup every time I load the data world from the server. In most cases, there will only be one connection at a time, so WSACleanup will actually perform the cleanup.
That's why I wonder what the cost of WSAStartup and WSACleanup are? I want to do the actual cleanup. If the WSAStartup and WSACleanup calls are made in a short time compared to the entire socket connection, I can use a simple method. If not, I should only take care of calling WSACleanup when I exit the program.
winapi sockets tcp wsastartup
jeforum
source share