[zeromq-dev] Examples and returned errors

Marco Trapanese marcotrapanese at gmail.com
Thu May 31 09:57:19 CEST 2012


Hello,

if I compile an example reported in the guide (debian wheezy, zmq 
2.1.11) I get an error after setting the HWM.

I'm talking about the durapub2 - Durable but cynical publisher in C.
Here the complete code:

#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <inttypes.h>

int main (void) {
   void *context = zmq_init (1);
   void *publisher = zmq_socket (context, ZMQ_PUB);

   uint64_t hwm = 32;
   int err;

   zmq_setsockopt (publisher, ZMQ_HWM, &hwm, sizeof (hwm));
   err = zmq_errno();
   printf("%d\n", err);	// ------------> returns 22

   zmq_bind (publisher, "tcp://*:5565");

   zmq_close (publisher);
   zmq_term (context);
   return 0;
}


I'm sure I'm doing wrong something.
Please, may you help me to understand what?

Thanks
Marco




More information about the zeromq-dev mailing list