Skip to content

Instantly share code, notes, and snippets.

@hintjens
Created August 20, 2010 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hintjens/540685 to your computer and use it in GitHub Desktop.
Save hintjens/540685 to your computer and use it in GitHub Desktop.
//
// Provoke assertion failure in sub.cpp:45
//
#include <zmq.h>
int main () {
void *context; // ØMQ context for our process
context = zmq_init (1);
void *s2;
s2 = zmq_socket (context, ZMQ_SUB);
zmq_setsockopt (s2, ZMQ_SUBSCRIBE, "", 0);
zmq_bind (s2, "inproc://socket");
void *s1;
s1 = zmq_socket (context, ZMQ_SUB);
zmq_setsockopt (s1, ZMQ_SUBSCRIBE, "", 0);
zmq_connect (s1, "inproc://socket");
zmq_msg_t message;
zmq_msg_init (&message);
// Asserts on receive from s1 or s2
zmq_recv (s1, &message, 0);
return 0;
}
//
// Provoke assertion failure in pull.cpp:39
//
#include <zmq.h>
int main () {
void *context; // ØMQ context for our process
context = zmq_init (1);
void *s2;
s2 = zmq_socket (context, ZMQ_PULL);
zmq_bind (s2, "inproc://socket");
void *s1;
s1 = zmq_socket (context, ZMQ_PULL);
zmq_connect (s1, "inproc://socket");
zmq_msg_t message;
zmq_msg_init (&message);
// Asserts on receive from s1 or s2
zmq_recv (s1, &message, 0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment