Skip to content

Instantly share code, notes, and snippets.

Created October 27, 2013 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/7180578 to your computer and use it in GitHub Desktop.
Save anonymous/7180578 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include "zmq.h"
int main() {
void *context = zmq_ctx_new();
void *in_sock = zmq_socket(context, ZMQ_SUB);
zmq_connect(in_sock, "tcp://127.0.0.1/8080");
zmq_setsockopt(in_sock, ZMQ_SUBSCRIBE, "[CHATTR]", 8 * sizeof(char));
printf("Entering loop mode..\n");
while(1) {
zmq_msg_t msg;
zmq_msg_init(&msg);
zmq_recvmsg(in_sock, &msg, 0);
printf("OKAY\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment