Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Publisher:
- void *context = zmq_ctx_new ();
- void *publisher = zmq_socket (context, ZMQ_PUB);
- int rc = zmq_bind(publisher, "epgm://en0;224.0.0.250:5555");
- int rcvval = 20000000;
- int m = zmq_setsockopt(publisher, ZMQ_SNDBUF, &rcvval, sizeof rcvval);
- int optval = 100;
- m = zmq_setsockopt(publisher, ZMQ_RATE, &optval, sizeof(optval));
- optval = 1;
- m = zmq_setsockopt(publisher, ZMQ_RECOVERY_IVL, &optval, sizeof(optval));
- optval = 65000000;
- m = zmq_setsockopt(publisher, ZMQ_SNDHWM, &optval, sizeof(optval));
- optval = 0;
- size_t opt_size = sizeof(optval);
- m = zmq_getsockopt(publisher, ZMQ_SNDBUF, &optval, &opt_size);
- char test[1000000];
- char* str = "aaaaabvbvbbvbvbvbvbvbvbvbbvbvbvbdvbhdvbdvhbdvhdbvhdbvhdbvhdbvdhvbdhvbdhvbdhvbdhvbdhvbdhvbdhhvbdhvbdh";
- for(int i = 0; i < 5000; i++)
- {
- strcat(test, str);
- }
- int sent_size = s_send(publisher, test);
- Subscriber:
- void *context = zmq_ctx_new ();
- void *subscriber = zmq_socket (context, ZMQ_SUB);
- int rc = zmq_connect(subscriber, "epgm://en0;224.0.0.250:5555");
- assert (rc == 0);
- rc = zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE,
- "", 0);
- assert (rc == 0);
- int rcvval = 20000000;
- int m = zmq_setsockopt(subscriber, ZMQ_RCVBUF, &rcvval, sizeof rcvval);
- int optval = 65000000;
- m = zmq_setsockopt(subscriber, ZMQ_RCVHWM, &optval, sizeof(optval));
- optval = 1;
- m = zmq_setsockopt(subscriber, ZMQ_RECOVERY_IVL, &optval, sizeof(optval));
- optval = 100;
- m = zmq_setsockopt(subscriber, ZMQ_RATE, &optval, sizeof(optval));
- char *bytesChar = s_recv(subscriber);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement