I need help in converting the following socket code to run under PHP 4.2.x, as the older socket_fd_* code no longer works:
$fdr = socket_fd_alloc();
$fdz = socket_fd_alloc();
function socket_canread($sock) {
global $fdr, $fdz;
socket_fd_set($fdr, $sock);
socket_select($fdr, $fdz, $fdz, 0, 10);
$r = socket_fd_isset($fdr, $sock);
socket_fd_zero($fdr);
socket_fd_zero($fdz);
return $r;
}
I read over the php.net/socket_select information, but it seems it requires more work than necessary to get the above to work correctly. Since I am not skilled in PHP nor sockets, I could really use some hints or ideas on how to fix this issue.
-- M