in reply to Re^3: Closing socket handle of child process (complicated?)
in thread Closing socket handle of child process

You could have the parent call shutdown:

while( <$connection> ) { last if /Close_Server/; } kill( "TERM" => $kidpid ); shutdown( $connection, 1 ); # we should stop writing to socket

That might cause the child to get a "RESET" response if it continues to write after that point (which should cause the TCP stack to refuse to forward future write requests, even if the program ignored the failure and continued to try to write data).

But it might just be that the child is ignoring SIGTERM. You could set up a $SIG{TERM} handler in hopes of preventing that problem.

I recall that children ignore the signals that their parents were ignoring. But I'm surprised to not find documentation of that fact right now. I think that setting $SIG{TERM} would override that but I have a nagging doubt about that.

- tye