Thanks, David and Shlomi (and those that read),

I understand fork() and the style of writing better.  Strange that the
defaults for 'use English' are not optimal.

The snippet below works to fork as a specific user, if run as root.
However, it generates zombies.  The functions wait() or waitpid() seem
to be available to use to stop that, but if I insert either of them in
the outer while loop, only one client can connect at a time.

What modification can prevent zombies yet allow multiple concurrent
clients to attach?

Regards,
Lars

-----

while ( my $client = $server->accept() ) {

    $EUID = $priv_sep_uid;
    my $pid = fork();

    unless ( $pid ) {
        print qq(\tforked as $PROCESS_ID\n);
        while ( my $input = <$client> ) {
                1;
        }
        exit( 0 );
    }

}

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to