Created originally on Bitbucket by markrwilliams (Mark Williams)
Was already merged in Bitbucket before import, marked as merged by the import user
Preserve errno, like the other socket system call wrappers, and add a test to ensure the correct errno is raised upon socket failure.
This should work on windows; EPROTONOSUPPORT
is an alias for WSAEPROTONOSUPPORT
.