Use SOCKET and INVALID_SOCKET on Windows.
Fix compilation warnings on Windows.