Subject: | Server with unspecified LocalAddr and LocalPort failed to start on Windows |
Test example:
use strict;
use lib 'IO-Socket-INET6-2.72/lib/';
use IO::Socket::INET6;
my $srv = IO::Socket::INET6->new(Listen => 1)
or die $@;
warn "Server started at [", $srv->sockhost, ']:', $srv->sockport;
__END__
Both windows 7 and windows xp dies with "IO::Socket::INET6: listen: Invalid argument at t.pl line 5."
After this patch all works as expected. I also removed unnecessary sockaddr_in() calls.
Subject: | need-to-bind-win32.patch |
--- lib/IO/Socket/INET6.pm.orig 2015-01-07 23:19:11.163130587 +0600
+++ lib/IO/Socket/INET6.pm 2015-01-07 23:37:37.484539116 +0600
@@ -251,13 +251,9 @@
}
if ( $family == AF_INET ) {
- my ($p,$a) = sockaddr_in($lres);
- $sock->bind($lres) or return _error($sock, $!, "bind: $!")
- if ($a ne INADDR_ANY or $p!=0);
+ $sock->bind($lres) or return _error($sock, $!, "bind: $!");
} else {
- my ($p,$a) = sockaddr_in6($lres);
- $sock->bind($lres) or return _error($sock, $!, "bind: $!")
- if ($a ne in6addr_any or $p!=0);
+ $sock->bind($lres) or return _error($sock, $!, "bind: $!");
}
if(exists $arg->{Listen}) {