Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created September 11, 2012 22:46
Show Gist options
  • Select an option

  • Save bnoordhuis/3702743 to your computer and use it in GitHub Desktop.

Select an option

Save bnoordhuis/3702743 to your computer and use it in GitHub Desktop.
simple net + child process echo server
var child_process = require('child_process');
var net = require('net');
var server = net.createServer(function(conn) {
var proc = child_process.spawn('cat', [], { stdio: 'pipe' });
conn.pipe(proc.stdin);
proc.stdout.pipe(conn);
});
server.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment