[zeromq-dev] What differentiates connected peers on a ZMTP point of view ?

Laurent Alebarde l.alebarde at free.fr
Thu Feb 6 16:34:03 CET 2014

Hi Devs,

I wonder please what differentiates connected peers on a ZMTP point of 
view ?

To be more clear, let's consider this network:

Client 1 
---------------------------------------------------- Server
Client 2 --------------------------------------------------/

In ZMTP internals, I assume it creates a pipe associated with each 
origin address, and on an API side, it provides one identity associated 
to each one. So it creates one mechanism for each pipe and knows which 
instance to use every time in the stateful handcheck process. Is it 
correct ? there is a bijective association between the origin address 
and the identity ?

Let's say that now we have a proxy in between:

Client 1 ----------------------- Proxy 
----------------------- Server
Client 2 ------------------/92.123.321.22

ZMTP on server side has no way to differentiate between Client1 and 2. 
Every message arrives in the same pipe which is the one corresponding to 
its closest peer: the proxy and its address. The only way for the server 
to differentiate the clients is at application level, when identities 
are stacked in the former frames of each message ?

I am a bit confused. Can someone clarify for me please and point in the 
libzmq code what is taken into account to identify the pipes ?

So, if my above hypothesis are right, as I want to manage to proxy a 
ZMTP mechanism like in the following:

_______________client A___________________ 
proxy                  __worker B __
                     _________tunel A______ _____midpoint_____
Client  --inproc--- frontend   /   backend ----tcp---- frontend / 
backend --inproc-- Worker
DEALER              ZMQ_STREAM      DEALER ROUTER  ZMQ_STREAM            
CURVE |              CURVE

I have to create a pool of sockets in the proxy backend, say 1,000 if I 
want to authorize 1,000 simultaneous connexions, and dispatch the 
clients to a sticky socket, and one and only one client per socket.
Client 1 ----------------------------------------------> socket 1: port 
Client 2 ----------------------------------------------> socket 2: port 
Client 1000 ----------------------------------------------> socket 1000: 
port 11000

So, the worker is binded to all these ports. Still, does it work here ?  
Does ZMTP creates a pipe per address on the worker side, even if they 
are binded to the same socket (the answer looks obvious but I prefer a 
confirmation) ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140206/73531ad6/attachment.htm>

More information about the zeromq-dev mailing list