Thank you for link, it's quite felpful.
I wrote test program sends the same message to 2 endpoints. It sends
messages to both clients starting from 2nd message. The first message
is recieved by first client (192.168.0.1) twice, the second client
(localhost) doesn't recieve anything.
How can I avoid that?
zmq::context_t context (1);
zmq::socket_t socket (context, ZMQ_REQ);
std::string input = "";
while(getline(std::cin, input)) {
int messageLength = input.length();
zmq::message_t request1 (messageLength);
zmq::message_t request2 (messageLength);
memcpy ((void *) request1.data (), input.c_str(), messageLength);
memcpy ((void *) request2.data (), input.c_str(), messageLength);
std::cout << "Sending \"" << input << "\" to 0.1" << std::endl;
socket.connect ("tcp://192.168.0.1:8080");
socket.send (request1);
zmq::message_t reply1;
socket.recv (&reply1);
std::cout << "Received OK from 0.1" << std::endl;
std::cout << "Sending \"" << input << "\" to localhost" << std::endl;
socket.connect ("tcp://localhost:8080");
socket.send (request2);
zmq::message_t reply2;
socket.recv (&reply2);
std::cout << "Received OK from localhost" << std::endl;
}
On 21 August 2012 02:47, Steven McCoy <[email protected]> wrote:
> On 20 August 2012 17:37, Alexander Voron <[email protected]> wrote:
>>
>> Can I use the following approach?
>>
>> socket.send (request);
>> socket.send (request);
>>
>
> This might be of interest,
> http://grokbase.com/t/zeromq/zeromq-dev/109pzyz4ek/message-t-reusing
>
> --
> Steve-o
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev