M
me
Hi, I'm using IO::Socket:INET in a client/server connect and all is
working well but I want to restrict connections on the server side by
only allowing certain IP addresses to connect (or in the case I was
working to drop the connection if the IP is not contained in a list).
my $sock = new IO::Socket::INET(
LocalPort => $port,
Proto => 'tcp',
Listen => SOMAXCONN,
Reuse => 1);
$sock or die "no socket : $!";
if ($pid = fork) {
log_msg("Parent spawning child process $pid", $logfile);
close $client;
} elsif (defined ($pid = fork)) {
if ($sock->peerhost() ne $accepted_ip) {
printf "$timestamp Connection from $accepted_ip rejected\n";
close $client;
the $sock->PeerHost() is not evaluating as expected. Is this used on
the server side? how to accomplish what I want?
working well but I want to restrict connections on the server side by
only allowing certain IP addresses to connect (or in the case I was
working to drop the connection if the IP is not contained in a list).
my $sock = new IO::Socket::INET(
LocalPort => $port,
Proto => 'tcp',
Listen => SOMAXCONN,
Reuse => 1);
$sock or die "no socket : $!";
if ($pid = fork) {
log_msg("Parent spawning child process $pid", $logfile);
close $client;
} elsif (defined ($pid = fork)) {
if ($sock->peerhost() ne $accepted_ip) {
printf "$timestamp Connection from $accepted_ip rejected\n";
close $client;
the $sock->PeerHost() is not evaluating as expected. Is this used on
the server side? how to accomplish what I want?