On Tue, Mar 23, 2004 at 11:26:37AM -0800, Zach wrote:
> cool. IIRC some *nix systems use the gethostbyname() call
> instead of gethostname()

Not really.  Both are standard calls, and they differ.  The first is for 
obtaining the IP address of a host given a name, and the second is for 
obtaining the host name of the host executing the program.

Some programs need to have the host name that they will be perceived as 
by their peers when communicating over TCP/IP.  For these, they may use 
getsockname() to find the IP address through which the connection leaves 
the machine, and then gethostbyaddr() to find the host name corresponding 
to this IP.  This sometimes doesn't work, because gethostbyaddr() may use 
/etc/hosts to find the name, and the peer doesn't have our /etc/hosts.

James Cameron    mailto:quozl at us.netrek.org     http://quozl.netrek.org/

vanilla-devel mailing list
vanilla-devel at us.netrek.org