[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How to get the TCP/IP host name



>Would someone know which of these would work on a Mac:
>
>gethostbyname('localhost'); # OK on Win32, not Linux

Works on a Mac, at least in part, assuming you know what to expect from the
return value.  In a scalar context, returns the IP address as a packed 4
character string.

I thought this might be used with gethostbyaddr to get the host name as
well, but I was unable to get that to work in under 5 minutes.

>`hostname` # OK on Linux, not Win32

Works in a Mac.

>$ENV{'HOSTNAME'} # OK on Linux, not Win32

Doesn't work on a Mac in the sense of giving you the hostname, but that's
sort of expected.  It is my understanding that this is not guaranteed to
work on a *nix system either.

-David-

David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org