VBScript
VBScript
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set socket = CreateObject("Chilkat.Socket")
maxWaitMs = 10000
ipAddr = socket.DnsLookup("www.chilkatsoft.com",maxWaitMs)
If (socket.LastMethodSuccess <> 1) Then
outFile.WriteLine(socket.LastErrorText)
WScript.Quit
End If
outFile.WriteLine("IP Address: " & ipAddr)
outFile.Close