in reply to Re: perl and getaddrinfo API
in thread perl and getaddrinfo API
use Socket qw(:addrinfo SOCK_RAW); my ($err, @res) = getaddrinfo($hostname, "", {socktype => SOCK_RAW}); die "Cannot getaddrinfo - $err" if $err; while( my $ai = shift @res ) { my ($err, $ipaddr) = getnameinfo($ai->{addr}, NI_NUMERICHOST, NIx +_NOSERV); die "Cannot getnameinfo - $err" if $err; print "$ipaddr\n"; }
copied from http://perldoc.perl.org/Socket.html#(%24err%2c-%40result)-%3d-getaddrinfo-%24host%2c-%24service%2c-%5b%24hints%5d
it gives me error "addrinfo not defined in %Socket::EXPORT_TAGS
perl i am using is 5.8.4. is this because of perl version i am using? or it is something else?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl and getaddrinfo API
by Athanasius (Archbishop) on Apr 20, 2016 at 12:47 UTC | |
|
Re^3: perl and getaddrinfo API
by VinsWorldcom (Prior) on Apr 20, 2016 at 17:29 UTC |