[zeromq-dev] What's wrong with this sample?

Martin Sustrik sustrik at 250bpm.com
Fri Jan 20 07:41:27 CET 2012

Hi Rick,

> Hi all.. I'm new to 0MQ -- only found it this morning.  I'm trying to set it up
> initially to have N threads (probably ~10) logging messages to a central
> but separate thread that will receive the packets and log them to a file..
> So, I found a sample pthread based sample and modified it to use
> ZMQ_PUSH and ZQM_PULL over an inproc://logging backend.
> However, the code does not work on either Solaris 10 or OSX Lion..
> The receiver seems to run OK but the test threads doing the sends fail.
> I also tried using tcp sockets but the connect fails in the workers in that
> case.. Any ideas on what I'm missing?  The version of 0MQ I'm using
> is 2.1.1 (latest stable).

The problem is that scope of inproc endpoints is a single context 
object. So, you don't see inproc endpoints created in the different 
context object.

So, in your test, you have to shared the same context object between 
main thread and the worker threads.


More information about the zeromq-dev mailing list