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

Mikko Koppanen mikko at kuut.io
Fri Jan 20 09:35:41 CET 2012


On Fri, Jan 20, 2012 at 6:26 AM, Rick & Nellie Flower <nrf at ca-flower.com> wrote:
> Any ideas on what I'm missing?  The version of 0MQ I'm using
> is 2.1.1 (latest stable).
>
> The code is here :
> http://pastebin.com/eiZnABd2

Hi Rick,

it looks like you are using the C++ bindings. If you look at the
definition of send and recv:

https://github.com/zeromq/zeromq2-1/blob/master/include/zmq.hpp#L314
https://github.com/zeromq/zeromq2-1/blob/master/include/zmq.hpp#L324

They will return true or false or thow error_t based on status. This
would probably break the following assertion in your code:

assert(socket.send (request)== 0);

Changing the socket.send and socket.recv assertions to == true gives
me the following output on Mac OS X:

$ ./a.out
Starting workers..
Sending Data...
Sending Data...
Sending Data...
Sending Data...
status = 35
Received: Ghiasd!
status = 35
Received: Ghiasd!
status = 35
Received: Ghiasd!
status = 35
Received: Ghiasd!

-- Mikko



More information about the zeromq-dev mailing list