I’m trying to create a simple nodejs server to server program.
Here’s what I’m trying to achieve:
-----------¦remote¦-----satellite link-----¦core¦---------
port 6999 port 7000 port 6999
I need to write node.js code for both ‘remote’ and ‘core’.
Here’s what I have sofar (I’m a very confused now…):
//remote.js
var util=require('util');
var net=require('net');
var input=net.createServer(function(inputStream){
inputStream.on('data', function(data) {
util.puts(data);
});
var output=net.createServer(function(outputStream) {
outputStream.pipe(inputStream, {end: false});
outputStream.on('data',function(dta){
util.puts(dta);
});
});
output.listen(7000, '172.16.1.224');
});
input.listen(6999, '172.16.1.224');
Once I have these two forwarding modules (remote and core) up-and-running, I’m hoping to do some packet inspection…
Many thanks in advance,
you need to call createConnection for output stream. Look at my port forwarding code here