I've found this script script that I've found very usefull
(http://linide.sourceforge.net/nat-traverse/), yet I'd love to use nat
traverse to set up a udp tunnel to make a browser on host A to connect
to apache listening on HOST B. Both HOST A and HOST B are behind NAT.

** on host A I have this:

perl nat-traverse --cmd="nc -vlp 65000" 40000:host B:40001

Now, "nc" is bound to nat-traverse...

I use my browser to connect to ("nc" gets tha request
and sends it to the UDP tunnel...than waits for the response from he

** on HOST B I have the following:

perl nat-traverse --cmd="perl mediator.pl" 40001:host A:40000

mediator gets data from the UDP tunnel and make a req to apache
(listening locally on port 80) than sends the apache response back to
the tunnel...(whereas NC gets the response and send it to the browser)

here's mediator.pl code:


use strict;
use warnings;
use IO::Socket::INET;
use IO::Handle;

my $key;
my %header;
my $req;
my $line;

chomp($line = );

while( defined($_ = ) )
last unless length $_;
/^ ([\w\-]+) :[\ \t]+ (.+) $/x;
$key = uc($1);
$key =~ tr/-/_/;
$header{$key} = $2

$req = "$line\n";

foreach (sort keys %header)
$req .= $_ . ':' . " $header{$_}\n";

$req .= "\n";

my ($buff, $sock);
$sock = IO::Socket::INET->new(PeerAddr => '', PeerPort =>
'80', Proto => 'tcp') || die "$!";

syswrite $sock, $req;

while ( sysread($sock, $buff, 1024) )
print STDOUT $buff;




tha thing with the whole above scenario is that "nc" exits when the
browser closes the connection...

Does anyone how to sort this out??

How can I bound STDIN e STDOUT to fifo files??

thanks ever so much