Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <stdbool.h>
- #include <string.h>
- #include <czmq.h>
- #include <assert.h>
- #define LISTEN_SOCK "epgm://239.77.77.77:5556"
- int main(void)
- {
- zctx_t *zmq_context = zctx_new();
- void *zsocket = zsocket_new (zmq_context, ZMQ_SUB);
- assert (zsocket);
- zsockopt_set_hwm(zsocket, 10);
- assert (zsocket_connect (zsocket, LISTEN_SOCK) == 0);
- zsocket_set_subscribe(zsocket, "MESSAGE");
- char *msg;
- while ( (msg = zstr_recv(zsocket))) {
- printf ("%s\n", msg);
- free(msg);
- }
- zsocket_destroy(zmq_context, zsocket);
- zctx_destroy(&zmq_context);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment