I need to resolve the IP address from the hostname in iOS. I know this is trivial with NSHost, however NSHost's resolution capabilities seem to work only with OSX.
Thanks in advance.
Like this:
struct hostent *host_entry = gethostbyname("stackoverflow.com"); char *buff; buff = inet_ntoa(*((struct in_addr *)host_entry->h_addr_list[0]));
buff now contains ip address ...
please check that this link can help you ........
http://blog.zachwaugh.com/post/309927273/programmatically-retrieving-ip-address-of-iphone