On Jan 23, 2012, at 6:01 PM, Lucas Hope wrote:

> Hi Chuck,
> 
> I think the only requirement for a null message is for a REP/REQ socket. 
> Those are the sockets that (I think) mandate the null delimiter for the 
> envelope part.
> 
> In this example, there are no intermediate devices between the router and the 
> workers, and so the number of envelopes is 1, and hence there is no need to 
> delimit - since the workers are dealers.
> 
> I do think this is bad coding style in the examples, and it caused me 
> confusion when I first started using ZMQ.

A DEALER socket is a synonym for XREQ and a ROUTER socket is a synonym for 
XREP. The REQ & REP sockets are built on top of those other types. When sending 
data from a REQ to a ROUTER socket, for example, you will see that the ROUTER 
socket receives the message as IDENTITY + NUL part + payload. The NUL part is a 
requirement for routing via intermediate devices. Eliminating that NUL part may 
work for directly connected sockets, but the routing will very likely break if 
there are any intermediate sockets (like a QUEUE device). If it works without 
the NUL part, then it's probably just luck and we shouldn't count on it working 
in the future.

This page (http://www.zeromq.org/tutorials:xreq-and-xrep) that I wrote many 
moons ago came about from my investigation into how all of these things work. 
As far as I know, that page is correct for libzmq 2.x and 3.1.x.

I think the guide should be fixed.

cr


_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to