Support for protocol with message length at start?

May 17, 2013 at 12:51 PM
Edited May 17, 2013 at 4:31 PM
Do any of the existing flters support a protocol where frames are prefixed with the message length?

Something like:
162 Message_totalling_162_bytes_here
Note that the message length is not a fixed size - there is a seperator character after the message length seperates it from the body.
May 19, 2013 at 3:45 AM
Please read the section FixedHeaderReceiveFilter in this doc:
May 19, 2013 at 2:55 PM
I had read the documentation, and seen FixedHeaderReceiveFilter - but as I mentioned, "message length is not a fixed size" :)

I came up with a solution by extending TerminatorReceiveFilter, so the underlying TerminatorReceiveFilter gets the message length, then filter code similar to that in FixedHeaderReceiveFilter is used after the message length is known.
May 19, 2013 at 3:12 PM
Actually, you should re-design your protocol.

Don't represent length by chars. Because if the length is 120, you require 3 bytes, but one byte can represent 0-255 and two bytes can represent 0 - 256 * 255.
May 19, 2013 at 3:40 PM
Actually, it's someone elses protocol, so I can't redesign it ;)

You are right though, it's an odd design choice.
May 19, 2013 at 3:54 PM
It seems you need to implement your own ReceiveFilter by yourself.
May 19, 2013 at 4:31 PM
As above, that's exactly what I did.