in reply to Re: Multiple consecutive connections to a socket (probably a stupid question)
in thread Multiple consecutive connections to a socket (probably a stupid question)
Oh, I see, thank you. Can there be negative effects, if I place
1 while waitpid(-1, WNOHANG) > 0;immediately after the "system(1, ..." line? (I checked, it works. I suppose it marks a still running process to be "reaped automatically")
One more question. Client code catches all errors, and therefore, in theory, it always sends a reply to "server". But, if it does something horrible and Perl interpreter crashes ("out of memory" or similar), can server somehow know about it? Maybe using PID returned by "system(1, ...".
Edit (after reading huck's answer): It looks like my "idea" (where do I get them from? I don't know) about "marking for auto-reaping" is wrong. Then, the above line of code can be placed anywhere in the "server", if it's executed with the same (or more) frequency, as creating "clients". Which maybe means, the good place can be not after, but before calling "system". Number of "clients" is limited in real application.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Multiple consecutive connections to a socket (probably a stupid question)
by huck (Prior) on Dec 25, 2016 at 19:53 UTC |