public void FromLowLayerToHere(DataContent dataContent) { byte[] seqHeader; byte[] body; int seq; // it is a state only packet if (dataContent.Data == null) { NextHighLayerEvent?.Invoke(dataContent); return; } try { // parse header seqHeader = ((byte[])dataContent.Data).Take(4).ToArray(); body = ((byte[])dataContent.Data).Skip(4).ToArray(); seq = BitConverter.ToInt32(seqHeader); // remove header from dataContent dataContent.Data = body; // init if (_receiveWindow == null) { _receiveWindow = new SlidingWindow(seq, _windowSize); } // check validation if (!_receiveWindow.IsValid(seq)) { dataContent.IsAckWrong = true; } // update _receiveWindow.Update(seq); } catch (Exception) { dataContent.IsAckWrong = true; } NextHighLayerEvent?.Invoke(dataContent); }