dio_read timeout?

From: Date: Tue, 10 May 2005 18:14:35 +0000
Subject: dio_read timeout?
Groups: php.general 
Request: Send a blank email to php-general+get-214873@lists.php.net to get a copy of this message
I'm using dio_read to read data from a serial port via a php cli script, this works great. However I'm unable to get dio_read to timeout if there's no data to read. No matter how I formulate the while loop, set_time_out, etc I can't seem to get it to stop reading and move on. Anyone have a work around or ideas? Example snippet, where $fd is a valid file descriptor. function readData($fd) {
        $startTime=microtime();
        $endTime=$startTime+'.02';
        $data=null;
$i=0;
        #while($startTime < $endTime){
while($i < 5) {
                $data.=dio_read($fd);
                if($data) {
                   echo "Here's some data: $data\n";
                   break;
                }
$i++;
        }
} //end function

« previous php.general (#214873) next »