-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pub/sub bugs #43
Comments
Can you please pull from my repository and test? |
This seems to have fixed the head loss issue, however concatenation issue is still there. Receiver program: #include "iostream" #include "zmq.hpp" #define NUM_MSG 2048 int main (int argc, char* argv[]) { int i, num; long more = 1; size_t more_size = sizeof(more); if (argc < 2) { std::cout << "Receiver arguments: " << std::endl; return 1; } num = (argc < 3) ? NUM_MSG : atoi(argv[2]); zmq::context_t ctx (1); zmq::socket_t s (ctx, ZMQ_SUB); s.bind ("epgm://eth0;224.10.10.10:5555"); s.setsockopt (ZMQ_SUBSCRIBE, argv[1], std::strlen(argv[1])); std::cout << "Subscribed to [" << argv[1] << "], length " << std::strlen(argv[1]) << std::endl; for (i = 0; i < num; i++) { zmq::message_t hdr; zmq::message_t msg; s.recv (&hdr); s.getsockopt(ZMQ_RCVMORE, &more, &more_size); if (more) { s.recv (&msg); std::cout << "Topic [" << ((const char *)hdr.data()) << "] : " << i << " = " << ((const char *)msg.data()) << std::endl; } else std::cout << "Topic [" << argv[1] << "] : " << i << " header only [" << ((const char *)hdr.data()) << "]" << std::endl; } return 0; } Sender program: #include "iostream" #include "sstream" #include "zmq.hpp" #define NUM_MSG 1 int main (int argc, char* argv[]) { int i, num; long rate = 10000; if (argc < 3) { std::cout << "Sender arguments: " << std::endl; return 1; } num = (argc < 4) ? NUM_MSG : atoi(argv[3]); zmq::context_t ctx (1); zmq::socket_t s (ctx, ZMQ_PUB); s.setsockopt (ZMQ_RATE, &rate, sizeof (rate)); s.connect ("epgm://eth0;224.10.10.10:5555"); for (i = 0; i < num; i++) { std::ostringstream oss; oss << argv[2] << "[" << i << "]"; zmq::message_t hdr (argv[1], std::strlen(argv[1]) + 1, NULL); zmq::message_t msg (oss.str().size() + 1); strcpy((char*)msg.data(), oss.str().c_str()); std::cout << "Sending '" << ((const char*)msg.data()) << "' to [" << ((const char*)hdr.data()) << "]" << std::endl; s.send (hdr, ZMQ_SNDMORE); s.send (msg); } return 0; } Test: Start receiver to wait for a large number of messages, then make sender transmit the same number. Once in a while this leads to the receiver not getting all of the sent messages. When this happens, restart the sender to send a single message to a different topic. Start receiver: [ak@linux src]$ /tmp/zrm test 16384 Start sender: [ak@linux zmq]$ /tmp/zsm test 1111111111111111111111111111 16384 >& /dev/zero Receiver output until it stops: Then, sender again to a different topic: [ak@linux zmq]$ /tmp/zsm testing 222222222222222222222222222 1 >& /dev/zero Receiver: |
Thanks for elaborating. Will look into this. |
Hi - I am also having this issue where the first N-1 parts of an N part multi-message are being lost on the first message sent over epgm. Is this issue still being looked into or should I post another example? I am using zeromq version 2.1.4. |
Here's a basic C++ example that shows this problem. Start pgmtest2 (the subscriber), then start pgmtest1. pgmtest2 should show
but instead shows
pgmtest1.cpp (publisher)
pgmtest2.cpp (subscriber)
|
Fixes issue LIBZMQ-332
Updated zeromq3-x version to 3.2.2 for next release
Solution: allow brackets in tcp address. Fixes zeromq#43
java ZreUdp and test
There are bugs in the v2.0.7 code that result in problems with receiving multi-part PUB/SUB messages as described in the article. The simplest case is a two-part message with the first part containing a topic and the second part containing a payload.
// We have to move data to the beginning of the first message.
data += offset;
received -= offset;
Payload part is then treated as a topic part and gets discarded by the filter.
The text was updated successfully, but these errors were encountered: