forward_device.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:treehouse 作者: nonsensews 项目源码 文件源码
def main():

    try:
        context = zmq.Context(1)
        # Socket facing clients
        frontend = context.socket(zmq.SUB)
        frontend.bind("tcp://*:5559")
        frontend.setsockopt(zmq.SUBSCRIBE, "")
        # Socket facing services
        backend = context.socket(zmq.PUB)
        backend.bind("tcp://*:5560")
        # yo! where is the pizza?
        zmq.device(zmq.FORWARDER, frontend, backend)
    except Exception, e:
        logging.error(e)
        print("let it crash")
    finally:
        frontend.close()
        backend.close()
        context.term()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号