BeginEndMarkReceivedFilter problem

Oct 28, 2013 at 4:56 PM

I have the following receive filter
    class XmlReceiveFilter : BeginEndMarkReceiveFilter<BinaryRequestInfo>
        private readonly static byte[] beginMark = new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c }; // "<?xml"
        private readonly static byte[] endMark = new byte[] { 0x3c, 0x2f, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x61, 0x6c, 0x3e }; // </Orbital>

        public XmlReceiveFilter()
            : base(beginMark, endMark)
        { }

        protected override BinaryRequestInfo ProcessMatchedRequest(byte[] readBuffer, int offset, int length)
            return new BinaryRequestInfo("XML", readBuffer.CloneRange(offset, length));
When using SuperSocket.1.5.beta it works perfectly. By switching to any pos beta version (1.5.2, 1.5.3 or 1.5.4) it stop working properly. Every message that arrives from a client fails and the connection is closed.

With a breakpoint on the method Filter of BeginEndMarkReceiveFilter.cs I figured out that it is allways going into the following if statement:
                    //But not at the beginning
                    if(pos != offset)
                        State = FilterState.Error;
                        return NullRequestInfo;
The pos value is 200707 and the offset value is 200704.

The method Filter is different on 1.5.beta version and work properly. The method found on newer version works fine if the beginMark and endMark has only 1 byte.

Best Regards,
Oct 29, 2013 at 5:46 AM
What's your client? Do you send any data after each xml data?
Oct 29, 2013 at 1:27 PM

I'm using Supersocket.Client (but I have tried using .NET TCPClient also) and there is no data after xml data.

Best Regards,
Oct 30, 2013 at 2:55 AM
I suggest you add this configuration below to log raw data communications.

    <trace autoflush="true" />
        <source name="System.Net.Sockets" maxdatasize="1024">
                <add name="SocketTrace"/>
        <add name="SocketTrace"
             initializeData="System.Net.Trace.log" />
        <add name="System.Net.Sockets" value="Verbose" />