IP ADDRESS OF MACHINE
Rupert Wood
me@rupey.net
Thu Feb 28 02:43:00 GMT 2002
Snodx wrote:
> But 127.0.0.1 is set BY DEFAULT. Using the /bin/netconf
> application I set my standalone computer's proper TCP/IP
> address which was 192.168.0.2.
Does such a thing exist? IP addresses are usually tied to interfaces; if
you have no network card then the only interface you're likely to have
is the loopback one. What could your OS usefully do with this IP? Where
would it store it and why?
Which begs the question what netconf is actually doing. I don't have
access to a linux system here to test. Do you know what it's actually
doing with this IP, which system calls it is using to configure it in
the kernel, etc?
(On a similar note, I'm not sure the gethostbyname(gethostname) solution
is that clean; yes, it should work, but it's relying on cooperation of
/etc/hosts and/or a DNS server. Better would be to obtain a list of
interfaces from the OS and then iterate through asking each for its
address(es). However, I don't know how to do this or if it could be done
portably.)
Rup.
More information about the Gcc-help
mailing list