PowerBuilder
PowerBuilder
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Socket
integer li_MaxWaitMs
string ls_IpAddr
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Socket = create oleobject
li_rc = loo_Socket.ConnectToNewObject("Chilkat.Socket")
if li_rc < 0 then
destroy loo_Socket
MessageBox("Error","Connecting to COM object failed")
return
end if
li_MaxWaitMs = 10000
ls_IpAddr = loo_Socket.DnsLookup("www.chilkatsoft.com",li_MaxWaitMs)
if loo_Socket.LastMethodSuccess <> 1 then
Write-Debug loo_Socket.LastErrorText
destroy loo_Socket
return
end if
Write-Debug "IP Address: " + ls_IpAddr
destroy loo_Socket