Hello,

on 10/31/2006 10:54 PM Prathaban Mookiah said the following:
> I thought of sharing my experience of writing a controller to remotely 
> control a robot through a webserver using PHP. Though I could not use PHP 
> alone to do the entire job due the high delay it takes to connect to the 
> telnet port on the robot, (I adopted the PHPTelnet class written by Antone 
> Roundy - http://www.geckotribe.com/php-telnet/), I could not resist using it 
> for some part of the application.

I am not sure why you have such an high delay to connect to the robot.
Anyway, you may want to take advantage of the fact that PHP supports
persistent socket connections using the pfsockopen function. This
certainly avoids the overhead of establishing a socket connection on
every request.


> So the model I used for my purpose is this:
> 
> Browser ---------> WebServer  ---------> Java  --------> Robot
>           AJAX                  PHP                  
> 
> I used PHP to communicate between the Java program which I run in the 
> background and the AJAX calls from the browser. This setup works fine for my 
> purposes and satisifies the strict time constraints.
> 
> If someone has a better idea of implementing this thing in PHP, please do let 
> me know your comments. 

For using AJAX, you may want to take a look at this forms class. It
comes with a plug-in that lets you submit forms without reloading the
current page.

It uses an AJAX approach named COMET. This may be important for your
project because in COMET applications the browser establishes a single
connection to the Web server and uses it to return multiple responses
from the server without reconnecting.

COMET is great in particular for monitoring server site activity that
may take a long time to finish. While the activity is not finished, the
server can send new messages to update the browser.

http://www.phpclasses.org/formsgeneration

There is a lot more to say about COMET based responsive PHP AJAX
applications. You may want to read about it here:

http://www.phpclasses.org/blog/post/58-Responsive-AJAX-applications-with-COMET.html


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to