Created
March 4, 2015 02:00
-
-
Save RaoHai/656ae3efb48fdddd49b5 to your computer and use it in GitHub Desktop.
send server handle
This file contains 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
process.on('message', function(msg, tcp) { | |
console.log('CHILD got message:', msg, tcp); | |
}); | |
process.send({ foo: 'bar' }); |
This file contains 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 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