Quicklinks
DNS is the Domain Name System. DNS converts machine names to the IP addresses that all machines on the net have. It translates (i.e. 'maps') from name to address and from address to name, and some other things. The ActiveSocket DNS objects can be used to query servers running a domain name service (DNS) application. It will send domain name query packets to any designated DNS server. There are three data elements required in order to formulate a DNS query using ActiveSocket:
The Dns objects are part of the ActiveSocket component. Overview of all ActiveSocket objects:
Set objDnsServer = CreateObject ( "ActiveXperts.DnsServer") ' Create object Set objConstants = CreateObject ( "ActiveXperts.ASConstants") objDnsServer.Host = "ns1.interstroom.nl" ' DNS server objDnsServer.Lookup "activexperts.com", objConstants.asDNS_TYPE_ANY ' Show all DNS records WScript.Echo "Lookup, result: " & objDnsServer.LastError If( objDnsServer.LastError <> 0 ) Then WScript.Quit End If If ( objDnsServer.IsAuthoritative = True ) Then WScript.Echo "Server is an authority for this domain" Else WScript.Echo "Server is not an authority for this domain" End If Set objDnsRecord = objDnsServer.GetFirstRecord ' Iterate over all records; get first While ( objDnsServer.LastError = 0 ) Select Case objDnsRecord.Type Case objConstants.asDNS_TYPE_A WScript.Echo "Type : A" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "IPv4 Address : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_AAAA WScript.Echo "Type : AAAA" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "IPv6 Address : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_CNAME WScript.Echo "Type : CNAME" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Alias : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_MX WScript.Echo "Type : MX" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Preference : " & objDnsRecord.Preference WScript.Echo "Mail Exchange : " & objDnsRecord.MailExchange Case objConstants.asDNS_TYPE_NS WScript.Echo "Type : NS" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Name Server : " & objDnsRecord.NameServer Case objConstants.asDNS_TYPE_PTR WScript.Echo "Type : PTR" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Host : " & objDnsRecord.Address Case objConstants.asDNS_TYPE_SOA WScript.Echo "Type : SOA" WScript.Echo "Name : " & objDnsRecord.Name WScript.Echo "Name Server : " & objDnsRecord.NameServer WScript.Echo "MailBox : " & objDnsRecord.MailBox WScript.Echo "Serial : " & objDnsRecord.SerialNumber WScript.Echo "Refresh : " & objDnsRecord.RefreshInterval WScript.Echo "Retry Interval : " & objDnsRecord.RetryInterval WScript.Echo "Expiration Limit : " & objDnsRecord.ExpirationLimit WScript.Echo "Minimum TTL : " & objDnsRecord.MinimumTTL End Select WScript.Echo "TTL : " & objDnsRecord.TTL WScript.Echo Set objDnsRecord = objDnsServer.GetNextRecord ' Iterate over all records; get next Wend
On ftp.activexperts-labs.com, you can find a lot of ActiveSocket samples. These samples are also part of the ActiveSocket installation.
Visit ftp.activexperts-labs.com