ahost

# ahost DNS lookup
Usage
    ahost [-i] [-a] (<dnsquery>[,<magicdata>]){ <callback command> }
Description
Starts a DNS lookup for the <dnsquery> and reports the results by calling the callback routine. The -i switch causes the command to execute in IPv6 mode (and lookup ONLY IPv6 hosts!). The -a switch causes the command to run in "unspecified" mode and return any available address: IPv4 or Ipv6. This command also performs reverse lookups (if you pass an IP address as <hostname>). The callback command gets passed five parameters: $0 contains the query string (<dnsquery> in fact) $1 contains the value 1 if the query was succesfull. In that case the remaining parameters are set as follows: $2 contains the first ip address associated to the <dnsquery> $3 contains the hostname associated to the <dnsquery> $4 contains the eventual <magicdata> passed. If $1 contains the value 0 then the query has failed and $2 contains an error message explaining the failure. $3 is empty $4 contains the eventual <magicdata> passed. Please note that if the dns query fails to even start for some reason then your callback MAY be called even before ahost() returns.
Switches
-i
Causes the command to execute in IPv6 mode (and lookup ONLY IPv6 hosts!).
-a
The -a switch causes the command to run in "unspecified" mode and return any available address: IPv4 or Ipv6.
Syntax Specification
    ahost [-i] [-a] (<dnsquery:string>[,<magicdata:variant>]){ <callback command> }
Examples
    ahost("localhost")
    {
        echo "Lookup: "$0;
        if($1)
        {
            echo "Ip address: "$2;
            echo "Hostname: "$3;
        } else {
            echo "Error: $2";
        }
    }
    ahost -i ("irc.flashnet.it","Hello :)")
    {
        echo "Lookup: "$0;
        echo "Magic: $3";
        if($1)
        {
            echo "Ip address: "$2;
            echo "Hostname: "$3;
        } else {
            echo "Error: $2";
        }
    }
    ahost -a ("cafe:babe::dead:beef")
    {
        echo "Lookup: "$0;
        echo "Magic: $3";
        if($1)
        {
            echo "Ip address: "$2;
            echo "Hostname: "$3;
        } else {
            echo "Error: $2";
        }
    }
See also
host

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by builduser at Thu Apr 28 01:35:15 2016