Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Hello World client
- #include <zmq.h>
- #include <string.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- int main (int argc, char *argv[])
- {
- void *context = zmq_ctx_new ();
- void *pusher = zmq_socket (context, ZMQ_PUSH);
- int opti = 20000000;
- zmq_setsockopt (pusher, ZMQ_SNDHWM, &opti, sizeof(opti));
- zmq_connect (pusher, argc > 1 ? argv[1] : "tcp://192.168.1.1:13006");
- if (1) {
- unsigned count = 0;
- char buf[4] = { 't', 'e', 's', 't' };
- while (1) {
- int rc = zmq_send (pusher, buf, sizeof(buf), ZMQ_DONTWAIT);
- if (rc < 0) { printf("count: %u\n", count); exit(1); }
- count++;
- }
- }
- zmq_close (pusher);
- zmq_ctx_destroy (context);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment