Hello once more, There is one info that I forgot to give you. The message part which is not aligned on a 4 bytes boundary is a "small message". I had a short look in ZMQ source code and I have noticed that it could explain the behavior that I have noticed. As far as I have understood the code, the zmq_msg_data() function in case of small message returns the address of the buffer named "vsm_data" in the zmq_msg_t structure. Following this structure definition, this buffer is aligned on a 2 bytes boundary because it follows 2 unsigned char. Increasing this message part size to something greater than ZMQ_MAX_VSM_SIZE (30) should solve my problem.
I should have looked into the code before sending the e-mail !!! Do you confirm my understanding of this problem? If yes, how is it possible to send small message which will be received aligned in a 4 bytes boundary? Thank's for your answers Emmanuel Taurel On 07/07/2011 12:47, Emmanuel TAUREL wrote: > Hello all, > > I am using zeromq 2.1.7. I am using a multipart message sent from a PUB > socket to some SUB sockets. > Then, once in the receiver process, the message is sent to worker > threads using some PUSH/PULL sockets and a zmq queue device to link the > SUB and the PUSH socket. > My message has 6 parts. Part 1 and 2 are classical strings, part 3 is > simply 4 bytes and part 4, 5 and 6 are encoded buffer. > I am using the C++ binding. Transmission between PUB and SUB works fine. > However, for subscriber running on the same host than the publisher, the > message part 4 that I retrieve in the worker thread using a > zmq::message_t object is returned to me in a buffer aligned in memory in > a 2 bytes border (address 0xXXX2 and not 0xXXX0 or 0xXXX4). > I am using the zmq::message_t::data() method to retrieve the memory buffer. > This behavior disturbs the software which decodes this buffer because it > assume that the buffer is aligned on a 4 bytes border. > > Is there any rule concerning buffer memory alignment within zmq? > Is there something I can do to retrieve my buffer aligned on a 4 bytes > border? > > Thank's for your answers > > Regards > > Emmanuel Taurel > > > _______________________________________________ > 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
