__construct() public method

Socket constructor
public __construct ( string $host = 'localhost', integer $port = 9090, boolean $persist = FALSE, string $debugHandler = null )
$host string Remote hostname
$port integer Remote port
$persist boolean Whether to use a persistent socket
$debugHandler string Function to call for error logging
コード例 #1
0
ファイル: TSocketPool.php プロジェクト: davidnasar/fbthrift
 public function __construct($hosts = array('localhost'), $ports = array(9090), $persist = false, $debugHandler = null)
 {
     parent::__construct('', 0, $persist, $debugHandler);
     foreach ($hosts as $key => $host) {
         $this->servers_[] = array((string) $host, (int) $ports[$key]);
     }
 }
コード例 #2
0
ファイル: TSocketPool.php プロジェクト: euphoria/thrift
 /**
  * Socket pool constructor
  *
  * @param array  $hosts        List of remote hostnames
  * @param mixed  $ports        Array of remote ports, or a single common port
  * @param bool   $persist      Whether to use a persistent socket
  * @param mixed  $debugHandler Function for error logging
  */
 public function __construct($hosts = array('localhost'), $ports = array(9090), $persist = FALSE, $debugHandler = null)
 {
     parent::__construct(null, 0, $persist, $debugHandler);
     if (!is_array($ports)) {
         $port = $ports;
         $ports = array();
         foreach ($hosts as $key => $val) {
             $ports[$key] = $port;
         }
     }
     foreach ($hosts as $key => $host) {
         $this->servers_[] = array('host' => $host, 'port' => $ports[$key]);
     }
 }