You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that a delay is needed after creating and binding a PUB socket before the first message can be successfully published. In testing, a 200ms delay seems to be the minimum required delay. There seems to be no difference between various protocols (tried TCP and IPC). The following graph shows the send_multipart success rate vs. the delay time after bind for various delays (30 trials each).
What is going on here? Is there a more deterministic way to check if the PUB socket is ready to send rather than adding arbitrary delays?
A sub socket only sees messages after it has successfully connected to a pub socket.
To synchronize state you'd have to also create another type of socket which tells you at which state the sub socket is currently, aka you'd have to create some form of bookkeeping for your messages in some form of stable storage.
the "client" can then tell the "server" which messages it has received already and then the server can send whats missing.
Or you might go and use the zmq_socket_monitor to tell you when the sub socket has connected and then let the pub socket start sending messages.
libzmq: 4.3.5 via PyZMQ 26.2.0 (Python 3.10)
OS: macOS 13.6.6, Ubuntu 22.04
It appears that a delay is needed after creating and binding a
PUB
socket before the first message can be successfully published. In testing, a 200ms delay seems to be the minimum required delay. There seems to be no difference between various protocols (tried TCP and IPC). The following graph shows thesend_multipart
success rate vs. the delay time afterbind
for various delays (30 trials each).What is going on here? Is there a more deterministic way to check if the
PUB
socket is ready to send rather than adding arbitrary delays?Test Code (Python)
The text was updated successfully, but these errors were encountered: