ws2_32: Add a more generic function to retrieve socket errors from server.