We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please use this template for reporting suspected bugs or requests for help.
In pub-sub mode, use EPGM in same machine.
publisher:
#include <zmq.hpp> #include <string> #include <iostream> #include <thread> #include <chrono> int main() { zmq::context_t context(1); zmq::socket_t publisher(context, zmq::socket_type::pub); std::string connection_string = "epgm://eno1;239.192.1.1:5555"; try { publisher.bind(connection_string); std::cout << "Publisher bound to " << connection_string << std::endl; } catch (zmq::error_t& e) { std::cerr << "Failed to bind publisher: " << e.what() << std::endl; return 1; } int count = 0; while (true) { std::string message = "Message " + std::to_string(count++); zmq::message_t zmq_message(message.data(), message.size()); try { publisher.send(zmq_message, zmq::send_flags::none); std::cout << "Sent: " << message << std::endl; } catch (zmq::error_t& e) { std::cerr << "Failed to send message: " << e.what() << std::endl; } std::this_thread::sleep_for(std::chrono::seconds(1)); } return 0; }
subscriber:
#include <zmq.hpp> #include <string> #include <iostream> int main() { zmq::context_t context(1); zmq::socket_t subscriber(context, zmq::socket_type::sub); std::string connection_string = "epgm://eno1;239.192.1.1:5555"; try { subscriber.connect(connection_string); std::cout << "Subscriber connected to " << connection_string << std::endl; subscriber.set(zmq::sockopt::subscribe, ""); } catch (zmq::error_t& e) { std::cerr << "Failed to connect subscriber: " << e.what() << std::endl; return 1; } while (true) { zmq::message_t message; try { auto result = subscriber.recv(message, zmq::recv_flags::none); if (result) { std::string received_msg(static_cast<char*>(message.data()), message.size()); std::cout << "Received: " << received_msg << std::endl; } } catch (zmq::error_t& e) { std::cerr << "Failed to receive message: " << e.what() << std::endl; } } return 0; }
subscriber couldn't receive any message.
subscriber should recieve message sent by publisher.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Please use this template for reporting suspected bugs or requests for help.
Issue description
In pub-sub mode, use EPGM in same machine.
Environment
Minimal test code / Steps to reproduce the issue
publisher:
subscriber:
What's the actual result? (include assertion message & call stack if applicable)
subscriber couldn't receive any message.
What's the expected result?
subscriber should recieve message sent by publisher.
The text was updated successfully, but these errors were encountered: