文字

HttpRequestPool::socketPerform

(PECL pecl_http >= 0.15.0)

HttpRequestPool::socketPerformPerform socket actions

说明

protected bool HttpRequestPool::socketPerform ( void )

Returns TRUE until each request has finished its transaction.

返回值

Returns TRUE until each request has finished its transaction.

范例

Example #1 A HttpRequestPool::socketPerform() example

<?php
class  MyPool  extends  HttpRequestPool
{
    public function 
send ()
    {
        while (
$this -> socketPerform ()) {
            if (!
$this -> socketSelect ()) {
                throw new 
HttpSocketExcpetion ;
            }
        }
    }

    protected final function 
socketPerform ()
    {
        
$result  parent :: socketPerform ();
        foreach (
$this -> getFinishedRequests () as  $r ) {
            
$this -> detach ( $r );
            
// handle response of finished request
        
}
        return 
$result ;
    }
}
?>
上一篇: 下一篇: