[nanomsg] Device to route/publish to clients?

  • From: "Terry (Gmail)" <tcorlet@xxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 10 Jun 2015 11:50:27 +0800

Hi All

I'm relatively new and have just started experimenting with nanomsg (I
have used ZeroMQ before).

I'm considering a device for routing server messages to a set of
subscribing clients...something like:

int publisher = nn_socket(AF_SP_RAW, NN_PUB);

nn_bind(publisher, "tcp://publisher_address");


int listener = nn_socket(AF_SP_RAW, NN_PULL);

nn_connect(listener, "tcp://server_address");


nn_device(listener, publisher);


I was hoping that this sort of routing would be able to implement a zero
copy mechanism for message distribution to subscribers. But it doesn't
work, so I am obviously doing something wrong or it's not possible to mix
NN_PUB with NN_PULL. Any suggestions/advice?

Thanks,

Terry

Other related posts: