@@ -190,7 +190,7 @@ leaner than `child_process.exec`. It has the same options.
190
190
This is a special case of the ` spawn() ` functionality for spawning Node
191
191
processes. In addition to having all the methods in a normal ChildProcess
192
192
instance, the returned object has a communication channel built-in. The
193
- channel is written to with ` child.send(message, [sendStream ]) ` and messages
193
+ channel is written to with ` child.send(message, [sendHandle ]) ` and messages
194
194
are recieved by a ` 'message' ` event on the child.
195
195
196
196
For example:
@@ -224,9 +224,25 @@ These child Nodes are still whole new instances of V8. Assume at least 30ms
224
224
startup and 10mb memory for each new Node. That is, you cannot create many
225
225
thousands of them.
226
226
227
- The ` sendStream ` option to ` child.send() ` is for sending a ` net.Socket `
228
- or ` net.Server ` object to another process. Child will receive the handle as
229
- as second argument to the ` message ` event.
227
+ The ` sendHandle ` option to ` child.send() ` is for sending a handle object to
228
+ another process. Child will receive the handle as as second argument to the
229
+ ` message ` event. Here is an example of sending a handle:
230
+
231
+ var server = require('net').createServer();
232
+ var child = require('child_process').fork(__dirname + '/child.js');
233
+ // Open up the server object and send the handle.
234
+ child.send({ server: true }, server._handle);
235
+
236
+ Here is an example of receiving the server handle and sharing it between
237
+ processes:
238
+
239
+ process.on('message', function(m, serverHandle) {
240
+ if (serverHandle) {
241
+ var server = require('child_process').createServer();
242
+ server.listen(serverHandle);
243
+ }
244
+ });
245
+
230
246
231
247
232
248
### child.kill(signal='SIGTERM')
0 commit comments