nice to meet you too. all workers listen to the same address, why no problem like "address already bind".
why i care about how it works because the i need dispatch connection to workers manually, and the connections need communication, you know like a chat server, A send message to B but they are not on the same process. 在 2012-8-30 晚上11:34,"ribao wei" <[email protected]>写道: > Hi 桂林: > > Nice to see a Chinese in the maillist. > > From what I read, children processes do I/O directly, not through the > master. > > Ribao Wei > > On Thu, Aug 30, 2012 at 9:58 AM, jason.桂林 <[email protected]> wrote: > >> 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 >> > > -- > 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 > -- 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
