void processBuffer() {
const int FRAME_HEAD_SIZE = 8; // 帧头大小,假设每个整数占 4 个字节
const int FUNC_CODE_OFFSET = 0; // 功能码在帧头中的偏移量
const int DATA_LENGTH_OFFSET = 4; // 数据帧长度在帧头中的偏移量
while (buffer.size() >= FRAME_HEAD_SIZE) {
int funcCode = *reinterpret_cast<const int*>(buffer.constData
Qt使用QTcpsocket帧解析问题
于 2024-02-20 17:11:55 首次发布