Sample code for 30+ languages & platforms
Unicode C++

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkSocketW.h>

void ChilkatSample(void)
    {
    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    CkSocketW socket;

    int maxWaitMs = 10000;
    const wchar_t *ipAddr = socket.dnsLookup(L"www.chilkatsoft.com",maxWaitMs);
    if (socket.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",socket.lastErrorText());
        return;
    }

    wprintf(L"IP Address: %s\n",ipAddr);
    }