develooper Front page | perl.perl5.porters | Postings from December 2016

[perl #88080] Listen to socket does not return when host isundefined or 0.0.0.0.

Thread Previous
From:
James E Keenan via RT
Date:
December 31, 2016 15:14
Subject:
[perl #88080] Listen to socket does not return when host isundefined or 0.0.0.0.
Message ID:
rt-4.0.24-21293-1483197248-1022.88080-15-0@perl.org
On Fri, 08 Apr 2011 08:47:19 GMT, boilund wrote:
> This is a bug report for perl from bo.johansson@lsn.se,
> generated with the help of perlbug 1.39 running under perl 5.12.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> The perl function listen does not return when host is undefined or
> 0.0.0.0.
> Sometimes it also gets Windows 7 in unstable state and normal shut
> down is impossible.
> 
> Example: This is setup_listener from HTTP-Server-Simple-
> 0.44/lib/HTTP/Server/Simple.pm
> 
> sub setup_listener {
>     my $self = shift;
> 
> my $tcp = getprotobyname('tcp');
> socket( HTTPDaemon, PF_INET, SOCK_STREAM, $tcp ) or croak "socket:
> $!";
> setsockopt( HTTPDaemon, SOL_SOCKET, SO_REUSEADDR, pack( "l", 1 ) )
>     or warn "setsockopt: $!";
> bind( HTTPDaemon,
>     sockaddr_in(
>         $self->port(),
>         (   $self->host
>             ? inet_aton( $self->host )
>             : INADDR_ANY
>         )
>     )
>     )
>     or croak "bind to @{[$self->host||'*']}:@{[$self->port]}: $!";
> listen( HTTPDaemon, SOMAXCONN ) or croak "listen: $!";
> }
> 
> If $self->host is undefined or '0.0.0.0' the call to listen does not
> return.
>   Sometimes it gets Windows 7 in unstable state and
> 

Can the problem with Perl function 'listen' (assuming there *is* a problem) be demonstrated apart from this use in HTTP::Server::Simple?

The code provided is not sufficient to reproduce the problem (at least by a person not already familiar with that module).

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=88080

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About