>Use gethostname()/gethostbyname() (or gethostbyaddr()) and then look
>through the 'h_addr_list' array in the 'struct hostent' returned by
>gethostbyname(). That should contain all the network addresses that
>were found for the given host.

That doesn't work when the lookup matches an entry in /etc/hosts, only
the *first* address is returned even if there are multiple entries.
That was my first attempt.

The machine that was returning 127.0.0.1 also had a valid (nonlocal)
IP address listed later in the file.  127.0.0.1 isn't very useful in
my application because it's sent to another host, not used locally.

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to