AnyEvent-PacketForwarder

 view release on metacpan or  search on metacpan

examples/pktproxy.pl  view on Meta::CPAN

use AnyEvent::Socket;

$AnyEvent::PacketReader::debug = -1;

die <<EOU if @ARGV < 2 or @ARGV > 3;
Usage:
    $0 local_port dst_host[:dst_port] [header_templ]

EOU

my ($local_port, $dst, $header_templ) = @ARGV;
my ($dst_host, $dst_port) = $dst =~ /^(.*?)(?::(\d+))?$/;
defined $dst_host or die "invalid destination host expecification\n";
$dst_port = $local_port unless defined $dst_port;

tcp_server undef, $local_port, sub { PacketProxy->new($_[0], $dst_host, $dst_port) };

AE::cv->recv;

package PacketProxy;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.129 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )