C
C
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat C Downloads
#include <C_CkSocket.h>
void ChilkatSample(void)
{
HCkSocket socket;
int maxWaitMs;
const char *ipAddr;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
socket = CkSocket_Create();
maxWaitMs = 10000;
ipAddr = CkSocket_dnsLookup(socket,"www.chilkatsoft.com",maxWaitMs);
if (CkSocket_getLastMethodSuccess(socket) != TRUE) {
printf("%s\n",CkSocket_lastErrorText(socket));
CkSocket_Dispose(socket);
return;
}
printf("IP Address: %s\n",ipAddr);
CkSocket_Dispose(socket);
}