[zeromq-dev] Publish / Subscribe vs Multicast

gonzalo diethelm gdiethelm at dcv.cl
Tue Feb 16 15:05:59 CET 2010


[Sorry for a previous, empty message, to the list.]

> > Martin, all I see in the attached PNG is seven white squares on a
black
> > background, with no other markings.
> 
> It corresponds to the diagram in butterfly example that I've linked
you
> to originally:
> 
> http://www.zeromq.org/tutorials:butterfly#toc7

Oh, Ok. I have been using that diagram as a basis for what I am doing.

> > Yesterday, driving home, I convinced myself that what I am doing is
not
> > going to work (which probably means that I will have to convince
myself
> > later that I was wrong about it not working...). Anyway, from what I
> > know about TCP/IP, you can bind only one socket to a given IP
address /
> > port, right? Therefore, how would it be possible to have several
> > instances of component1, all bound to the same endpoint, running at
the
> > same time?
> 
> That's what 0MQ does for you. Single 0MQ socket handles arbitrary
number
> of unerlying TCP sockets.
> 
> > Furthermore, let's say this multiple binding is made possible by
zmq.
> > When send_requests sends a request, how will it know there are two,
> > three or N instances of component1, all bound to the same
destination
> > endpoint, so that send_requests will round-robin between them?
> 
> It knows because component1 instances connects to send_requests.

They connect? Are you saying that component1 should do a connect() in
addition to a bind()? I'll have to look into this...

> Maybe reading the article published recently at LWN would help you to
> get soume background?
> 
> http://lwn.net/Articles/370307/

That article was, in fact, how I got to know about 0MQ.

I know I am being thick here... I wrote two really small examples (34
lines each), called sender and receiver. If I run them like this:

  ./sender   tcp://127.0.0.1:5555 20
  ./receiver tcp://127.0.0.1:5555 20

Then sender sends 20 messages to that endpoint, and receiver gets the
same 20 messages. It works ok.

Now, from what I have understood, I should be able to run things like
this:

  ./sender   tcp://127.0.0.1:5555 40
  ./receiver tcp://127.0.0.1:5555 20
  ./receiver tcp://127.0.0.1:5555 20

And see that each receiver gets at least some of the messages. What I am
seeing is that the first receiver that I run (i.e. the first that does a
bind() on that endpoint) gets 20 messages, and quits. The second
receiver never gets any messages at all.

I am attaching source code for both programs, in the hopes that someone
will tell me what I am doing wrong.

Thanks again.

-- 
Gonzalo Diethelm





----------------------------------------- 
Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sender.cpp
Type: application/octet-stream
Size: 889 bytes
Desc: sender.cpp
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100216/0668d9cb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: receiver.cpp
Type: application/octet-stream
Size: 916 bytes
Desc: receiver.cpp
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100216/0668d9cb/attachment-0001.obj>


More information about the zeromq-dev mailing list