Just a heads up guys: make sure you're passing a properly formatted IP to your ping and socket functions.
E.g.: 192.168.0.18 -> OK
192.168.0.018 -> Will result in "Unkwown host"
I was getting a 11004 error and could not solve it until I realized that was the problem.
(Pode ser que seja útil para alguém: verifique que o IP passado por parâmetro para o seu ping e funções socket é um endereço de IP corretamente formatado)