Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
houmingc last edited by
My server is not receiving data from my client.
Don't understand what does seek() do and why need 2object out and block at the same time.
Below is my code
socket.connectToHost(ServerIP,10010); qint16 CRC; unsigned char TCPdata; TCPdata=0x20; TCPdata=0x20; TCPdata=0x00; CRC =ModbusCRC((unsigned char*)TCPdata,3); QByteArray block; QDataStream out(&block,QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_5_0); out.device()->seek(0); out<<0x20<<DeviceNum<<0x00<<CRC; socket.writeData(block.data(),block.size());
Please don't post the almost same question twice, closing this one