[zeromq-dev] Send queue after socket close

Pieter Hintjens ph at imatix.com
Tue Jan 14 14:47:12 CET 2014

On Tue, Jan 14, 2014 at 12:34 PM, Lindley French <lindleyf at gmail.com> wrote:

> According to the docs, by default if a socket is closed, its send queue will
> still be sent. However, the behavior I'm seeing casts some doubt on this.

Where is this stated? Afaik the socket pipes (with messages) are
destroyed when the socket is destroyed, which will wait for the LINGER
time set on that socket, if there are messages waiting to be sent.

> One practical solution would be for the ROUTER to send back a "THANKS"
> message to the DEALER once it has everything, and not allow the socket to
> close until then. I would like to understand the subtleties of the
> implementation, though.

Indeed, that's what you'd want to do. Closing the socket will drop an
undefined messages in flight unless you set infinite linger, which can
lead to your application blocking.


More information about the zeromq-dev mailing list