should this call socket_strerror instead? What happens if you provide an invalid hostname?

Context is that a fix for #2667 should be landing shortly.