C++
C++
DNS Lookup
Do a DNS lookup to resolve a hostname to an IP address.Chilkat C++ Downloads
#include <CkSocket.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkSocket socket;
int maxWaitMs = 10000;
const char *ipAddr = socket.dnsLookup("www.chilkatsoft.com",maxWaitMs);
if (socket.get_LastMethodSuccess() != true) {
std::cout << socket.lastErrorText() << "\r\n";
return;
}
std::cout << "IP Address: " << ipAddr << "\r\n";
}