Search code examples
c++csocketszeromq

Why does zmq pack several messages to one TCP frame?


I send messages using ZMQ_PUSH socket with ZMQ_DONTWAIT flag. Each message separated by 300ms (so I seriously doubt, that my thread scheduling is so off). However from time to time several (up to 7 so far) messages are packed to the same TCP frame yet I don't see any retransmissions or reconnections in tcpdump.

Why is it happening? And how can I determine when my message would be sent?


Solution

  • Q : "And how can I determine when my message would be sent?"

    You have zero-chance to know when a message, dispatched to be sent, would finally get down to the wire-level.

    This is a property of the concept, not a bug. It was explicitly explained in the documentation, since the API v2.0+ ( and will most probably remain so forever ). It is fair to add that some insight into the zmq_context-instance's internalities might be derived from a socket_monitor available in the more recent API versions.