>Hi > >Can anyone in the group help, I'm trying to read and write from a serial >port using php. > >So far using fsockopen I've managed to open and send data through a serial >port but I'm having real problems reading a response. I've tried fgets >really to no success can anyone spare me some ideas or thoughts? > >Setup: > >Linux box running serproxy ( A tcp to serial port proxy ) IP 192.168.123.192 > >I connect to this from a webserver running on another machine with: ><?php >$fp = fsockopen ("192.168.123.192", 5331, $errno, $errstr, 30); >if (!$fp) { > echo "$errstr ($errno)<br>\n"; >} else { > if(fputs ($fp, "test data".chr(37))){ > echo 'data sent'; > } else { > echo 'no data sent'; > } > while (!feof($fp)) { > echo fgets ($fp,128); > } > fclose ($fp); >} >?> > >The output is being read by a small ap that displays the serial port data >and allows me to send a response, I've logged the response I send at the >linux box on the serial port and serproxy is supposed to translate this back >to tcp port 5331 however I cannot read it with fgets? > >Please help it's driving me mad and I'm sure I'm just being stupid : {
How sure are you the other app is sending something out?... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php