Hi,

koert.kuip...@diamondnotch.com said:
> How do I do an orderly shutdown of a socket? Say I want to close a PULL 
> socket.
> Can I do something like:
> 
> 1)      Close the endpoint so that no more messages get added to the queue
> 
> 2)      Process everything that’s left in the queue
> 
> 3)      Terminate

Not quite. At the moment we don't have the equivalent of the POSIX
shutdown() system call, this is something that should probably be added in
a future release.

What you can do is (with respect to a single socket):

1) Process incoming requests, possibly sending replies.

2) Call zmq_close(). Without setting ZMQ_LINGER this will ensure that any
replies queued but not yet sent will get forwardred to the network.

3) Call zmq_term(). This blocks until the messages pending to be sent are
actually sent.

Note this is all for ZeroMQ 2.1 (master branch). 2.0.x just drops
everything on zmq_close(). 2.1.0 will be released shortly.

-mato

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to