title: Node.js - forward all traffic from port A to port B
body: <p>I'm trying to forward all traffic from port 6999 to port 7000 (I know I could use iptables, but the idea is to use Node.js to do some packet inspection).</p>
  
  <p>Here is the code I have sofar:</p>
  
  <pre><code>var net=require('net');
  var compress=require('./node-compress/compress');
  
  var ip='172.16.1.224';
  var ipPort=6999;
  var opPort=7000;
  
  var output=net.createServer(function(connOut){
          var input=net.createServer(function(connIn){
                  connIn.pipe(connOut);
          });
          input.listen(ipPort,ip);
  });
  output.listen(opPort,ip);
  </code></pre>
  
  <p>It just does not seem to work. When I do a tcpdump on port 7000, nothing shows up. Anyone have any suggestions?</p>
  
  <p>Many thanks in advance,</p>