0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/fixtures/fork2.js
Ryan Dahl 12486a6437 Change API for sending handles
Does not support sending net.Server objects only raw TCPWrap objects.
2011-10-07 16:43:55 -07:00

27 lines
556 B
JavaScript

var assert = require('assert');
var net = require('net');
var connections = 0;
process.on('message', function(m, serverHandle) {
console.log('CHILD got message:', m);
assert.ok(m.hello);
assert.ok(serverHandle);
var server = new net.Server(function(c) {
connections++;
console.log('CHILD got connection');
c.destroy();
process.send({ childConnections: connections });
});
// TODO need better API for this.
server._backlog = 9;
server.listen(serverHandle, function() {
process.send({ gotHandle: true });
});
});