Skip to content

Instantly share code, notes, and snippets.

@rudle
Last active August 29, 2015 14:00
Show Gist options
  • Save rudle/11012658 to your computer and use it in GitHub Desktop.
Save rudle/11012658 to your computer and use it in GitHub Desktop.
#include <string.h>
#include <stdio.h>
#include <zmq.h>
#include <assert.h>
int main (int argc, char ** archv) {
void * context = zmq_init(1);
void *socket = zmq_socket (context, ZMQ_SUB);
assert (socket);
int rc = zmq_connect (socket, "tcp://0.0.0.0:8080"); assert (rc == 0);
char buf[2];
while (1) {
memset(buf, 0, 2);
printf("receiving\n");
zmq_recv(socket, buf, 1, 0);
printf("%s\n", buf);
}
}
# cc -lzmq reader.c -o reader && ./reader
# receiving
# … blocks forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment