Created
September 11, 2012 22:46
-
-
Save bnoordhuis/3702743 to your computer and use it in GitHub Desktop.
simple net + child process echo server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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