while ($client = $server->accept()) { $pid = fork(); if ($pid == 0) { print $client "Welcome to $0"; # etc. # Probably a loop here reading from $client # ... Other stuff exit 0; # Remember to go away when done! } # parent process here close $client; } # and go back to accept.