P is for Practical | |
PerlMonks |
child and parent process communicationby techcode (Hermit) |
on Sep 03, 2008 at 07:20 UTC ( [id://708701]=perlquestion: print w/replies, xml ) | Need Help?? |
techcode has asked for the wisdom of the Perl Monks concerning the following question:
I've been hired to to extend some system that is essentially a forking server. Parent wait's for a connection, once detected it forks off the child and let's it handle it's business (login, process requests ...).
One of the modifications requested is that they can order it to drop some connection (all connection for one user - as there can be more than one connection/child for one user). As it is in that business, everyone keeps open connections, even if they have nothning to send, and just enquire link commands every x seconds (keep alive ping). The business is SMS providing (wholesale of SMS's). As it's only the child knowing what user is logged in it, I was thinking of setting a shared memory key to username/id to be dropped, and sending a signal (say SIGUSR1) to program group. Childs would process SIGUSR1 and check if it's their user, and if it is, drop the connection. But I was also thinking on being able to call functions from/in parent (or child) and pass a few parameters. Existing mechanisms such as pipes seem like a way too complicated as I would need to implement a lot of surounding code. Check for anythnig in the pipe ... A perlish idea I have to do that, is to set a shared variable to say "function('param1', 234);" and signal the parent/child(s) who would simply EVAL that - would that even work? Anyone used somethnig like that? Any other, simple way of calling functions from another process, where you "control" (can change code) both sending/receiving sides.Have you tried freelancing? Check out Scriptlance - I work there. For more info about Scriptlance and freelancing in general check out my home node.
Back to
Seekers of Perl Wisdom
|
|