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 once at the start of a process, and once at the end.
问题:
如果写错了对端地址,根本不知道。