On Thu, 24 May 2001, Stephen P. Potter wrote:

> perldoc -f gethostbyname will work better, since you are looking for a
> function inside a manpage.

Oops, a typo.

> The problem with this is what name do you use?  This is a DHCP address
> (most likely from DSL).  Most ISP don't provide a static name to a machine,
> they provide a dynamic name same as the IP address.  gethostbyname won't
> work in this case.

But it should still provide you with an IP address, based on the hostname
you pass to it (like what is returned from the hostname() function); this
need not be a FQDN (the Perl Cookbook gives an additional step to force
the retrieval of a FQDN using gethostbyaddr after the call to
address (Class C private, as well), and passing the hostname retrieved
from hostname() yields a correct IP address.

-- Brett


Reply via email to