[zeromq-dev] UDP message with zeromq 2.0beta

Martin Sustrik sustrik at 250bpm.com
Thu Jan 21 11:10:18 CET 2010

Martin Sustrik wrote:
> Guo, Yanchao wrote:
>> thanks Martin. I put it into a endless loop and I can see that there is 
>> no packet drop for my local testing.
>> Is there a way to flush the sending thread before program exist?
> No there isn't. There are several reasons for that design:
> 1. Say you are using TCP transport, the connection is broken and there 
> are 1000 messages queued for sending. Flushing would deadlock in such 
> situation.
> 2. With PGM transport, even if you flush messages to the network, 
> there's no guarantee that some packets won't get dropped (by switch or 
> whatever networking device). While consumer may detect the lost and ask 
> for retransmit, the sender will be closed once the retransmit request 
> arrives. Thus, flushing the messages doesn't solve the problem anyway.

The best thing you can do IMO is to wait for few seconds before exiting 
the sender application. This "sefaguard interval" can be though of as a 
timeout, time given to consumer applications to sort out all the 
remaining business they have to accomplish with the sender.


More information about the zeromq-dev mailing list