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