exit isn't complicated. Waiting to read a command while busy writing output, in Perl, certainly can be complicated. Given that sockets are being used here, select would likely be a useful solution. But fork is equally useful and likely makes for a simpler solution (well, at least if you aren't using a Perl that emulates fork(), such as non-Cygwin Windows Perl does).
I'd be curious what doesn't work about the presented code. I don't see any obvious problem with it. And I don't see where the failing of the code is described.
Also, what the OP calls the "listening parent" seems to me likely (based on the code and on other parts of the description) to actually be the middle process that is reading (not "listening") while the parent of that middle process is the one listening for new connections to come in (and the middle's child, the grandchild process, is the one writing).
Certainly, the code presented is incomplete. But I fail to imagine a likely problem with the grandparent process that would likely point the OP to the problem being with the code presented.
paulc1976, please describe, precisely, how your code fails to behave as you desired. And please provide more code. Best would be to pare down the other code so that you have a minimalist, self-contained example that others can run to observe how it fails to meet your described desired requirements.
- tye
In reply to Re^2: Closing socket handle of child process (complicated?)
by tye
in thread Closing socket handle of child process
by paulc1976
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |