|
Posted by hackajar on 12/25/06 09:16
Windows "COM" ports (like com1, com2, etc) do not have a buffer. They
are a serial interface that connects directly to the CPU (or CPU bridge
I suppose with newer motherboards). You will have to be running in a
loop waiting for data on the COM port to get data off it.
Think:
while(0) {
$getData = comportcheckfuntion('com1'); //You would have to write
this function or get one off internet
if($getData) //do your stuff here
else sleep(1); //sleep for a second and then let loop check com port
again.
}
Cheers,
Hackajar
bloggsfred00@hotmail.com wrote:
> I need to read incoming bytes on a COM port but I do not want to have
> the script hang if there is nothing to read.
>
> Is there any way to have PHP interrogate a COM port buffer to see if
> there is any content before reading it?
>
> Any other method to achieve the result would also be welcome.
>
> Cheers,
>
> Fred.
Navigation:
[Reply to this message]
|