Hi All,
I'm currently having some problems using socket_select:
I'm actually making a content filter for postfix, but I want to use PCNTL functions in the program so it responds to kill -TERM signals and so on.
Whenever I run the program it consumes every cpu resource in sight. I've tested the program with the socket_select code taken out and it returns back to only 1-2% cpu load.
Can anybody perhaps suggest an alternative, or offer some insight to this issue.
Code snippet below:
while ( true ) {
/ Prepare the read array /
$read = array($sock);
if (false === ($num_changed_sockets = socket_select($read, $write = NULL, $except = NULL, 0))) {
/ Error handling /
} else if ($num_changed_sockets > 0) {
/ At least at one of the sockets something interesting happened /
if (! AcceptIncommingConnection() ) continue;
}
}
Regards,
Craig Marchant