osx - ZeroMQ with OpenPGM multicast doesn't pick up message on Mac 10.12 -
i have been trying zeromq multicast work on mac, linux , windows. platforms can send messages on hard codes multicast channel. windows , linux can pick messages. on mac, outputs nothing. using wireshark on mac can detect multicast message, reasons, process on mac can not pick up.
is known issue in zeromq or did wrong?
this code of setuping multicast sockets , looping through messages
static auto const multicast_addr_fmt = "epgm://{};224.1.1.1:2000"; /* multicast interface */ impl_->mcast_pub.emplace (impl_->zmq_ctx, zmq_pub); impl_->mcast_pub->setsockopt (zmq_multicast_hops, 3); impl_->mcast_sub.emplace (impl_->zmq_ctx, zmq_sub); impl_->mcast_sub->setsockopt (zmq_subscribe, "", 0); auto addr = fmt::format ( multicast_addr_fmt, primary_ip, impl_->base_port + 40); std::cout << addr << std::endl; impl_->mcast_sub->connect (addr); impl_->mcast_pub->connect (addr); std::vector<zmq_pollitem_t> poll_set = { {static_cast<void*> (*impl_->mcast_sub), -1, zmq_pollin, 0}}; { auto const t1 = std::chrono::high_resolution_clock::now (); auto const n = zmq::poll (poll_set.data (), poll_set.size (), std::chrono::milliseconds (5000)); std::cout << "n = " << n << std::endl; if (n > 0) { // output never triggered std::cout << "read something" << std::endl; if (poll_set[0].revents & zmq_pollin) { process_multicast_messages (); } } else if (n < 0) { if (errno != eintr) { break; } } auto const t2 = std::chrono::high_resolution_clock::now (); if ((t2 - t1) >= std::chrono::seconds (5)) { // windows , linux can receive hello message say_hello (); } } while (true);
Comments
Post a Comment