PowerBuilder
PowerBuilder
Resolve a Hostname to an IP Address
See more Socket/SSL/TLS Examples
Demonstrates Socket.DnsLookup, which resolves a hostname and returns one numeric IP address.
Background. A maxWaitMs of 0 waits indefinitely; a positive value bounds the wait. Resolved results may be served from Chilkat's process-wide DNS cache.
Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Socket
string ls_IpAddress
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
// Resolve a hostname to a numeric IP address, waiting up to 5 seconds.
ls_IpAddress = loo_Socket.DnsLookup("example.com",5000)
if loo_Socket.LastMethodSuccess = 0 then
Write-Debug loo_Socket.LastErrorText
destroy loo_Socket
return
end if
Write-Debug "Resolved IP address: " + ls_IpAddress
destroy loo_Socket