Last active
August 29, 2015 14:00
-
-
Save rudle/11012658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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