Thank you to one and all. Going through the forums to solve what I need to do is always a worthwhile experience and generally stops me from needing to post a query.
However at the moment I seem to be stuck. I have a serial to TCP server operating from which I wish to collect N (normally 3) lines of serial data input continuously to be processed by another script. I have been trying sockets but my experience is minimal and sockets seem to always result in errors at the serial server.
Code I am using to sucessfully grab what I need is as follows:
$host = $_SESSION["host"];
$port = $_SESSION["port"];
$nln = $_SESSION["nln"];
$i=0;
while ($i<$nln){
$fp = fsockopen ($host,$port);
if (!$fp){echo "Error: could not open connection to serial data server";}
else {
$data .= fgets($fp);
fclose ($fp);
}
$i++;
$_SESSION["postprocess"]=$data;
}
At the moment I am simply refreshing the page to get the script to re-run and grab the next n lines of data. (meta refresh).
How can I get this to operated firstly in a never ending loop, and secondly as a cli background process always capturing the serial data as it appears on the server port.
I am using apache2 server with php5 on windowsXP.
Again thanks for all the help you provide us novices.