Created
June 10, 2013 17:28
-
-
Save csquared/5750637 to your computer and use it in GitHub Desktop.
Push-Pull ZMQ Broker to act as a proxy/intermediary between multiple PUSH and PULL sockets.
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 <stdio.h> | |
| #include "zhelpers.h" | |
| int main(void) | |
| { | |
| void *context = zmq_ctx_new(); | |
| void *reciever = zmq_socket(context, ZMQ_PULL); | |
| zmq_bind(reciever, "tcp://127.0.0.1:5557"); | |
| puts("reciever on tcp://127.0.0.1:5557"); | |
| void *sender = zmq_socket(context, ZMQ_PUSH); | |
| zmq_bind(sender, "tcp://127.0.0.1:5558"); | |
| puts("sender on tcp://127.0.0.1:5558"); | |
| zmq_proxy(reciever, sender, NULL); | |
| zmq_close(reciever); | |
| zmq_close(sender); | |
| zmq_ctx_destroy(context); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment