Swift
Swift
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Swift Downloads
func chilkatTest() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let socket = CkoSocket()!
var maxWaitMs: Int = 10000
var ipAddr: String? = socket.dnsLookup(hostname: "www.chilkatsoft.com", maxWaitMs: maxWaitMs)
if socket.lastMethodSuccess != true {
print("\(socket.lastErrorText!)")
return
}
print("IP Address: \(ipAddr!)")
}