[zeromq-dev] zeromq dealer connecting to service

Matt Connolly matt.connolly at me.com
Tue May 6 22:49:47 CEST 2014


The ZMQ api documentation for creating sockets has some great information that will answer your question:

http://api.zeromq.org/4-0:zmq-socket
>> A socket of type ZMQ_DEALER is an advanced pattern used for extending request/reply sockets. Each message sent is round-robined among all connected peers, and each message received is fair-queued from all connected peers.
>> 
Cheers,
Matt

On 6 May 2014, at 10:44 pm, manju k <m_a_n_j_u_s_k at yahoo.com> wrote:

> Hi   
> 
> I am new to zeromq and going through the zeromq guide. My query is with Shared Queue (dealer router sockets). Specifically in the example quoted in the document under section Shared Queue (http://zguide.zeromq.org/page:all#Shared-Queue-DEALER-and-ROUTER-sockets)
> 
> In the example code "rrbroker: Request-reply broker in C"
> 
> void *frontend = zmq_socket (context, ZMQ_ROUTER);
> void *backend = zmq_socket (context, ZMQ_DEALER);
> zmq_bind (frontend, "tcp://*:5559");
> zmq_bind (backend, "tcp://*:5560");
> if (items [0].revents & ZMQ_POLLIN) {
>     while (1) {
>             zmq_msg_recv (&message, frontend, 0);
>             zmq_msg_send (&message, backend, more? ZMQ_SNDMORE: 0);
>     }
> }
> 
> If there is a message received on router socket, it is passed on to the server node using the dealer socket. But in this case I did not understand how does the dealer socket know to which IP/port to connect to deliver the message. Bit confused here.
> 
> Thank you.
> Manju
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140507/27c57f13/attachment.htm>


More information about the zeromq-dev mailing list