> > OK, I wasn't sure where you were but this is clear. You can connect > many REQ to one REP, it's the basic hello world example; the REP gets > one request at a time, fair queued from each REQ. Each REQ sends a > request and waits for an answer. > > At a glance perhaps you're trying to connect and bind to the same > address (though your code appears to be connecting both in server and > client?). >
Yes, this happens because the service browser is a generic tool used by both. I just hacked a clause to remove in server query of the service info but the client still hangs. > > You cannot bind to a DNS name, you have to bind to a local interface, > and I'd recommend "tcp://*:port" as the simplest (binds to all > interfaces and is portable). > All my servers bind to tcp://*:[random port], the port is then announced with multicast DNS (Bonjour/ZeroConf) so this is not the issue. Damn ! I found where the problem comes from. Translated in plain C, this is what does not work: ======================================== // Socket to talk to server void *requester = zmq_socket (context, ZMQ_REQ); zmq_connect(requester, "tcp://localhost:5555"); zmq_msg_t request; zmq_msg_init_data (&request, "info?", 6, NULL, NULL); zmq_send (requester, &request, 0); zmq_msg_close (&request); zmq_msg_t reply; zmq_msg_init (&reply); zmq_recv (requester, &reply, 0); zmq_msg_close (&reply); // all ok until here. Later... // connect to another server (5555 is dead) zmq_connect(requester, "tcp://localhost:7777"); zmq_msg_t request2; zmq_msg_init_data (&request2, "info?", 6, NULL, NULL); zmq_send (requester, &request2, 0); /// hang, probably trying to send to 5555 ? ======================================== So this boils down to: 1. How am I supposed to change the connection of a REQ socket ? 2. Is closing and creating a new socket the right way to handle this case (it sure works) ? Cheers, Gaspard
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev