[zeromq-dev] Reading queued messages after disconnect

Pieter Hintjens ph at imatix.com
Thu Jan 2 15:16:47 CET 2014


On Wed, Jan 1, 2014 at 11:48 PM, Matt Connolly <matt.connolly at me.com> 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 the pipe created during connect.

> 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).

Interesting. I'm also curious why you would want to do this. It seems
wrong. Instead, you'd terminate a protocol properly with whatever
handshake, and then destroy the socket.

-Pieter



More information about the zeromq-dev mailing list