Use Windows' critical sections as the windows alternative to pthread's mutexes.
I have added a MACRO that uses either CRITICAL_SECTION or pthread_mutex depeneding on whether it's windows or unix.
And because a CRITICAL_SECTION has the bonus of being recursive by default,
I've added the recursive attribute to the pthread mutexes.
Removed unused variables
2.0 is not an existing release of WinSock... 2.2 is the correct version to request.
We need to actually include Winsock2 to work with correct implementation of any WinSock 2.x version.
This could also support IPv6.
Winsock 1 does not support IPv6. Winsock2 does.
Winsock2.h goes along with ws2_32.lib.
Use _snprintf in MSVC, as this is the naming available in MSVC.
snprintf itself does not exist in MSVC.