Sample code for 30+ languages & platforms
JavaScript

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

var socket = new CkSocket();

var maxWaitMs = 10000;
var ipAddr = socket.DnsLookup("www.chilkatsoft.com",maxWaitMs);
if (socket.LastMethodSuccess !== true) {
    console.log(socket.LastErrorText);
    return;
}

console.log("IP Address: " + ipAddr);