Skip to content

Instantly share code, notes, and snippets.

@niklas88
Created November 17, 2016 16:27
Show Gist options
  • Save niklas88/e67a19e8171cf2ad1b79df5ac34f808c to your computer and use it in GitHub Desktop.
Save niklas88/e67a19e8171cf2ad1b79df5ac34f808c to your computer and use it in GitHub Desktop.
#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