zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.45k stars 2.34k forks source link

How can I clear the internal buffer of ZMQ multicast without closing the socket? #4662

Open Thiru-01 opened 4 months ago

Thiru-01 commented 4 months ago

I'm using ZeroMQ (ZMQ) to transfer bulk data from a server to multiple groups. The bulk data is divided into small chunks and transmitted accordingly. After sending a predefined window of data, I perform a check for packet loss. If no loss is detected, I proceed to the next window. However, if packet loss is detected, I need to resend the missing packets.

The issue arises when I attempt to resend the missed packets—the client doesn't receive them on the first attempt. To address this, I've implemented a process with 6 to 10 retries, each with an exponential backoff delay. Eventually, the client receives all the missed packets. I suspect that the internal buffer in ZMQ may be overflowing, causing the dropped packets due to a full buffer.

To mitigate this, I would like to clear the internal buffer of the ZMQ multicast without closing the socket. How can I achieve this in ZMQ? Any guidance or code snippets would be greatly appreciated.

I would like to clear the internal buffer of the ZMQ multicast without closing the socket