* Thus wrote Ren Fournier ([EMAIL PROTECTED]): > Thanks for the help, but.... I now get the error "PHP Warning: > socket_set_option() expects exactly 4 parameters, 3 given in > /Users/test/cr.php on line 51" when I run the script. Also, it still > seems to just wait on that "while" line, instead of skipping to the "} > elseif ($elapsed > 5) {" and breaking from the loop (which is what I > want it to do). (Is it just me, or is the PHP documentation on > socket_set_block and socket_set_option a bit too sparse? I mean, where > do you find the docs on those options and values?)
yeah it is rather undocumentated, probably because of its current EXPERIMENTAL status. the actual call should be this: $timeout = array('sec' => 5, 'usec' => 0); socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $timeout); The idea of using the blocking method and letting the read() call to handle the time, makes you're loop simplier and not have to manage the time elapsed. If you want to manage the elapsed time yourself (nonblocking), you'll have to restructure your loop because the read() will fail if no data is available. Not to mention it will be rather unfriendly for your cpu since you're going to have a loop that continue to run for 5 seconds. Another option would be to use the fsockopen/fread tools. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php