perl windows IPv6

 

Questions


I have a Perl/Windows app that uses TCP/IP sockets and I need to add IPv6 support.

I have a Windows 7 64-bit machine that is running IPv6 with a Hurricane Electric tunnel and it scores 10 out 10 on http://test-ipv6.com/ and will access IPv6-only sites such as http://loopsofzen.co.uk/.

It has ActivePerl 5.14.2 (I also tried Strawberry Perl 5.16.0.1).

Here’s a simple test script:

use Socket qw( getaddrinfo );
$host = 'loopsofzen.co.uk';
$port = 80;
$hints = (socktype => SOCK_STREAM, family -> Socket::AF_INET6);
($err, @addrs) = getaddrinfo($host, 0);
die $err if $err;

and this produces the error:

no address associated with nodename at ip.pl line 6.

The (new) getaddrinfo() function appears to be available and it does work if I set $host to use an IPv4 hostname. But IPv6 doesn’t appear to work at all.

What am I missing? Or is Perl/Windows/IPv6 still a lost cause for the time being?

 

 

————————————————-

Answer

The following “works for me” on OSX, which can successfully ping -6 loopsofzen.co.uk.

$ perl -lE'use Socket qw( getaddrinfo );
   ($err, @addrs) = getaddrinfo(q{loopsofzen.co.uk}, 0);
   die $err if $err; print map { "@{[ %$_ ]}" } @addrs;'
protocol 17 canonname  addr ?? socktype 2 family 30protocol 6 canonname  addr ?? socktype 1 family 30

I think your problem isn’t the Perl bit, as the same code Works For Me.

ipv6,perl,windows

[], [], []

Facebook Comments

Post a comment