NAME

SRS::EPP::Proxy::Listener - socket factory class

SYNOPSIS

my $listener = SRS::EPP::Proxy::Listener->new(
    listen => [ "hostname:port", "address:port" ],
    );

# this does the listen part
$listener->init;

# this normally blocks, and returns a socket.
# it might return undef, if you pass it a timeout.
my $socket = $listener->accept;

DESCRIPTION

This class is a TCP/IP listener. It listens on the configured ports for TCP connections and returns sockets when there are incoming connections waiting.

You don't actually need to supply the port or listen addresses; the defaults are to listen on INADDR_ANY (0.0.0.0) or IN6ADDR_ANY (::) on port epp(700).

If the IO::Socket::INET6 module is installed, then at load time the module tries to listen on a random port on the IPv6 loopback address. If that works (or fails with a particular plausible error, if something else happened to be using that port), then IPv6 is considered to be available. This means that the RFC3493-style getaddrinfo and such are used instead of gethostbyname. You will end up with a socket for every distinct address returned by getaddrinfo on the passed-in list.

IPv6 addresses (not names) must be passed in square brackets, such as [2404:130:0::42].

In general these rules should make this listener behave like any normal IPv6-aware daemon.

SEE ALSO

IO::Socket::INET, Socket6, IO::Socket::INET6

AUTHOR AND LICENCE

Development commissioned by NZ Registry Services, and carried out by Catalyst IT - http://www.catalyst.net.nz/

Copyright 2009, 2010, NZ Registry Services. This module is licensed under the Artistic License v2.0, which permits relicensing under other Free Software licenses.