[zeromq-dev] Why use two sockets on ZRE?
ph at imatix.com
Thu Feb 21 16:14:50 CET 2013
On Thu, Feb 21, 2013 at 1:39 PM, Neylor Ohmaly Rodrigues e Silva
<nohros.ceo at gmail.com> wrote:
> Why ZRE uses two sockets for node communication. Its not better to use just
> one ROUTER socket and multiplex input/output over it?
This is explained in the Chapter 8 of the Guide where the protocol was
There are several reasons. First, ROUTER-to-ROUTER connections (which
you're suggesting) are not easy. One of the nodes has to cheat in
various ways. Second, this does not work nicely for a real peer to
peer network since it's asymmetric. Third, you aren't certain of
getting a buffer you can send messages to (so you lose the first
messages sent to a node).
So we have a single ROUTER socket for input, and one DEALER per peer
for output. This is simple, and works reliably. FWIW we did experiment
with other combinations like PUB-SUB and PUSH-PULL but they don't work
reliable for various reasons.
More information about the zeromq-dev