On 1/29/12 12:49 AM, Bjoern Haverland wrote:
Am 29.01.2012 00:10, schrieb Emmanuel Lecharny:
On 1/28/12 11:35 PM, Björn Haverland wrote:
Hi @all,
i?m new to mina so a big hello to all of you ;)
So i have also a question. I?m searching for a more detailed
protocollcodecfilter tutorial. The one which is online is good for
starting, but what do i have to do if i have more telegrams then one
in each direction? I have some startbytes which indicates me which
kind of telegramm will follow. Could anybody give me a hint how i
could solve this?
Do you mean that you have a first byte in your message that defines
the message's type ?
Yepp (2 Bytes)
So it should not be a problem. Depending on those two bytes, you will
decode the following bytes knowing what they will be transformed to.
There are two important things to understand :
1) the bytes you are receiving *may* contain more than one message (once
decoded)
2) the bytes you are receiving *may* not be enough to decode a full
message (this is due to the possible fragmentation on TCP)
Once you understand that, decoding the bytes is pretty easy.
To deal with (1), you have to loop on the bytes until you can't decode
any more message
To deal with (2) is a bit more complex : you have to know the size of
the bytes needed to create a full message, or the bytes must have a
terminator (a special byte or set of bytes that close the message).
In any case, you can use the CumulativeProtocolDecoder to deal with
those two scenarii.
Again, the Image decoder exaple given on the web site is probably the
page to read.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com