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


PHP ZMQSocket::getSockOpt方法代码示例

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


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

示例1: recv

 /**
  *  Receive message from socket
  *  Creates a new message and returns it
  *  Blocks on recv if socket is not ready for input
  *
  * @throws Exception if no socket present
  * @return Zmsg
  */
 public function recv()
 {
     if (!isset($this->_socket)) {
         throw new Exception("No socket supplied");
     }
     $this->_parts = array();
     while (true) {
         $this->_parts[] = $this->_socket->recv();
         if (!$this->_socket->getSockOpt(ZMQ::SOCKOPT_RCVMORE)) {
             break;
         }
     }
     return $this;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:22,代码来源:Msg.php

示例2: handleEvent

 /**
  * Handle ZMQ Event.
  */
 public function handleEvent()
 {
     while ($this->socket !== null) {
         $events = $this->socket->getSockOpt(ZMQ::SOCKOPT_EVENTS);
         $hasEvents = $events & ZMQ::POLL_IN || $events & ZMQ::POLL_OUT && $this->buffer->listening;
         if (!$hasEvents) {
             break;
         }
         if ($events & ZMQ::POLL_IN) {
             $this->handleReadEvent();
         }
         if ($events & ZMQ::POLL_OUT && $this->buffer->listening) {
             $this->buffer->handleWriteEvent();
         }
     }
 }
开发者ID:kraken-php,项目名称:framework,代码行数:19,代码来源:ZmqSocket.php

示例3: indexAction

 public function indexAction()
 {
     $context = new ZMQContext();
     $socket = new ZMQSocket($context, ZMQ::SOCKET_DEALER);
     //$socket->setSockOpt(ZMQ::SOCKOPT_IDENTITY,"identity");
     $socket->getSockOpt(ZMQ::SOCKOPT_IDENTITY);
     $socket->connect("tcp://127.0.0.1:5555");
     $zmsg = new Zmq_Msg($socket);
     $zmsg->body_set("Hello world");
     $zmsg->push("echo");
     $zmsg->push("MDPC01");
     $zmsg->push("");
     printf("I: send request to 'echo' service: %s", PHP_EOL);
     echo $zmsg->__toString();
     $zmsg->send();
     return false;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:17,代码来源:Madclient.php

示例4: ZMQContext

<?php

/*
 *  Weather proxy device
 * @author Ian Barber <ian(dot)barber(at)gmail(dot)com>
 */
$context = new ZMQContext();
//  This is where the weather server sits
$frontend = new ZMQSocket($context, ZMQ::SOCKET_SUB);
$frontend->connect("tcp://192.168.55.210:5556");
//  This is our public endpoint for subscribers
$backend = new ZMQSocket($context, ZMQ::SOCKET_PUB);
$backend->bind("tcp://10.1.1.0:8100");
//  Subscribe on everything
$frontend->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, "");
//  Shunt messages out to our own subscribers
while (true) {
    while (true) {
        //  Process all parts of the message
        $message = $frontend->recv();
        $more = $frontend->getSockOpt(ZMQ::SOCKOPT_RCVMORE);
        $backend->send($message, $more ? ZMQ::MODE_SNDMORE : 0);
        if (!$more) {
            break;
            // Last message part
        }
    }
}
开发者ID:inactivist,项目名称:zguide,代码行数:28,代码来源:wuproxy.php

示例5: getTimeout

 public function getTimeout()
 {
     return $this->socket->getSockOpt(\ZMQ::SOCKOPT_RCVTIMEO) / 1000;
 }
开发者ID:wookieb,项目名称:zorro-rpc,代码行数:4,代码来源:ZeroMQClientTransport.php


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