If you connect a DEALER to multiple endpoints it will distribute messages to all of its connections. I think this is a round robin distribution.
If you have some specific logic where you need to choose which server to talk to, you would need a router socket so that you can specify the address. You could implement this as a separate routing so that your DEALER connects to one ROUTER on a broker and then the broker decides which server to talk to. See the lbbroker examples, such as: https://github.com/imatix/zguide/blob/master/examples/C/lbbroker2.c Cheers, Matt On 29 Sep 2013, at 4:25 am, ashish nagar <[email protected]> wrote: > I am using ZEROMQ for distributed messaging application. Need to connect > client (DEALER socket) to multiple servers (ROUTER socket on server side). > What are my options on CLIENT side ? > Create DEALER socket on client side for each server endpoint (ROUTER socket). > Create only ONE DEALER socket on client side and add multiple endpoints. > I tried option 2 - connecting to multiple endpoints but message always goes > to the first connected endpoint. followed following steps: - create DEALER > socket - connect to first endpoint - then on the run time, add another > endpoint to the socket by using socket.connect(endpoint). Do I need to > reconnect? > In DEALER socket, there is no option to send message on a particular endpoint > in case it is connected to multiple endpoints. > > Any idea? > > Thanks > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
