当前位置: 首页>>代码示例>>PHP>>正文


PHP TSocket::setHandle方法代码示例

本文整理汇总了PHP中TSocket::setHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP TSocket::setHandle方法的具体用法?PHP TSocket::setHandle怎么用?PHP TSocket::setHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSocket的用法示例。


在下文中一共展示了TSocket::setHandle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: accept

 public function accept($timeout = -1)
 {
     if ($timeout !== 0) {
         $client = stream_socket_accept($this->handle, $timeout);
     } else {
         $client = stream_socket_accept($this->handle, $timeout);
     }
     if (!\hacklib_cast_as_boolean($client)) {
         return null;
     }
     $socket = new TSocket();
     $socket->setHandle($client);
     $transport = new TBufferedTransport($socket, $this->send_buffer_size, $this->recv_buffer_size);
     return $transport;
 }
开发者ID:davidnasar,项目名称:fbthrift,代码行数:15,代码来源:TServerSocket.php

示例2: accept

 public function accept($timeout = -1)
 {
     if ($timeout !== 0) {
         $client = stream_socket_accept($this->handle, $timeout);
     } else {
         $client = @stream_socket_accept($this->handle, $timeout);
     }
     if (!$client) {
         return false;
     }
     $socket = new TSocket();
     $socket->setHandle($client);
     // We need to create a buffered transport because TSocket's isReadable
     // is not reliable in PHP (hphp is fine) and buffered transport is more
     // efficient (60% faster in my tests)
     $transport = new TBufferedTransport($socket, $this->send_buffer_size, $this->recv_buffer_size);
     return $transport;
 }
开发者ID:jamescarr,项目名称:fbthrift,代码行数:18,代码来源:TServerSocket.php

示例3: acceptImpl

 /**
  * Implementation of accept. If not client is accepted in the given time
  *
  * @return TSocket
  */
 protected function acceptImpl()
 {
     $handle = @stream_socket_accept($this->listener_, $this->acceptTimeout_ / 1000.0);
     if (!$handle) {
         return null;
     }
     $socket = new TSocket();
     $socket->setHandle($handle);
     return $socket;
 }
开发者ID:tomi77,项目名称:sfThriftPlugin,代码行数:15,代码来源:TServerSocket.php


注:本文中的TSocket::setHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。