this:
if (!(hp=gethostbyname(host))){
fprintf(stderr,"Something died! \n");
return -1;
}
try to replace by
if (isalpha(host))
{
hp=gethostbyname(host);
if (hp==0)
{
printf("can't resolve the hostname...\n");
}else{
printf("host resolved to %s",inet_ntoa(*((struct in_addr *)hp->h_addr_list[0])));
}
host=inet_ntoa(*((struct in_addr *)hp->h_addr_list[0]));
}
dunno if it will help you to make it running but at least you are able to understand what's happening.. |