想问下zmq怎么使用

手册上的demo,好像我运行了,但是请求不到
已邀请:

yangzai - dsad

赞同来自:

$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection to Redis Server sucessfully ";
echo "Redis Server is running: " . $redis->ping();
$context = new \ZMQContext();
$subscriber = new \ZMQSocket($context, \ZMQ::SOCKET_SUB);
$subscriber->connect("tcp://139.199.887.26:56789");
$subscriber->setSockOpt(\ZMQ::SOCKOPT_SUBSCRIBE, "");
echo " zmq Server is running successfully";
while(true) {
try{
$data = $subscriber->recv();
$redis->set('pushMarketListPrice',$data);
}catch (\Exception $e){
var_dump($e);
}
}

要回复问题请先登录注册