Note that there are some explanatory texts on larger screens.

plurals
  1. POIPv6 with perl on windows not working
    primarykey
    data
    text
    <p>cross-post <a href="http://perlmonks.org/index.pl?node_id=984750" rel="nofollow noreferrer">http://perlmonks.org/index.pl?node_id=984750</a></p> <p>(Possible duplicate of <a href="https://stackoverflow.com/questions/11348206/perl-windows-ipv6">perl windows IPv6</a> ) I tried following sample example from : <a href="https://metacpan.org/module/IO::Socket::IP" rel="nofollow noreferrer">https://metacpan.org/module/IO::Socket::IP</a></p> <pre><code>use IO::Socket::IP -register; my $sock = IO::Socket-&gt;new( Domain =&gt; PF_INET6, LocalHost =&gt; "::1", Listen =&gt; 1, ) or die "Cannot create socket - $@\n"; print "Created a socket of type " . ref($sock) . "\n"; </code></pre> <p>It is giving output as : Cannot create socket - no address associated with nodename</p> <p>I am using ActiveState perl 5.14.2 and have built IO::Socket::IP module on it.</p> <p>Following is the ping result:</p> <pre><code>c:\&gt;ping ::1 Pinging ::1 with 32 bytes of data: Reply from ::1: time&lt;1ms Reply from ::1: time&lt;1ms Reply from ::1: time&lt;1ms Reply from ::1: time&lt;1ms Ping statistics for ::1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms </code></pre> <p>If I use the IPv4 style loopback address 127.0.0.1, the above code works well. I am wondering what I am missing.</p> <p>Update:</p> <p>I just cleaned the perl setup and path, and freshly installed perl 5.14.2 from <a href="http://www.activestate.com/activeperl/downloads" rel="nofollow noreferrer">http://www.activestate.com/activeperl/downloads</a></p> <p>and then I tried following simple code:</p> <pre><code>use strict; use warnings; use Socket qw(getaddrinfo SOCK_STREAM AI_PASSIVE ); my ( $err, @res ) = getaddrinfo( "::", 8086, { socktype =&gt; SOCK_STREAM, flags =&gt; AI_PASSIVE, } ); die $err if $err; </code></pre> <p>it ended with following error: no address associated with nodename at c:\IPv6.pl line 10.</p> <p>But with 127.0.0.1 it returns proper value.</p> <p>I am using windows 2008 R2 box, a same run on my another windows box also fails.</p> <p>I just tried to trace this call in Socket.pm, and found that a "fake_getaddrinfo" is getting called instead of the real getaddrinfo. It seems the XSLoader was either not able to find/load getaddrinfo from Socket.dll or Socket.dll didn't at all have the getaddrinfo. What could be the reason?</p> <p>A similar code below using Socket6 works properly on the same setup:</p> <pre><code>use Socket; use Socket6; @res = getaddrinfo('::', 8086, AF_UNSPEC, SOCK_STREAM); while(scalar(@res)&gt;=5){ ($family, $socktype, $proto, $saddr, $canonname, @res) = @res; ($host, $port) = getnameinfo($saddr, NI_NUMERICHOST | NI_NUMERICSERV); print ("\nhost= $host port = $port"); socket(Socket_Handle, $family, $socktype, $proto) || next; bind(Socket_Handle,$saddr ) || die "bind: $!"; listen(Socket_Handle, 5) || die "listen: $!"; ($host, $port) = getnameinfo($saddr, NI_NUMERICHOST | NI_NUMERICSERV); print ("\nReady for connections \nhost= $host port = $port"); $paddr = accept(Client, Socket_Handle); } </code></pre> <p>So I can't even blame the setup or the system dlls. Is there an issue with perl's built-in IPv6 support for windows' activestate build?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload