Date: Fri, 5 Feb 1999 11:46:56 -0800 (PST) From: Dan Busarow <dan@dpcsys.com> To: "Randy A. Katz" <randyk@ccsales.com> Cc: questions@FreeBSD.ORG Subject: Re: A Perl Question Message-ID: <Pine.BSF.3.96.990205113849.23284D-100000@java.dpcsys.com> In-Reply-To: <3.0.5.32.19990205001838.03baa980@ccsales.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 5 Feb 1999, Randy A. Katz wrote:
> I'm trying to use gethostbyaddr and it is returning blank:
>
> $ipaddress = "216.0.22.30";
> ($name, $aliases, $addrtype, $length, @addrs) =
> gethostbyaddr($ipaddress,AF_INET);
> print "Name: $name\n";
Two things. If you are hardcoding the IP address use
$ipaddress = inet_aton("216.0.22.30");
gethostbyaddr expects $ipaddress to be a four byte "struct".
Second, perldoc Socket says that gethostbyaddr just returns a scalar
name, not a list.
Dan
--
Dan Busarow 949 443 4172
Dana Point Communications, Inc. dan@dpcsys.com
Dana Point, California 83 09 EF 59 E0 11 89 B4 8D 09 DB FD E1 DD 0C 82
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.990205113849.23284D-100000>
