[zeromq-dev] Pub/sub pattern: Binding two sources to same address not working

Bruno D. Rodrigues bruno.rodrigues at litux.org
Sun Jan 12 23:33:34 CET 2014


It was hard for me to understand what are you trying to do but I guess the
simple answer is no, you can't have the same port (ip+port to be correct)
bound multiple times. That's how TCP works.


--
Bruno Rodrigues
Sent from my iPhone

No dia 12/01/2014, às 21:51, Andreas Bauer <brm1 at gmx.net> escreveu:

Hello,

I'm fairly new to ZeroMq and that's why I'm asking for a hint regarding the
correct usage of 0mq. I'm using version 3.2.2. with Java and jeromq
version 0.3.2. My scenario is running on a local machine for test
purposes. Here
is what I try to accomplish (snippets: http://pastebin.com/YG9adHEy).

I have several publishers/sources publishing messages via tcp port 5556.
Furthermore I'm trying to implement various "agents" that receive those
messages by listening at port 5556 and in addtion they
publish their messages also via tcp and port 5556. This is because I want
to add new agents dynamically that can receive messages from existing
agents as well as already running agents can accept messages from the new
agents without reconfiguration. I thought they all need a common port, so I
can configure all agents identically.

Hence I have implementend a source that sends message via tcp and port
5556. I've also got (at the moment only) one agent that subscribes to the
messages sent from the source. This works great unless I try to publish
messages from the agent via port 5556. What I try to say is, when I start
the agent without the "Agent - Source" part (see snippet) the agent ("Agent
-Receiver) receives the messages. If I start the agent also with publisher
part (Agent - Source.init()), the agent does not receive any messages.
http://pastebin.com/YG9adHEy

At the moment I'm a bit stuck, because I'm not sure anymore if it is
possible to have several publishers bind to the same port. I thought it is,
but as mentioned, if try to startup a the publisher within the agent, the
agent can't receive any messages. I thought I can use the Espresso pattern,
but it doesn't work (maybe I've implemented it incorrectly if this was the
right approach).

I need high throughpt therefore I chose the pub/sub pattern. But 0mq offers
so many different message patterns, maybe you can give me a hint if I'm
using the wrong messaging pattern.

Many thanks,

Andreas

_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140112/6b52df39/attachment.htm>


More information about the zeromq-dev mailing list