You are here: Re: Reading COM1 with php-win « PHP Programming Language « IT news, forums, messages
Re: Reading COM1 with php-win

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]


Удаленная работа для программистов  •  Как заработать на 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

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