ios - Programmatically get WiFi Gateway, DNS info -
i able wifi ip address information code found online:
is possible identify dns & gateway information well? code it? thanks,
this done using code
#include <resolv.h> #include <dns.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<sys/socket.h> #include<arpa/inet.h> //inet_addr , inet_ntoa , ntohs etc #include<netinet/in.h> #include<unistd.h> -(void) get_dns_servers { res_state res = malloc(sizeof(struct __res_state)); int result = res_ninit(res); if(result==0) { nslog(@"no of dns ip : %d",res->nscount); ( int i= 0; < res->nscount; i++) { nsstring *s = [nsstring stringwithutf8string : inet_ntoa(res->nsaddr_list[i].sin_addr)]; nslog(@"dns ip : %@",s); [server_dns addobject:s]; } } }
Comments
Post a Comment