How do I reject a message in the receive filter

Dec 31, 2013 at 6:01 AM
I am using a MyReceiveFilter : FixedHeaderReceiveFilter<BinaryRequestInfo>

I have inserted a checksum in the header, this means that when I am called on GetBodyLengthFromHeader or ResolveRequestInfo, I can determine that the header (and most likly the lenghth) is invalid, assuming that somehow the message has now gotten out of sync. How do I reject the message and dump the incoming queue, in an attempt to get the service synchronized again.

Please feel free to tell me I am not understanding the re-synchronization recovery mechanisms in SuperSockets, this is my first implementation with this tool, I am porting an existing application.
Dec 31, 2013 at 7:02 AM
I can just set the filter state to be Error and then return a null request info, the SuperSocket will close the session. Because the TCP works as stream, the data arrived first is wrong, the following data also should (must) be wrong, so you can simply close the session directly.

You also can parse the whole request and then set the request key to navigate to a command which do nothing.
Dec 31, 2013 at 2:44 PM
Thanks, I will try that. I do however also see that I can tell already when the "GetBodyLengthFromHeader" method is called, is there a way to fail the message at that time, since it is earlier in the call stack.
Jan 1, 2014 at 2:16 PM
No, you cannot do that. Because TCP works as stream, the following messages cannot be parsed if the previous message is not parsed correctly.
Jan 11, 2014 at 5:56 PM
Edited Jan 11, 2014 at 6:00 PM
I mistakenly post threads in here and can not delete :P