if ( $pid = fork() ) { $threads++; # you mean kids return $pid } # this is kid code # kid does socket but.....then...... exit($result);