Fixed error handling for ext/sockets under win

WSAGetLastError() must be the very next call after a socket
function had an invalid return. Any function call inbetween
will clear the error information.