[nanomsg] Re: Multiple endpoints and sending packets

  • From: Dirkjan Ochtman <dirkjan@xxxxxxxxxx>
  • To: nanomsg <nanomsg@xxxxxxxxxxxxx>
  • Date: Thu, 15 Jan 2015 22:09:58 +0100

On Thu, Jan 15, 2015 at 6:18 PM, Carlos Rafael Giani
<dv@xxxxxxxxxxxxxxxxxx> wrote:
> from what I can see, when I connect multiple endpoints and send a packet,
> one of the endpoints (based on priority) will be picked, and the packet will
> be sent over it. The docs speak about some socket types sending the packet
> to *all* endpoints. But what is the socket type? I do not specify this type
> anywhere.
>
> The underlying issue is that I want the latter behavior. That is, send to
> all endpoints, not just one. Is there a way to configure this?

http://nanomsg.org/v0.5/nn_socket.3.html:

int nn_socket (int domain, int protocol);

protocol parameter defines the type of the socket, which in turn
determines the exact semantics of the socket. Check manual pages for
individual SP protocols to get the list of available socket types.

BUS is a protocol which consists of a single socket type, BUS. PUB-SUB
is a protocol, which consists of two socket types, PUB and SUB. In the
BUS protocol, all connected endpoints receive a message you send from
a socket. In the PUB-SUB protocol, all connected endpoints receive a
message you send from a PUB socket.

Which part is not clear to you?

Cheers,

Dirkjan

Other related posts: