I think there are something wrong in 3.1.0 beta release with ZMQ_ROUTER.

I changed my C code exactly as said in Upgrading from libzmq 2.1 to 3.1, 
http://www.zeromq.org/docs:3-0-upgrade.


My code works with 2.1.8 and 2.1.11 but it does not work with zeromq-3.1.0-beta 
(from web page). I tried tcp and inproc.

I tested in OSX 10.7. Version 2.1 does send data after zmq_sendmsg and 
zmq_msg_close. New version does not send any data. I tested this with 
CocoaPacketAnalyzer. Both version connect but after connect nothing is sent.

In windows XP and VisualStudio2010 my code crashes in zmq::xrep_t::xrecv method 
in line zmq_assert (it != outpipes.end ());.


My test code is almost exacty same as this rtrouter.c example. This rtrouter.c 
does not work either in 3.10 beta.

//  rtrouter.c
//  Cross-connected ROUTER sockets addressing each other
//
#include "zhelpers.h"

int main (void) 
{
    void *context = zmq_init (1);

    void *worker = zmq_socket (context, ZMQ_ROUTER);
    zmq_setsockopt (worker, ZMQ_IDENTITY, "WORKER", 6);
    zmq_bind (worker, "ipc://rtrouter.ipc");

    void *server = zmq_socket (context, ZMQ_ROUTER);
    zmq_setsockopt (server, ZMQ_IDENTITY, "SERVER", 6);
    zmq_connect (server, "ipc://rtrouter.ipc");

    //  Wait for the worker to connect so that when we send a message
    //  with routing envelope, it will actually match the worker...
    sleep (1);

    s_sendmore (server, "WORKER");
    s_sendmore (server, "");
    s_send     (server, "send to worker");
    s_dump     (worker);

    s_sendmore (worker, "SERVER");
    s_sendmore (worker, "");
    s_send     (worker, "send to server");
    s_dump     (server);

    zmq_close (worker);
    zmq_close (server);
    zmq_term (context);
    return 0;
}

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to