Unicode C
Unicode C
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat Unicode C Downloads
#include <C_CkSocketW.h>
void ChilkatSample(void)
{
HCkSocketW socket;
int maxWaitMs;
const wchar_t *ipAddr;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
socket = CkSocketW_Create();
maxWaitMs = 10000;
ipAddr = CkSocketW_dnsLookup(socket,L"www.chilkatsoft.com",maxWaitMs);
if (CkSocketW_getLastMethodSuccess(socket) != TRUE) {
wprintf(L"%s\n",CkSocketW_lastErrorText(socket));
CkSocketW_Dispose(socket);
return;
}
wprintf(L"IP Address: %s\n",ipAddr);
CkSocketW_Dispose(socket);
}