예제 #1
0
        public override int Process(int lastLength, WebSocketDataFrame frame, out IDataFramePartReader nextPartReader)
        {
            int required = lastLength + 4;

            if (frame.Length < required)
            {
                nextPartReader = this;
                return(-1);
            }

            frame.MaskKey = frame.InnerData.ToArrayData(lastLength, 4);

            if (frame.ActualPayloadLength == 0)
            {
                nextPartReader = null;
                return((int)((long)frame.Length - required));
            }

            nextPartReader = new PayloadDataReader();

            if (frame.Length > required)
            {
                return(nextPartReader.Process(required, frame, out nextPartReader));
            }

            return(0);
        }
예제 #2
0
 static DataFramePartReader()
 {
     FixPartReader        = new FixPartReader();
     ExtendedLenghtReader = new ExtendedLenghtReader();
     MaskKeyReader        = new MaskKeyReader();
     PayloadDataReader    = new PayloadDataReader();
 }
예제 #3
0
        public override int Process(int lastLength, WebSocketDataFrame frame, out IDataFramePartReader nextPartReader)
        {
            int required = lastLength + 4;

            if (frame.Length < required)
            {
                nextPartReader = this;
                return -1;
            }

            frame.MaskKey = frame.InnerData.ToArrayData(lastLength, 4);

            if (frame.ActualPayloadLength == 0)
            {
                nextPartReader = null;
                return (int)((long)frame.Length - required);
            }

            nextPartReader = new PayloadDataReader();

            if (frame.Length > required)
                return nextPartReader.Process(required, frame, out nextPartReader);

            return 0;
        }
예제 #4
0
 static DataFramePartReader()
 {
     FixPartReader = new FixPartReader();
     ExtendedLenghtReader = new ExtendedLenghtReader();
     MaskKeyReader = new MaskKeyReader();
     PayloadDataReader = new PayloadDataReader();
 }