in reply to Getting IPv6 with the Cookbook
use IO::Socket::INET qw( AF_INET ); use IO::Socket::INET6 qw( AF_INET6 ); my $server = IO::Socket->new( Domain => ($ip6 ? AF_INET6 : AF_INET), Proto => 'tcp', # Makes sense for this to be variable. LocalHost => $localHost, # You sure you want this? Rarely do. LocalPort => $socket_port, Reuse => 1, Listen => $conn, ) or die "Can't make $protocol server on port $socket_port: $@\n"; print "Running on port $socket_port.\n" if $verbose;
It makes no sense for Proto to be variable since TCP and UDP programs are quite different.
Specifying LocalHost limits the interfaces that can receive the connection. If you wish to only accept connections from the local machine, you'd set this to '127.0.0.1'. Otherwise, don't use this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting IPv6 with the Cookbook
by gokuraku (Monk) on Dec 20, 2007 at 13:35 UTC |