Created
March 2, 2011 16:54
-
-
Save sustrik/851249 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 <stdint.h> | |
#include <unistd.h> | |
#include <zmq.hpp> | |
int main () | |
{ | |
zmq::context_t ctx (1); | |
zmq::socket_t s (ctx, ZMQ_XREP); | |
const int64_t hwm = 1; | |
s.setsockopt (ZMQ_HWM, &hwm, sizeof (hwm)); | |
s.bind ("tcp://127.0.0.1:23001"); | |
zmq::socket_t s2 (ctx, ZMQ_XREQ); | |
s2.setsockopt (ZMQ_IDENTITY, "A", 1); | |
s2.connect ("tcp://127.0.0.1:23001"); | |
sleep (1); | |
for (int i = 0; i < 2 ; ++i) | |
{ | |
zmq::message_t route (1); | |
*(char*) route.data () = 'A'; | |
s.send (route, ZMQ_SNDMORE); | |
zmq::message_t nothing; | |
s.send (nothing); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment