Hi guys, I need your help
As how node cluster module works, the workers works like normal Socket
Server, also it can listen to a public port, and handle the data client
pass it.
I have couple question about cluster.
1. listening
The master process listen at the public port, but what those workers with
the code `listen(port)` does? did the worker listen at somewhere, or it
just a fake listen?
2. receive data
If I am not misunderstanding, the data from client is send to the master
process, and the master process send an internalMessage like
worker.send(data), if so, the worker should handle data at
process.on('message',..) but not socket.on('data', ...), so we have to
change our workers code not like what cluster module did.
I notice there is a method called cluster._getServer, which would give the
worker a `handle` object which set to `socket._handle`.
3. send data back to client
When send to client, the worker process should send data to master process,
we need call `process.send` to the master process, and the master send data
back to client.
I know few thing about multi-process binding on a same port.
--
Best regards,
桂林 (Gui Lin)
guileen@twitter <https://twitter.com/#!/guileen>
桂糊涂@weibo <http://weibo.com/guileen>
guileen@github <https://github.com/guileen>
--
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