From 0d3fceb9d299901fc298bfabe18b304f27cacd33 Mon Sep 17 00:00:00 2001 From: chenxy123 Date: Wed, 21 Dec 2016 23:30:19 +0800 Subject: [PATCH] =?UTF-8?q?vn.rpc=E4=B8=AD=E7=9A=84zmq=20socket=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E6=95=B0=E6=8D=AE=E5=89=8D=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?poll=E7=AD=89=E5=BE=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.rpc/vnrpc.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vn.rpc/vnrpc.py b/vn.rpc/vnrpc.py index 7cda51f5..c3a979c9 100644 --- a/vn.rpc/vnrpc.py +++ b/vn.rpc/vnrpc.py @@ -149,6 +149,10 @@ class RpcServer(RpcObject): def run(self): """服务器运行函数""" while self.__active: + # 使用poll来等待事件到达,等待1秒(1000毫秒) + if not self.__socketREP.poll(1000): + continue + # 从请求响应socket收取请求数据 reqb = self.__socketREP.recv() @@ -266,6 +270,10 @@ class RpcClient(RpcObject): def run(self): """客户端运行函数""" while self.__active: + # 使用poll来等待事件到达,等待1秒(1000毫秒) + if not self.__socketSUB.poll(1000): + continue + # 从订阅socket收取广播数据 topic, datab = self.__socketSUB.recv_multipart()