Hi.
I saw a tutorial that called WSACleanup(), every time an error occured.
In a larger app, is this really necceceary? Isnt it good enough to just call closesocket(), on the socket which caused the error, and go over again?
Hi.
I saw a tutorial that called WSACleanup(), every time an error occured.
In a larger app, is this really necceceary? Isnt it good enough to just call closesocket(), on the socket which caused the error, and go over again?
WSACleanup() should be called when your application is done using sockets.
..Well, my app won't stop using sockets untill it ends...
Is this a good solution?
In winmain():
Code:WSAStartup(); // Can't actually remember the exact function name..
In MessageProcedure:
Code:case WM_DESTROY: WSACleanup(); return 0;
Yeah, that works.
On a related note, can I use
and is that a reliable solution, or should I really just make sure I do it all manually. I know that in many cases, atexit() is frowned upon, but I'm not really sure why... any reasons?Code:atexit(WSACleanup());