dio_read timeout?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux