Ah, the default is indeed -1, meaning infinite linger, and no message loss.
If you use CZMQ it defaults to 0. Are you using CZMQ or the native C API? The DEALER close should wait until all messages are sent. Still, I'd not trust it; even "sent" can mean "delivered to socket layer but still in transit". -Pieter On Tue, Jan 14, 2014 at 3:29 PM, Lindley French <[email protected]> wrote: > Perhaps I misinterpreted this sentence on the zmq_close() page: > "The default setting of ZMQ_LINGER does not discard unsent messages" > > > On Tue, Jan 14, 2014 at 8:47 AM, Pieter Hintjens <[email protected]> wrote: >> >> On Tue, Jan 14, 2014 at 12:34 PM, Lindley French <[email protected]> >> 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. >> >> -Pieter >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
