标签:
SUB端口可以连接多个PUB端口
context = zmq.Context() socket = context.socket(zmq.SUB) print("Collecting updates from weather server...") socket.connect("tcp://localhost:5666") socket.connect("tcp://localhost:5667") #socket.close() # 可以根据需要关闭连接
context is the container for all sockets in a single process, and acts as the transport for inproc sockets, which are the fastest way to connect threads in one process.
Call zmq_ctx_new() once at the start of a process, and zmq_ctx_destroy() once at the end.
问题:
如果写错了对端地址,根本不知道。
标签:
原文地址:http://my.oschina.net/cppblog/blog/403236