Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-02 Thread Matt Connolly
On 3 Jan 2014, at 12:16 am, Pieter Hintjens wrote: > On Wed, Jan 1, 2014 at 11:48 PM, Matt Connolly wrote: > >> 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 c

Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-02 Thread Pieter Hintjens
On Wed, Jan 1, 2014 at 11:48 PM, Matt Connolly wrote: > disconnect socket, receive messages until you get an ENOTCONN error. Sure, if you connect and then disconnect, you might conceivably still get messages coming in. It's unclear whether this makes sense: a disconnect should perhaps destroy th

Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-01 Thread Matt Connolly
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

Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-01 Thread Pieter Hintjens
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 wrote: > PH> The behavior should be fixed at the libzmq

Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-01 Thread Gregg Irwin
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 message

Re: [zeromq-dev] Reading queued messages after disconnect

2014-01-01 Thread Pieter Hintjens
The behavior should be fixed at the libzmq level IMO, and documented. I'd suggest that reading from a socket that was neither bound nor connected is an error, and should perhaps even assert. Or at least return an ENOTCONN error. -Pieter On Mon, Dec 30, 2013 at 1:37 PM, Matt Connolly wrote: > Aft

Re: [zeromq-dev] Reading queued messages after disconnect

2013-12-30 Thread Matt Connolly
After some further testing with czmq, I have discovered that the behaviour of not being able to read from a socket when not bound is particular to the ruby rbczmq bindings, and that czmq does not operate this way. I’m curious if other bindings such as python are the same as czmq. I can update t

[zeromq-dev] Reading queued messages after disconnect

2013-12-29 Thread Matt Connolly
Dear list, I’ve been playing around with how to ensure that a service has processed all messages that it has received (in the receiving socket queue) before shutting down. In particular, I’m using the rbczmq ruby bindings, so this question is also to see if those bindings are consistent with ot