Skip Menu |
 

This queue is for tickets about the IO-Socket-IP CPAN distribution.

Report information
The Basics
Id: 79110
Status: resolved
Priority: 0/
Queue: IO-Socket-IP

People
Owner: Nobody in particular
Requestors: ravale.sushant [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: not able to resolve IPv6 host using IO::Socket::IP on windows machine
Date: Tue, 21 Aug 2012 17:31:39 +0530
To: bug-IO-Socket-IP [...] rt.cpan.org
From: sushant ravale <ravale.sushant [...] gmail.com>
Hi, Followings are the details of my environment: *OS* : Windows Server 2008 R2 Enterprise *Perl* : c:\Perl\bin>perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi- hread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2011, Larry Wall Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com Built Oct 7 2011 15:49:44 Extra modules installed through ppm: Socket Socket::GetAddrInfo IO::Socket::IP Sample code ran: use IO::Socket::IP -register; my $sock = IO::Socket->new( Domain => PF_INET6, LocalHost => "::1", Listen => 1, ) or die "Cannot create socket - $@\n"; print "Created a socket of type " . ref($sock) . "\n"; source : http://search.cpan.org/~pevans/IO-Socket-IP-0.17/lib/IO/Socket/IP.pm Actual Output : c:\Perl\bin>perl c:\iosockip.pl Cannot create socket - no address associated with nodename Expected Output : Created a socket of type ... Extra info : The same code worked on one of my linux box. Thanks, Sushant Ravale
Download (untitled) / with headers
text/plain 1.7k
On Tue Aug 21 08:01:55 2012, ravale.sushant@gmail.com wrote: Show quoted text
> Followings are the details of my environment: > > *OS* : Windows Server 2008 R2 Enterprise > > *Perl* : > c:\Perl\bin>perl -v > > This is perl 5, version 14, subversion 2 (v5.14.2) built for > MSWin32-x86-multi- > hread > (with 1 registered patch, see perl -V for more detail) > > Copyright 1987-2011, Larry Wall > > Binary build 1402 [295342] provided by ActiveState > http://www.ActiveState.com > Built Oct 7 2011 15:49:44 > > Extra modules installed through ppm: > > Socket > IO::Socket::IP
Could you please let me know the versions of these two? $ perl -MSocket -E 'say $Socket::VERSION' $ perl -MIO::Socket::IP -E 'say $IO::Socket::IP::VERSION' Show quoted text
> Socket::GetAddrInfo
This isn't required any more, as Socket 1.97 provides all the right parts. Show quoted text
> Sample code ran: > > use IO::Socket::IP -register; > > my $sock = IO::Socket->new( > Domain => PF_INET6, > LocalHost => "::1", > Listen => 1, > ) or die "Cannot create socket - $@\n"; > > print "Created a socket of type " . ref($sock) . "\n"; > > source : > http://search.cpan.org/~pevans/IO-Socket-IP-0.17/lib/IO/Socket/IP.pm > > Actual Output : > > c:\Perl\bin>perl c:\iosockip.pl > Cannot create socket - no address associated with nodename
That looks like it's upset about binding to "::1". It may be you don't have one, or for some other reason that can't be done. I'm not too familiar with Windows, but perhaps you could try instead: my $sock = IO::Socket->new( Domain => PF_INET6, LocalPort => 0, Listen => 1, ) or die "Cannot create socket - $@\n"; which avoids providing the local hostname directly. Ofcourse in any real application you'd likely put your application's port number here rather than 0. -- Paul Evans
Subject: Re: [rt.cpan.org #79110] not able to resolve IPv6 host using IO::Socket::IP on windows machine
Date: Wed, 22 Aug 2012 11:48:19 +0530
To: bug-IO-Socket-IP [...] rt.cpan.org
From: sushant ravale <ravale.sushant [...] gmail.com>
Download (untitled) / with headers
text/plain 3.5k
I got following results: c:\Perl\bin>perl -MSocket -E "say $Socket::VERSION" 2.006 c:\Perl\bin>perl -MIO::Socket::IP -E "say $IO::Socket::IP::VERSION" 0.17 About the code: my $sock = IO::Socket->new( Domain => PF_INET6, LocalPort => 0, Listen => 1, ) or die "Cannot create socket - $@\n"; Yes, it worked but unfortunately bound to 0.0.0.0, where I was expecting :: (It seems PF_INET6 is ignored somehow) Following is the netstat result: C:\Users\Administrator>netstat -nao | findstr 9999 TCP 0.0.0.0:9999 0.0.0.0:0 LISTENING 10180 A similar socket6 code : use Socket; use Socket6; @res = getaddrinfo('::1', 9999, AF_UNSPEC, SOCK_STREAM); while(scalar(@res)>=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: $!"; $paddr = accept(Client, Socket_Handle); } Gives output (when ran on the same setup): c:\Perl\bin>perl c:\socket6Server.pl host= ::1 port = 9999 Following is the netstat result: c:\Perl\bin>netstat -nao | findstr 9999 TCP [::1]:9999 [::]:0 LISTENING 3356 On Tue, Aug 21, 2012 at 9:22 PM, Paul Evans via RT < bug-IO-Socket-IP@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79110 > > > On Tue Aug 21 08:01:55 2012, ravale.sushant@gmail.com wrote:
> > Followings are the details of my environment: > > > > *OS* : Windows Server 2008 R2 Enterprise > > > > *Perl* : > > c:\Perl\bin>perl -v > > > > This is perl 5, version 14, subversion 2 (v5.14.2) built for > > MSWin32-x86-multi- > > hread > > (with 1 registered patch, see perl -V for more detail) > > > > Copyright 1987-2011, Larry Wall > > > > Binary build 1402 [295342] provided by ActiveState > > http://www.ActiveState.com > > Built Oct 7 2011 15:49:44 > > > > Extra modules installed through ppm: > > > > Socket > > IO::Socket::IP
> > Could you please let me know the versions of these two? > > $ perl -MSocket -E 'say $Socket::VERSION' > > $ perl -MIO::Socket::IP -E 'say $IO::Socket::IP::VERSION' >
c:\Perl\bin>perl -MSocket -E "say $Socket::VERSION" 2.006 c:\Perl\bin>perl -MIO::Socket::IP -E "say $IO::Socket::IP::VERSION" 0.17 Show quoted text
>
> > Socket::GetAddrInfo
> > This isn't required any more, as Socket 1.97 provides all the right parts. >
> > Sample code ran: > > > > use IO::Socket::IP -register; > > > > my $sock = IO::Socket->new( > > Domain => PF_INET6, > > LocalHost => "::1", > > Listen => 1, > > ) or die "Cannot create socket - $@\n"; > > > > print "Created a socket of type " . ref($sock) . "\n"; > > > > source : > > http://search.cpan.org/~pevans/IO-Socket-IP-0.17/lib/IO/Socket/IP.pm > > > > Actual Output : > > > > c:\Perl\bin>perl c:\iosockip.pl > > Cannot create socket - no address associated with nodename
> > That looks like it's upset about binding to "::1". It may be you don't > have one, or for some other reason that can't be done. > > I'm not too familiar with Windows, but perhaps you could try instead: > > my $sock = IO::Socket->new( > Domain => PF_INET6, > LocalPort => 0, > Listen => 1, > ) or die "Cannot create socket - $@\n"; > > which avoids providing the local hostname directly. > > Ofcourse in any real application you'd likely put your application's > port number here rather than 0. > > -- > > Paul Evans >
Download (untitled) / with headers
text/plain 953b
On Wed Aug 22 02:18:42 2012, ravale.sushant@gmail.com wrote: Show quoted text
> c:\Perl\bin>perl -MSocket -E "say $Socket::VERSION" > 2.006 > > c:\Perl\bin>perl -MIO::Socket::IP -E "say $IO::Socket::IP::VERSION" > 0.17
Looks good. Show quoted text
> About the code: > > my $sock = IO::Socket->new( > Domain => PF_INET6, > LocalPort => 0, > Listen => 1, > ) or die "Cannot create socket - $@\n"; > > Yes, it worked but unfortunately bound to 0.0.0.0, where I was
expecting :: Show quoted text
> (It seems PF_INET6 is ignored somehow)
Ahhhh.... Yes. That would be because 'Domain' is used (and deleted) by the IO::Socket constructor to find that it needs to call ::IP in the first place. Hrmmm... Try my $sock = IO::Socket->new( Domain => PF_INET6, # this one to tell IO::Socket to use ::IP Family => PF_INET6, # this one to tell IO::Socket::IP to use 'v6 LocalPort => 0, Listen => 1, ) or die "Cannot create socket - $@\n"; -- Paul Evans
Subject: Re: [rt.cpan.org #79110] not able to resolve IPv6 host using IO::Socket::IP on windows machine
Date: Thu, 23 Aug 2012 15:47:30 +0530
To: bug-IO-Socket-IP [...] rt.cpan.org
From: sushant ravale <ravale.sushant [...] gmail.com>
Download (untitled) / with headers
text/plain 1.5k
I tried: use IO::Socket::IP -register; my $sock = IO::Socket->new( Domain => PF_INET6, # this one to tell IO::Socket to use ::IP Family => PF_INET6, # this one to tell IO::Socket::IP to use 'v6 LocalPort => 0, Listen => 1, ) or die "Cannot create socket - $@\n"; which gave: Cannot create socket - ai_family not supported I tried the exactly same code on linux box : and with success! On Wed, Aug 22, 2012 at 10:04 PM, Paul Evans via RT < bug-IO-Socket-IP@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79110 > > > On Wed Aug 22 02:18:42 2012, ravale.sushant@gmail.com wrote:
> > c:\Perl\bin>perl -MSocket -E "say $Socket::VERSION" > > 2.006 > > > > c:\Perl\bin>perl -MIO::Socket::IP -E "say $IO::Socket::IP::VERSION" > > 0.17
> > Looks good. >
> > About the code: > > > > my $sock = IO::Socket->new( > > Domain => PF_INET6, > > LocalPort => 0, > > Listen => 1, > > ) or die "Cannot create socket - $@\n"; > > > > Yes, it worked but unfortunately bound to 0.0.0.0, where I was
> expecting ::
> > (It seems PF_INET6 is ignored somehow)
> > Ahhhh.... Yes. That would be because 'Domain' is used (and deleted) by > the IO::Socket constructor to find that it needs to call ::IP in the > first place. Hrmmm... > > Try > > my $sock = IO::Socket->new( > Domain => PF_INET6, # this one to tell IO::Socket to use ::IP > Family => PF_INET6, # this one to tell IO::Socket::IP to use 'v6 > LocalPort => 0, > Listen => 1, > ) or die "Cannot create socket - $@\n"; > > -- > > Paul Evans >
Download (untitled) / with headers
text/plain 760b
same problem in This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32- x64-multi-thread perl -MSocket -E "say $Socket::VERSION" 2.006 perl -MIO::Socket::IP -E "say $IO::Socket::IP::VERSION" 0.18 but IO::Socket::INET6 works fine: use IO::Socket::IP; my $socket = IO::Socket::IP->new(LocalPort=>60000, Listen=> 1,); use IO::Socket::INET6; my $socket6 = IO::Socket::INET6->new(LocalPort=>60001, Listen=>1, ); sleep 60; Show quoted text
>netstat -a | grep 6000
TCP 0.0.0.0:60000 proller-nb-w7:0 LISTENING TCP [::]:60001 proller-nb-w7:0 LISTENING same test in freebsd: Show quoted text
>sockstat | grep 6000
root perl5.16.2 32898 3 tcp4 6 *:60000 *:* root perl5.16.2 32898 4 tcp4 6 *:60001 *:*
Download (untitled) / with headers
text/plain 172b
At this point I'd begin to wonder if your Socket::getaddrinfo is built from XS at all, or if it's running in IPv4-only compatibility mode. Go take a look. -- Paul Evans
Download (untitled) / with headers
text/plain 287b
Thank you! default strabwery perl Socket build without ipv6, but after cpan Show quoted text
>force install Socket
all ok: C:\pro\svn\dcppp\examples>netstat -a | grep 6000 TCP [::]:60000 proller-nb-w7:0 LISTENING TCP [::]:60001 proller-nb-w7:0 LISTENING
Download (untitled) / with headers
text/plain 476b
On Thu Dec 27 14:18:00 2012, PRO wrote: Show quoted text
> Thank you! > default strabwery perl Socket build without ipv6, but after > cpan
> >force install Socket
> > all ok: > > C:\pro\svn\dcppp\examples>netstat -a | grep 6000 > TCP [::]:60000 proller-nb-w7:0 LISTENING > TCP [::]:60001 proller-nb-w7:0 LISTENING
Goodgood :) I can close this one now then I guess? Feel free to reopen it if there are still remaining issues. -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.