[zeromq-dev] About CURVE and ROUTER sockets

André Caron andre.l.caron at gmail.com
Sun Jan 18 17:57:41 CET 2015


Hi all,

I've been building an example of a router-router setup in which all nodes
dynamically discover each other.  This currently works like a charm.  Now,
I'm trying to add curve support for this application, which is proving a
bit confusing despite the API's apparent simplicity.

Basically, all my nodes have a single router socket which is used both to
connect to other peers and to receive connections.  However, I can't seem
to do this when each peer has their own curve keypair.

I have two problems:
- the same socket can not be a curve server and client at the same time (so
I need at least both two sockets, one to connect and one to receive
connections); and
- a curve client can only set one server key so I cannot connect to
multiple peers using a single router socket.

The first problem I can live with -- have 2 sockets instead of 1 is not a
major issue.  However, the 2nd problem is really annoying.  Creating a new
socket for each logical outbound connection smes to me like an anti-pattern
in ZeroMQ.

So I'm wondering how I should handle this.

I found this on the zmq_curve(7) man page:

> A socket can change roles at any point by setting new options. The role
affects all zmq_connect and zmq_bind calls that follow it.

Is it safe to assume that I can simply set a new server key before each
zmq_connect()?

Thanks,

André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150118/0d2b8449/attachment.htm>


More information about the zeromq-dev mailing list