See also the DNS server [3]
Jochen Loewer has written a pure-Tcl implementation.
Pat Thoyts has written a pure-Tcl (client TCP and UDP) implementation.
- (and I wish I'd known about Jochen's one earlier). Anyway - I've submitted mine to tcllib and it can be examined at http://sourceforge.net/tracker/?func=detail&aid=520279&group_id=12883&atid=312883
package require udp 1.0.2 package require dns 1.0.2 dns::configure -protocol udp
Scotty knows DNS.See also The DNS blocking problem.[Much more to explain, as of February 2002.]
When using the dns package of Tcllib, you have to know which DNS server to use for host name resolutions. Your machine probably already knows that somewhere, it is just a matter of finding this information in a portable way. I have used the following script to perform this operation, it works on Windows and should on a decent UNIX system. For once, both architecture actually support the same binary name for the same service!! Feel free to adapt and use. EF
set res [catch "exec nslookup localhost" lkup]
if { $res == 0 } {
set l [split $lkup]
set nl ""
foreach e $l {
if { [string length $e] > 0 } {
lappend nl $e
}
}
set hostname ""
set len [llength $nl]
for { set i 0 } { $i < $len } { incr i } {
set e [lindex $nl $i]
if { [string match -nocase "*server*" $e] } {
set hostname [lindex $nl [expr $i + 1]]
break
}
}
if { $hostname != "" } {
puts "Primary DNS server is: $hostname"
} else {
puts "Could not find primary DNS server!"
}
} else {
puts "Could not execute nslookup!"
}KPV : On my windows box, nslookup localhost fails but I can get the DNS Server info by running ipconfig /all.APN : On Windows NT+, if you have TWAPI, you can use the commandget_network_info -dnsserversSee [4].
I have now packaged all this more neatly, information and code can be found at DNS Library Revisited. EF
dns_tree is a command-line-based front-end to dig. It replaces the several dig invocations necessary to fetch a zone, and it formats the output in a somewhat sensible hierarchical style (a tree).dns_browse is a GUI front-end to dns_tree. It allows point-and-click DNS browsing and makes it easy to expand/compress hierarchies in one or more DNS zones.Available at: [5]

TclDNS