genesis
2005-07-16 02:41:26 UTC
hola..
tengo el siguiente codig
char nombre[120]
struct hostent *hp
gethostname(nombre, sizeof(nombre))
printf ("Nombre: %s",nombre)
hp=gethostbyname(nombre)
while (hp->h_addr_list[0]
printf("IP es %s ", inet_ntoa(*(struct in_addr *) * hp->h_addr_list++))
printf("\n")
el problema es que me devuelve la dirección de loopback (127.0.0.1) , y quiero que m
entrege la direccion de la eth0 ( en mi caso 192.168.0.2)...
alguna idea ?
muchas gracias
--
genesis
-----------------------------------------------------------------------
Ver este tema: http://www.softwaremix.net/viewtopic-413038.htm
Enviado desde http://www.softwaremix.net
tengo el siguiente codig
char nombre[120]
struct hostent *hp
gethostname(nombre, sizeof(nombre))
printf ("Nombre: %s",nombre)
hp=gethostbyname(nombre)
while (hp->h_addr_list[0]
printf("IP es %s ", inet_ntoa(*(struct in_addr *) * hp->h_addr_list++))
printf("\n")
el problema es que me devuelve la dirección de loopback (127.0.0.1) , y quiero que m
entrege la direccion de la eth0 ( en mi caso 192.168.0.2)...
alguna idea ?
muchas gracias
--
genesis
-----------------------------------------------------------------------
Ver este tema: http://www.softwaremix.net/viewtopic-413038.htm
Enviado desde http://www.softwaremix.net