On 7 June 2012 20:34, Steven McCoy <[email protected]> wrote: > The beginning of the guide makes it look like I should use ZMQ_PUSH and > ZMQ_PULL to implement a worker-thread pool. > > - taskvent: Parallel task ventilator in > C<http://zguide.zeromq.org/page:all> > - taskwork: Parallel task worker in C<http://zguide.zeromq.org/page:all> > - tasksink: Parallel task sink in C <http://zguide.zeromq.org/page:all> > > If however I implement this using threads and the inter-thread socket I > get EADDRINUSE when trying to bind on second worker thread. > > This is exactly as in Figure 65 - The SImple Black Box Pattern ? > > Or am I just being confused by the flipping of zmq_bind and zmq_connect in the examples?
*// Socket to send messages on* void *sender = zmq_socket (context, ZMQ_PUSH); zmq_bind (sender, "tcp://*:5557"); *// Socket to send start of batch message on* void *sink = zmq_socket (context, ZMQ_PUSH); zmq_connect (sink, "tcp://localhost:5558"); Both connect and bind on a ZMQ_PUSH socket? This is mentioned in the guide: In theory with ØMQ sockets, it does not matter which end connects, and which end binds. With inter-thread sockets I must have the bound socket up before the connecting client. The missing statement is that only socket can be bound to an endpoint, whilst multiple sockets can be connected? Can this be made more obvious in the manpages as it is hidden in the guide. -- Steve-o
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
