Getting a negative offset when using the FixedSizeReceiveFilter?

Apr 18, 2013 at 11:21 AM
Edited Apr 19, 2013 at 4:21 AM

I'm using the FixedSizeReceiveFilter as a template for my receiverfilter and while it was working flawlessly in the past I would like to ask as to why my particular issue arises.

I have a fixed ByteArrayLength of around 69 bytes and what happens is when I send a byte array of length less than 69 (e.g. 5 bytes) it doesn't get processed, which I assume is supersocket's behavior.

But then if I send a bytearray of either the proper size (69 bytes) or with a length that is more than 69 it gets processed but the offset size that is used by the filter becomes whatever the length of the invalid bytearray I sent to the receiver filter previously (the one which is less than 69), but only it is negative (e.g. -5 since I sent a byte array of length 5).

Steps in Recreating my Problem:
  • Using the FixedSizeReceiveFilter
  • My ByteArrayLength for the FixedSizeReceiveFilter is 69
  • I send a ByteArray of length 5, which is less than the prescribed ByteArrayLength from the FixedSizeReceiverFilter
  • Message doesn't get processed
  • I then send a ByteArray of length 69
  • It gets processed but an index out of bounds exception is thrown because the offset now is -5 which we believe came from the first ByteArray that we sent that was smaller than our required ByteArrayLength
Am I not handling something that's why it happens?

Is there a receiver filter that catches invalid messages like in our case? If it doesn't exist what are the proper steps to take in implementing such?
Apr 21, 2013 at 7:58 AM
Could you write a test case (NUnit) to produce this issue follow the Test project or test code in the QuickStart samples, and then send it to me?