I have to receive data from TCP socket. It has fixed 16-bytes header (one header's field is data length) and data. I receive it with BigEndian, but it was send with LittleEndian.
I can' find good solution for such a data reception. What is working for me now is (reading one of the header fields):
QByteArray packetType = tcpSocket->read(2);
QDataStream in(packetType);
in.setByteOrder(QDataStream::LittleEndian);
quint16 pT = 0;
in >> pT;
Is there any better way to set QByteArray endianess? Or a way to read specified number of bytes with QDataStream?