Viewing File: /opt/alt/tests/alt-php82-pecl-zmq_1.1.3-1.84f0720.el8/tests/050-sharedcontext.phpt

--TEST--
Test shared context
--SKIPIF--
<?php
	require_once(dirname(__FILE__) . '/skipif.inc');
	if (!in_array ('acquire', get_class_methods ('ZMQContext')))
		die ('skip');
?>
--FILE--
<?php

include dirname(__FILE__) . '/zeromq_test_helper.inc';

$context = ZMQContext::acquire();

$socket1 = new ZMQSocket($context, ZMQ::SOCKET_REP);
$socket2 = ZMQContext::acquire()->getSocket(ZMQ::SOCKET_REQ, 'persistent id');

$dsn = uniqid("inproc://shared-ctx-");

$socket1->bind ($dsn);
$socket2->connect ($dsn);

$socket2->send("hello");
var_dump($socket1->recv());

var_dump ($context->isPersistent());
var_dump ($context->getSocketCount());

echo "OK";

--EXPECT--
string(5) "hello"
bool(true)
int(2)
OK
Back to Directory File Manager
<