/// <summary> /// 当Tcp收到数据全部在这里处理;也是数据的第一次处理 /// </summary> /// <param name="stateOne">TcpState</param> /// <param name="reciverByte">数据</param> internal void TcpDateOne(TcpState stateOne, byte[] reciverByte) { stateOne.HeartTime = DateTime.Now; List <byte[]> listDate = StickPackage.DecryptPackage(reciverByte, ref stateOne.Residualpackage); foreach (var date in listDate) { StateCode statecode = ReceiveDateDistribution.Distribution(date); TcpCodeManage(stateOne, statecode); } }
/// <summary> /// 解决粘包数据处理;也是数据的第一次处理 /// </summary> /// <param name="stateOne">当前的连接属性</param> /// <param name="reciverByte">收到的数据</param> internal void UnpackStickyData(TcpTransmitBox stateOne, byte[] reciverByte) { //设置心跳包 stateOne.HeartTime = DateTime.Now; //去掉粘包代码,得到数据集 List <byte[]> listDate = StickPackage.DecryptPackage(reciverByte, ref stateOne.Residualpackage); foreach (byte[] date in listDate) { DataModel statecode = ReceiveData.DataValidation(date); CategorizeData(stateOne, statecode); } }