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

Posted by bloggsfred00 on 12/25/06 11:09

Yeah, its the
"$getData = comportcheckfuntion('com1'); "
that is the problem.
I have not been able to find any way to implement that.

dio_read allows you to specify a read size but it objects if you make
it less than 1.

Finding out whether the com port has anything readable is the only
impediment to my making it all work.

Thanks anyway.

Fred.

hackajar@gmail.com wrote:
> 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

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