Hi,

When using XREP to XREP communication, I'm getting different results
based on which socket is bound and which is connected.

I'm using 2.1.0 on windows, the latest version from git - including
commit bd0ba6e89a709cc8afbd5a7c3c4f9f533c428249
Author: Martin Sustrik <[email protected]>
Date:   Mon Jan 10 13:53:30 2011 +0100

Given the following code:

int main(int argc, char* argv[])
{
        zmq::context_t context(1);
        zmq::socket_t source(context, ZMQ_XREP);
        source.setsockopt(ZMQ_IDENTITY, "source", 6);

        zmq::socket_t target(context, ZMQ_XREP);
        target.setsockopt(ZMQ_IDENTITY, "target", 6);

        // 1) inproc bound source
        source.bind("inproc://test");
        target.connect("inproc://test");

        // 2) inproc bound target
        //target.bind("inproc://test");
        //source.connect("inproc://test");

        // 3) tcp bound source
        //source.bind("tcp://*:5555");
        //target.connect("tcp://localhost:5555");

        // 4) tcp bound target
        //target.bind("tcp://*:5555");
        //source.connect("tcp://localhost:5555");

        boost::this_thread::sleep(boost::posix_time::seconds(1));

        zmq::message_t addr_message(6);
        std::memcpy(addr_message.data(), "target", 6);
        source.send(addr_message, ZMQ_SNDMORE);

        zmq::message_t empty_message;
        source.send(empty_message, ZMQ_SNDMORE);

        zmq::message_t payload_message(7);
        std::memcpy(payload_message.data(), "payload", 7);
        source.send(payload_message);

        int64_t have_more;
        size_t more_size(sizeof(have_more));
        do
        {
                zmq::message_t recv_message;
                target.recv(&recv_message);
                std::cout << "recv: " << recv_message.size() << std::endl;
                target.getsockopt(ZMQ_RCVMORE, &have_more, &more_size);
        } while (have_more != 0);

        return EXIT_SUCCESS;
}


Both 3 and 4 works with as expected. I receive exactly the same as
inserted into source.
Eg. "target", "", "payload"

Exampel 2 does not receive anything.

Example 1 receives a binary blob (looks like the auto-generated
request IDs), "", "payload"


Any idea what's going on?


-- 
Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul]
<demo> 2011 Tore Halvorsen || +052 0553034554
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to