I use the code from http://www.nodejs.org/api/child_process.html. The main
process will quit when client sent any data to server. (It quited silently
without any more log, so I think it crashed, is it?)
My operation system is Windows 7 x64. Tested both x86 version and x64
version nodejs(0.10.7).
It runs very nice on another 2 computer(one Windows7 x64 and another
Windows XP x86) and linux(ubuntu x64). I cannot find any difference between
my computer and the other Windows7 x64. Any one met same problems?
main.js:
var normal = require('child_process').fork('worker.js', ['normal']);
var special = require('child_process').fork('worker.js', ['special']);
// Open up the server and send sockets to child
var server = require('net').createServer();
server.on('connection', function (socket) {
// just the usual dudes
normal.send('socket', socket);
});
server.listen(1337);
worker.js
console.log("Worker: ", process.pid, " started");
process.on('message', function(msg, client){
if (msg == "socket") {
console.log("Worker: ", process.pid, " got a client");
client.resume();
}
})
process.on('exit', function(){
console.log("Worker: ", process.pid, " over")
});
console:
C:\Test>node main.js
Worker: 5484 started
Worker: 1548 started
Worker: 5484 got a client
C:\Test>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.