Please look at the snippet and tell why it is not giving the correct ip address in dotted decimal. my system is not multihomed as ifconfig gives only one inet address for the eth0( the only interface except lo). #include<stdio.h> #include<sys/utsname.h> #include<malloc.h> #include<netdb.h> #include<sys/socket.h> int main(){ struct utsname *name; int i; struct hostent *hnt; name = (struct utsname *)malloc(sizeof(struct utsname)); hnt = (struct hostent *)malloc(sizeof(struct hostent)); i= uname(name); hnt = gethostbyname(name->nodename); if(i>=0) printf("Network address:\t%s\n",inet_ntoa(hnt->h_addr)); return; } The name->nodename gives the correct hostname. If it is wrong how do I get the correct ip address for my localhost. Pardon me if something like this has been asked but I am a newbie and I am stuck here. Thanking you Murgan _________________________________________________________ Click below to visit monsterindia.com and there is always a better job for you at http://monsterindia.rediff.com/jobs -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/