Merge branch 'dev_tcp2byte' of http://47.122.70.237:3000/harmony_car/subject-two into dev_tcp2byte
This commit is contained in:
commit
1b2181adcc
@ -104,17 +104,17 @@ function handReceiveMessage(client: socket.TCPSocket, sendData, rData: ArrayBuff
|
||||
//开始补包
|
||||
if (messageType === 0xF0) {
|
||||
//获取消息体长度
|
||||
const messageLength = receiveData[12]
|
||||
const messageLength = receiveData[13]
|
||||
//分包总数
|
||||
const packages = bytesToDecimal(receiveData.slice(13, 13 + messageLength * 2));
|
||||
const forArr = new Array(packages).fill(1)
|
||||
const packages = receiveData.slice(14, 14 + messageLength * 2);
|
||||
const forArr = new Array(messageLength).fill(1)
|
||||
|
||||
forArr.forEach((item, index) => {
|
||||
forArr.forEach((item,index)=>{
|
||||
const start = index * 2;
|
||||
const end = start + 2;
|
||||
const packageIndex = bytesToDecimal([start, end]);
|
||||
const end = start + 1;
|
||||
const packageIndex = bytesToDecimal([packages[start],packages[end]]);
|
||||
console.info(TAG, '补包内容' + JSON.stringify(new Uint8Array(sendData[packageIndex])))
|
||||
client.send({ data: new Uint8Array(sendData[packageIndex]).buffer });
|
||||
client.send({data:new Uint8Array(sendData[packageIndex]).buffer});
|
||||
})
|
||||
} else {
|
||||
const decoder = util.TextDecoder.create('utf-8');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user