Explicitly cast INVALID_SOCKET to (int) to address warnings on Windows.