Created
November 17, 2016 16:27
-
-
Save niklas88/e67a19e8171cf2ad1b79df5ac34f808c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <stdint.h> | |
#include <stdio.h> | |
#include <zmq.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
int main(int argc, char** argv) { | |
if(argc < 3) { | |
fprintf(stderr, "Usage %s: <xpublish_url> <xsubsriber_url>\n", argv[0]); | |
exit(1); | |
} | |
void* context = zmq_ctx_new(); | |
void* xpub_out = zmq_socket(context, ZMQ_XPUB); | |
void* xsub_in = zmq_socket(context, ZMQ_XSUB); | |
assert(zmq_bind(xpub_out, argv[1]) == 0); | |
assert(zmq_bind(xsub_in, argv[2]) == 0); | |
zmq_proxy(xpub_out, xsub_in, NULL); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment