Skip to content
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

ZMQ_HELLO_MSG doesn't work #625

Open
wsehjk opened this issue Dec 13, 2023 · 0 comments
Open

ZMQ_HELLO_MSG doesn't work #625

wsehjk opened this issue Dec 13, 2023 · 0 comments

Comments

@wsehjk
Copy link

wsehjk commented Dec 13, 2023

Please use this template for reporting suspected bugs or requests for help.

Issue description

server socket (router mode) set the ZMQ_HELLO_MSG, but the client (dealer mode) cannnot receive this msg, even though netstat says connection has been established.

Environment

  • libzmq version (commit hash if unreleased): 4.3.4
  • OS: macos Monterey 12.5.1, vscode 1.84.2 (Universal)

Minimal test code / Steps to reproduce the issue

#define ZMQ_BUILD_DRAFT_API
#include <iostream>
#include <zmq.hpp>

int main() {
    zmq::context_t server_ctx;
    zmq::context_t client_ctx;

    zmq::socket_t server(server_ctx, zmq::socket_type::router);
    zmq::socket_t client(client_ctx, zmq::socket_type::dealer);
    zmq_setsockopt(server, ZMQ_HELLO_MSG, "hello", 5);

    client.setsockopt(ZMQ_RCVTIMEO, 80000); // 500ms

    server.bind("tcp://127.0.0.1:5555");
    client.connect("tcp://127.0.0.1:5555");
    zmq::message_t msg;

    while (true) {
        client.recv(msg);
        if (!msg.empty()) {
            std::string str(msg.to_string());
            std::cout << str << std::endl;
            break;
        }
    }
    return 0;
}

What's the actual result? (include assertion message & call stack if applicable)

should print hello

What's the expected result?

program stuck in the while loop

@bluca bluca transferred this issue from zeromq/libzmq Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant