I have some code which receives a byte array from a UDP listener and writes it to a message queue. It seems to be mostly working but when I inspect the message on the queue it has extra bytes preceding my data.
byte[] data = listener.Receive(ref endpoint);
Console.WriteLine($"Received broadcast from {endpoint} :");
Console.WriteLine($" {Encoding.ASCII.GetString(data, 0, data.Length)}");
Message msg = new Message();
msg.Body = data;
msg.Formatter = new BinaryMessageFormatter();
_queue.Send(msg, MessageQueueTransactionType.Single);
So when data is {byte[6]} (actually "Hello!"), this is what I see on the queue:
00 01 00 00 00 FF FF FF .....ÿÿÿ
FF 01 00 00 00 00 00 00 ÿ.......
00 0F 01 00 00 00 06 00 ........
00 00 02 48 65 6C 6C 6F ...Hello
21 0B !.
So my Hello! is there but what is that extra preamble?