ZeroMQ PUB socket buffers all my out going data when it is connecting

前端 未结 6 1677
栀梦
栀梦 2021-02-02 00:00

I noticed that a zeromq PUB socket will buffers all outgoing data if it is connecting, for example

import zmq
import time
context = zmq.Context()

# create a PUB         


        
6条回答
  •  天涯浪人
    2021-02-02 00:45

    Here's a hack that might help...

    Set your ZMQ::HWM to a fixed number, say 10. Upon connection, call the subscriber socket's recv method in a loop until it discards all the buffered messages, and only THEN start your main receiving loop.

提交回复
热议问题