On Fri, 2002-02-22 at 15:18, insomniak wrote: > Hi > If you are looking to find out is a host is alive try this bit of code. > > $host = www.google.com; > $ip=join ".",unpack("C4",(gethostbyname($host))[4]); > > $ip will be empty if host is dead > > from command line > > perl -e "print join \".\",unpack(\"C4\",(gethostbyname(@ARGV[0]))[4]);" > www.google.com This will not work if the host can be resolved, but is not up. gethostbyname does a DNS lookup, DNS lookups depends on an entry in the nameserver, not the host being available.
Unfortunately I cant supply a working method... :( Kind regards Johan. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]