[nanomsg] Re: bus pattern?

  • From: André Jonsson <nanomsg@xxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Mon, 23 Sep 2013 10:53:23 +0200

On 2013-09-23 10:08, Paul Colomiets wrote:
Hi Andre,

On Mon, Sep 23, 2013 at 10:54 AM, André Jonsson <nanomsg@xxxxxx> wrote:
As I understand it, a bus topology is created with a "bus" node (using bind)
and "client" nodes (using connect). All sockets of NN_BUS type.

Then, all messages sent by any node in this topology is received by all
other nodes. In my mind, for a useful bus topology, a minimum of three nodes
is required (one bus and two clients).

This is true only if "bus" node is "nn_device(bus_socket, -1)",
otherwise you need to
connect each client with each other. Look at the test:

https://github.com/nanomsg/nanomsg/blob/master/tests/bus.c


Ouch!
So that's what the "Warning" comment on nn_bus man page means. I assumed that "path from each node to any other node exists" also included that they are connected to the same bus socket.

I thought it would be elegant to just create a bus that clients can send to and receive messages from at their leisure, without knowing who else is on the bus. But if all bus clients must know all other clients to be able to communicated with them, I don't quite see the point to this pattern... :-/

And using nn_device() is not an option as it is (currently) too difficult to stop.

/André


Other related posts: