本文整理汇总了PHP中ZMQSocket::setsockopt方法的典型用法代码示例。如果您正苦于以下问题:PHP ZMQSocket::setsockopt方法的具体用法?PHP ZMQSocket::setsockopt怎么用?PHP ZMQSocket::setsockopt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZMQSocket
的用法示例。
在下文中一共展示了ZMQSocket::setsockopt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 构造函数
*
* @params $context ZMQContext
* @params $endpoints 套接字链接到的端点
*/
public function __construct($context, $endpoints)
{
if (APS::get_instance()->get_zmq_enabled()) {
$socket = new ZMQSocket($context, ZMQ::SOCKET_XREQ);
$socket->setsockopt(ZMQ::SOCKOPT_LINGER, 0);
$socket->setsockopt(ZMQ::SOCKOPT_HWM, 1000);
foreach ($endpoints as $endpoint) {
$socket->connect($endpoint);
}
self::$sockets[] = $socket;
$this->socket = $socket;
}
}
示例2: __construct
public function __construct($spID = null, $spVer = null, $sender = null, $linger = 100, $sndhwm = 1000, $rcvhwm = 1000)
{
if (self::$context === null) {
self::$context = new ZMQContext(1, false);
self::$poller = new ZMQPoll();
}
$socket = new ZMQSocket(self::$context, ZMQ::SOCKET_DEALER);
$socket->setsockopt(ZMQ::SOCKOPT_LINGER, $linger);
$socket->setsockopt(ZMQ::SOCKOPT_SNDHWM, $sndhwm);
$socket->setsockopt(ZMQ::SOCKOPT_RCVHWM, $rcvhwm);
self::$poller->add($socket, ZMQ::POLL_IN);
$this->socket = $socket;
$this->spID = $spID;
$this->spVer = $spVer;
$this->sender = $sender;
}
示例3: ZMQContext
/**
* Creates an APS client and returns the handler.
*
* @param $spID string
* @param $spVer string
* @param $sender string
* @return The APS client handler on success or false on failure.
*/
function aps_new($spID = null, $spVer = null, $sender = null)
{
if (APSContext::$context === null) {
APSContext::$context = new ZMQContext(3, false);
}
$socket = new ZMQSocket(APSContext::$context, ZMQ::SOCKET_DEALER);
$socket->setsockopt(ZMQ::SOCKOPT_LINGER, APSContext::$linger);
/*
$socket->setsockopt(ZMQ::SOCKOPT_SNDHWM, APSContext::$sndhwm);
$socket->setsockopt(ZMQ::SOCKOPT_RCVHWM, APSContext::$rcvhwm);
*/
if (APSContext::$poller === null) {
APSContext::$poller = new ZMQPoll();
}
APSContext::$poller->add($socket, ZMQ::POLL_IN);
//Add item to the poll set
$aps = new StdClass();
$aps->socket = $socket;
$aps->spID = $spID;
$aps->spVer = $spVer;
$aps->sender = $sender;
return $aps;
}