Skip to content

Instantly share code, notes, and snippets.

@Gocrazy
Created February 21, 2014 14:46
Show Gist options
  • Select an option

  • Save Gocrazy/9135492 to your computer and use it in GitHub Desktop.

Select an option

Save Gocrazy/9135492 to your computer and use it in GitHub Desktop.
var child_process = require('child_process');
var net = require('net');
var tcpSrv = net.createServer();
tcpSrv.listen(3000, function() {
for (var i = 1; i <= 4; i++) {
var worker = child_process.fork('worker.js');
worker.send(i, tcpSrv._handle);
}
tcpSrv.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment