Sample code for 30+ languages & platforms
Tcl

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set socket [new_CkSocket]

set maxWaitMs 10000
set ipAddr [CkSocket_dnsLookup $socket "www.chilkatsoft.com" $maxWaitMs]
if {[CkSocket_get_LastMethodSuccess $socket] != 1} then {
    puts [CkSocket_lastErrorText $socket]
    delete_CkSocket $socket
    exit
}

puts "IP Address: $ipAddr"

delete_CkSocket $socket