On Mon, 2017-06-26 at 11:38 +0300, Mos Yud wrote: > Hi, > > I am using zmq- 4.2.1. > > I would like to establish P2P connection (client-server). Server bind > to a > dynamic port and client should be familiar with the port number in > order to > connect to it. > What is best way to publish the port number to the client? > > Thx. > Moshe.
Zyre can be used for autodiscovery and forming groups: https://github.com/zeromq/zyre If over the same LAN then the default will work with broadcast, otherwise you'll need a well-known "hub" in gossip mode. Alternatively if what you need is a small range of dynamic ports for the server, then you can use CZMQ which supports that: zsock_bind(sock, "tcp://127.0.0.1:![55000-55009]") This will bind to the first free port in that range. Then your client can connect to the whole range, and the one that succeeds will be automatically used. Of course if the range is large then it becomes very inconvenient. Kind regards, Luca Boccassi
signature.asc
Description: This is a digitally signed message part
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
