Ruby
Ruby
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Ruby Downloads
require 'chilkat'
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
socket = Chilkat::CkSocket.new()
maxWaitMs = 10000
ipAddr = socket.dnsLookup("www.chilkatsoft.com",maxWaitMs)
if (socket.get_LastMethodSuccess() != true)
print socket.lastErrorText() + "\n";
exit
end
print "IP Address: " + ipAddr + "\n";