On Aug 26, 2012, at 11:23 AM, Alexander Voron wrote: > I have the following task: > > Clients connect to a server on 1 port (e.g. 8080). The server should > remember them and after completing calculation it should send results > to the clients. After that server gets some results again and again > sends it to all clients. And so on. > > How can server mantain connections with all clients? > > I considered PUP\SUB pattern, but my server and clients can sit at > different networks\behind NAT. I've found some code uses PUB\SUB model > and works with NAT here > http://grokbase.com/t/zeromq/zeromq-dev/112q9934vg/nat-firewall-pub-sub-traversal > however I have no idea how it works, how can publisher send messge > behind NAT. > > I think the most robust solution is connection should be initiated by client.
You should investigate the Majordomo protocol that is described in the guide. It relies on DEALER/ROUTER sockets for "remembering" how to route replies back to the original client. Right now it only handles a single reply going back to a client for each request, but you could easily modify it so that a client could receive multiple replies. I have done so for a private project of mine and it was easy. If you haven't read the guide yet, you should. It covers many different use-cases and scenarios. cr _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
