Monday, July 27, 2009

Linux system command?

Does anyone know what is the system command to use in a Linux C program to get (hostname, IPaddress, network ID, host ID) and also what is the equivalent command to use on the command line to check if it is correct. The IP address should be what is shown as the Internet IP. I keep getting 127.0.0.10 when I use gethostname() which is not the actual IP internet address.





Thanks Lots.

Linux system command?
nslookup is the line command. How are you getting to the internet? If you're behind a firewall or if you're using a cable modem for example, you may be experiencing NATing (Network Address Translation), which will return a private address to you but translate that private address to a public, routable address on the outside of the firewall.





The system call that supports nslookup is gethostbyname() .


No comments:

Post a Comment