PEAR | --System_Socket_Manager | --System_Socket_Listener
Example: require_once 'System/Socket.php'; $Listener = &System_Socket::createListener(array( 'address' => '/tmp/pear.sock', 'domain' => AF_UNIX, 'proto' => SOL_SOCKET, )); while ($Listener->hasSocket) { $Pool = &$Listener->getReadableClients(); while ($Connection = &$Pool->shift()) { if (trim($line = $Connection->readLine()) == 'exit') { $Connection->close(); $Pool->close(); $Listener->close(); } echo $line; } usleep(10); }
require_once 'System/Socket.php'; $Listener = &System_Socket::createListener(array( 'address' => '/tmp/pear.sock', 'domain' => AF_UNIX, 'proto' => SOL_SOCKET, )); while ($Listener->hasSocket) { $Pool = &$Listener->getReadableClients(); while ($Connection = &$Pool->shift()) { if (trim($line = $Connection->readLine()) == 'exit') { $Connection->close(); $Pool->close(); $Listener->close(); } echo $line; } usleep(10); }
[line 81]
'allow' | 'deny' | empty
[line 71]
object System_Socket_Listener System_Socket_Listener( &$socket, object SystemSocket $socket)
object System_Socket_ConnectionPool &getClients( )
object &getExceptionalClients( )
object &getReadableClients( )
object &getWritableClients( )
bool hasAccessRights( int $socket)
Check whether a certain socket resource has access rights.
mixed hostsAllow( string $mask)
mixed hostsAllowDeny( $mask, $allow)
mixed hostsDeny( string $mask)
void hostsReset( [string $allowDeny = null])
bool setPoolClass( [string $poolClass = 'System_Socket_ConnectionPool'])
Set the classname of a (custom) ConnectionPool.