Reply to dio_read timeout?

Your name:

Reply:


Posted by Ac on 05/10/05 21:14

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация