Search Results

Search found 1 results on 1 pages for 'yasirmturk'.

Page 1/1 | 1 

  • How to perform DNS query on iOS

    - by yasirmturk
    i want to perform some DNS queries e.g. to get IP records against a specific domain name, i am looking for a preferred way or some useful snippet for this on iOS 3.2+ SDK. thanx in advance part from other snippets i found this code Boolean result; CFHostRef hostRef; NSArray *addresses; NSString *hostname = @"apple.com"; hostRef = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostname); if (hostRef) { result = CFHostStartInfoResolution(hostRef, kCFHostAddresses, NULL); // pass an error instead of NULL here to find out why it failed if (result == TRUE) { addresses = (NSArray*)CFHostGetAddressing(hostRef, &result); } } if (result == TRUE) { [addresses enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSString *strDNS = [NSString stringWithUTF8String:inet_ntoa(*((struct in_addr *)obj))]; NSLog(@"Resolved %d->%@", idx, strDNS); }]; } else { NSLog(@"Not resolved"); } but this is producing same IP for every host Resolved 0-220.120.64.1 any help??

    Read the article

1