twin pipes

From: Date: Fri, 19 Apr 2002 06:55:35 +0000
Subject: twin pipes
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1809@lists.php.net to get a copy of this message
Following on from my attempt to use Gtk::input_add() ... In C using GTK+ it is possible to write a GTK+ application that talks to a process using a pair of pipes, one for stdin and one for stdout. This is done using the pipe(), fork() and dup() functions. The parent can send commands by writing to one pipe, and receive responses by reading from the other pipe. In PHP, only a single pipe model appears to have been implemented, using the popen() function. A popen() pipe can either be stdin for a process, or stdout. Not both. On Linux in particular. Can anyone suggest ways to implement the pair of pipes model within a PHP-GTK program? Does PHP provide the functionality? If I have to write a C module, can I dynamically link to it? The user contributed comments on http://php.net/popen make some curious observations. The use of mkfifo by nricciardi@mindspring.com is quite reasonable, but would be fairly expensive. Also, the FIFOs would have to be protected since they exist (for a while) on the filesystem. The task is to write a PHP GUI for a console application that normally interacts through stdin and stdout. The use of Gtk::input_add() is essential to maintain GUI responsiveness during pauses by the child. -- James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/

« previous php.gtk.general (#1809) next »