[zeromq-dev] Reading queued messages after disconnect
Matt Connolly
matt.connolly at me.com
Wed Jan 1 23:48:58 CET 2014
The only thing I see wrong is that a blocking recv would block forever on a socket with no connections. I would expect an error in this case, and not an assert, because that could be a useful way to ensure that all messages that have been received by zmq have been processed by the application. i.e.:
disconnect socket, receive messages until you get an ENOTCONN error.
Alternately, poll and while readable recv the messages. This is how I’m doing it at present. (But the ruby bindings doesn’t let me recv with no endpoints, whereas a C program can).
-Matt
On 2 Jan 2014, at 7:36 am, Pieter Hintjens <ph at imatix.com> wrote:
> I'm not sure you can have unreceived messages pending if the socket
> has no binds or connects. A blocking recv() would simply never return
> until the context is shutdown or the process interrupted.
>
> On Wed, Jan 1, 2014 at 10:06 PM, Gregg Irwin <gregg at pointillistic.com> wrote:
>> PH> The behavior should be fixed at the libzmq level IMO, and documented.
>> PH> I'd suggest that reading from a socket that was neither bound nor
>> PH> connected is an error, and should perhaps even assert. Or at least
>> PH> return an ENOTCONN error.
>>
>> Including the case where there are unreceived messages pending?
>>
>> -- Gregg
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list