> the 'smarter' way would be having a client side programming language open a
> socket to the server (read: the php script running). the only realy useful
> language is javascript becouse flash and java are not portable on some
> platforms. the next problem is javascript isnt able (for security reasons)
> to open a socket to the outside.

Been there, done that (i.e. already thought about these).

> the only way to do (simplex) communication is to leave the http connection
> open... by default, the connection is kept open until the php scripts
> finishes (or die()'s). by looping php for a sertain amout of time we create
> a 'stable' connection to the client.

Been here too - that's why my original question looks the way it does. So, the
answer is actually "No, there's no smarter way than looping in the PHP" - am I

> an example (dont mind my crappy code format/indenting):
>     $file = file("/tmp/myfile");
>     for($x=$filemax; $x < count($file); $x++)
>       echo $file[$x]."<br>";

I especially liked the bit above. Never used file() myself so the code looked
quite awkward at first glance...

> this example does _not_ handle any file locking and is _verry_ cpu/io
> intensive. alot of other solutions could be uses including database query's
> or shared memory

Another feature of PHP I always overlooked! I'm learning of a lot of overlooked
features from your e-mail!

> ini_set("max_execution_time", "3600");

You could also do a set_time_limit(30) INSIDE the loop. This resets the timeout
counter, so it's a better option.

> the sequenceing of the data: 'is our last row received'... a javascript
> thingy could send a notice to the webserver the client recieved the line...

...which further speeds down the overall process, plus induces a lot of delays
which have to be dealt with (quite complicated, I must say). I think simply
reloading from time to time and sending the last 10 lines for example might be a
better solution.

> hope my 5 euro cents help... :)

Yes, they did - you opened my eyes to a couple of useful but neglected features
of PHP.

Thanks for taking the time to answer!


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to