0

I am using a ZMQ PUB Message Sink in my GRC application and want to send the message to my C ZMQ SUB application.

Everything works, except that I have 10 bytes to much. I.e. there is some kind of a 10 byte header (always the same sequence). At the moment I am just clipping it out, but it would be nice to know where this is coming from. Has anyone seen that before?

In C I am using

...
void *context = zmq_ctx_new();
void *socket = zmq_socket(context, ZMQ_SUB);
zmq_setsockopt(socket, ZMQ_SUBSCRIBE, "", 0);

while(1){
   zmq_msg_init(&message);
   if(zmq_msg_recv(&message, socket, 0)){
   int size = zmq_msg_size(&message);
   ...
}

Size is always the following ten bytes to much

0x07 0x06 0x0A 0x00 0x00 0x00 0x00 0x3E 0x01 0x00 

It seems that the third byte from the right (0x3E) is the message size.

Does anyone has a reference to the respective GnuRadio implementation/definition?

ben
  • 207
  • 1
  • 10

1 Answers1

1

Interesting. I've just come across the same problem and get these 10 extra bytes at the start of the packet... 0x07 0x06 0x0A 0x00 0x00 0x00 0x00 0x0B 0x01 0x00

My usage is a ZMQ PUB Message Sink in my GRC and a separate python SUB client. The packet I was expecting was 11 bytes so not sure if that 0x0B is relevant? What were your leading bytes?

I also notice that the way you have to specify the address is different from the ZMQ PUB Sink block as that could use localhost:xxxx but the PUB Message Sink needed tcp://127.0.0.1:xxxx

I'll update this if I discover the source of the extra bytes too.

I should add that my SUB was

socket.setsockopt(zmq.SUBSCRIBE, b"")

if that has any bearing.

Andy_ICT2U
  • 31
  • 4
  • My 10 bytes are quite similar 0x07 0x06 0x0A 0x00 0x00 0x00 0x00 0x3E 0x01 0x00 The third byte from the right (0x3E) seems to be the message size. I have been trying to extract the format from the GnuRadio documentation, but it is like a jungle... – ben Aug 02 '19 at 09:48