Skip to content

Instantly share code, notes, and snippets.

@billywhizz
Created May 3, 2010 02:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billywhizz/387683 to your computer and use it in GitHub Desktop.
Save billywhizz/387683 to your computer and use it in GitHub Desktop.
var net = require("net");
var sys = require("sys");
var encoding = "utf8";
var server = net.createServer(function (stream) {
stream.setEncoding(encoding);
stream.addListener('connect', function () {
remote = net.createConnection(5858, "localhost");
remote.setEncoding(encoding);
remote.setTimeout(0);
remote.addListener("connect", function() {
});
remote.addListener("data", function(data) {
stream.write(data, encoding);
});
remote.addListener("end", function () {
stream.end();
remote.end();
});
});
stream.addListener('data', function (data) {
remote.write(data, encoding);
});
stream.addListener('end', function () {
stream.end();
remote.end();
});
});
server.listen(7000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment