Skip to content

Instantly share code, notes, and snippets.

@RaoHai
Created March 4, 2015 02:00
Show Gist options
  • Save RaoHai/656ae3efb48fdddd49b5 to your computer and use it in GitHub Desktop.
Save RaoHai/656ae3efb48fdddd49b5 to your computer and use it in GitHub Desktop.
send server handle
process.on('message', function(msg, tcp) {
console.log('CHILD got message:', msg, tcp);
});
process.send({ foo: 'bar' });
var fs = require('fs'),
child_process = require('child_process'),
net = require('net');
chatServer = net.createServer();
n = child_process.fork('./child.js');
chatServer.listen(9000);
n.send('server', chatServer);
n.on('message', function(m) {
console.log('PARENT got message:', m);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment