<?php require_once "Socket/Unix.php"; $socket = new Socket_Unix(array('local' => '/tmp/foo', 'listen' => 1)); $t = $socket->accept(); print $t->read(1024, PHP_NORMAL_READ); print $t->say("world!"); $t->shutdown(); $t->close(); $socket->shutdown(); $socket->close();
<?php require_once "Socket/Unix.php"; $socket = new Socket_Unix('/tmp/foo'); echo $socket->say("hello"); echo "\n"; echo $socket->read(1024, PHP_NORMAL_READ); echo "\n"; $socket->shutdown(); $socket->close();