|
CowBoy |
.arcimaestro.
Registered: May 2006
Posts: 294 (0.04 al dì)
Location: Milano
Corso: F49 - Informatica
Anno: Laureato F49
Time Online: 3 Days, 13:40:27 [...]
Status: Offline
Edit | Report | IP: Logged |
Prova a dare un'occhiata qua: http://www.gsp.com/cgi-bin/man.cgi?...c=gethostbyaddr
EXAMPLES
Print out the hostname associated with a specific IP address:
const char *ipstr = "127.0.0.1";
struct in_addr ip;
struct hostent *hp;
if (!inet_aton(ipstr, &ip))
errx(1, "can’t parse IP address %s", ipstr);
if ((hp = gethostbyaddr((const void *)&ip,
sizeof ip, AF_INET)) == NULL)
errx(1, "no name associated with %s", ipstr);
printf("name associated with %s is %s\n", ipstr, hp->h_name);
__________________
.. ±·ø·±-`` MuSiC iS My LanGuAGe ´´-±·ø·± ..
Last edited by CowBoy on 25-01-2012 at 12:18
|