[zeromq-dev] Zmq_queue problem on windows
jon at totient.co.uk
Thu Apr 22 23:13:39 CEST 2010
Zhou, Kefei Dan wrote:
> In zmq_queue.cpp, zmq::context_t is initialized without ZMQ_POLL flag and would fail when you try to run it since the main loop uses poll. After I added the ZMQ_POLL flag and recompiled the code, the incoming request msgs looks corrupted.
> Has anyone else seem this problem before?
> I'm using 2.0.6 src code on windows with Visual Studio 2010?
> - dan
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
ok the missing ZMQ_POLL flag is a bug.
where are you seeing the message you suspect is corrupt?
If it is in the process which is implementing the ZMQ_REP socket
then XREQ/XREP sockets add extra addressing data to the message.
In 2.0.6 this has to be manually stripped out and added back to the
In trunk, XREP/XREQ this stuff is all completely broken because how it
works is being changed (to use a new feature called multi-part messages).
So if you are seeing the problem I describe on 2.0.6 in the ZMQ_REP socket
you must do something like
zmq::socket_t rep(ctx, ZMQ_REP);
// first byte is the length of the addressing info
unsigned char len = *((char*)request.data());
char* msg = (char*)request.data();
// real message data is at msg + len + 1
// make a response message, at least len
// copy in the addressing info
::memcpy(response.data(), request.data(), len);
// send empty response
More information about the zeromq-dev