Ver Mensaje Individual
  #4 (permalink)  
Antiguo 09/02/2012, 17:04
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Telnet via PHP a equipos CISCO

Lee el siguiente comentario:
Cita:
OK, WRT to the p* functions opening a new connection when one already exists. It is my understanting that (under Apache anyways) this is on a per-process basis. If you do a 'ps auxw|grep httpd' on your server you will see more than one process. What p* does is make a p-connection on one of those processes only, the one that actually handles your request. Chances are that when you hit the page again it will be answered by a different process. I'm guessing if you keep hitting reload you'll get around to the original process again and there will be no error message or second connection open. Anyhow, this is true of all p* functions; they open not one connection per server, but one connection per server _process_.
Básicamente es una conexión persistente por thread o proceso del Web Server, no por script de PHP.

Necesitas realmente tener un segundo script de fondo que sea el que interactue por telnet con el servidor, luego tengas un script paralelo que sea el que acepte los comandos y lo envié al que esta de fondo, por último en tu UI (HTML + AJAX) despliegas la información y mandas los comandos de regreso.

Es básicamente como un script IRC, necesitas tener un servicio de fondo de manera persistente para que tengas la garantía que estas usando la misma conexión por a tu servidor.

Saludos.