note 74573 rejected from function.posix-mkfifo by tularis
| From: | tularis@php.net | Date: | Wed, 18 Apr 2007 16:11:07 +0000 |
| Subject: | note 74573 rejected from function.posix-mkfifo by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125552@lists.php.net to get a copy of this message | ||
Note Submitter: matth at NOSPAM dot mlalonde dot net
----
<?php
/**
* Taken from: http://www.phpdig.net/ref/rn49re1056.html
**/
$fifo = '/tmp/testfifo';
if (file_exists($fifo) || $login = posix_mkfifo($fifo, 0666)) {
echo "Testing FIFO:\n";
$result =
cat < $fifo & echo "Hi there" > $fifo;
echo "Got back '$result'\n";
} else {
echo "Could not create FIFO.\n";
}
?>
You will note that FIFOs are *not* asynchronous, so your script will hang until it receives
something! If anyone knows how to do this, I'd really like to hear!