#!/usr/bin/ruby

#
## http://rosettacode.org/wiki/DNS_query
#

var (err, *res) = Socket.getaddrinfo(
        'www.kame.net', 0,
        Hash.new(protocol => Socket.IPPROTO_TCP)
);
err && die err;
res.each { |z|
    say [Socket.getnameinfo(z{:addr}, Socket.NI_NUMERICHOST)][1];
}
