Sample code for 30+ languages & platforms
Objective-C

DNS Lookup

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

Chilkat Objective-C Downloads

Objective-C
#import <CkoSocket.h>
#import <NSString.h>

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

CkoSocket *socket = [[CkoSocket alloc] init];

int maxWaitMs = 10000;
NSString *ipAddr = [socket DnsLookup: @"www.chilkatsoft.com" maxWaitMs: [NSNumber numberWithInt: maxWaitMs]];
if (socket.LastMethodSuccess != YES) {
    NSLog(@"%@",socket.LastErrorText);
    return;
}

NSLog(@"%@%@",@"IP Address: ",ipAddr);