Your first hint was worth one's weight in gold. I've found my mistake with the detailed logging. The problem wasn't the amount of Modbus packages within one TCP package. It seems like that in Wireshark. But the problem was the timeout value which was preset to low.
I have added my answers below to understand my solved problem. -----Ursprüngliche Nachricht----- Von: Interest [mailto:interest-bounces+stephan.pfeiffer=binder-world....@qt-project.org] Im Auftrag von Alexander Blasche Gesendet: Mittwoch, 21. Dezember 2016 10:02 An: interest@qt-project.org Betreff: Re: [Interest] QModbusTcpClient - More than one Modbus ID query in TCP Package I have a couple of questions to understand your use case better. > -----Original Message----- > From: Interest [mailto:interest-bounces+alexander.blasche=qt.io@qt- > project.org] On Behalf Of Pfeiffer, Stephan .... > void BModbus::requestRequiredSlot(BModbusData *data) > > { > > QModbusDataUnit du(QModbusDataUnit::HoldingRegisters, > data->address(), > data->datatype().second); > > QModbusReply *reply = c->sendReadRequest(du,255); > > > connect(reply,&QModbusReply::finished,this,&BModbus::readyReadSlot); > > } > > Everything is working fine if I poll one Modbus address. > The Wireshark Protocol says that only one query is placed in one TCP-package. > > If I query more than one modbus address, then there are all modbus > queries in one TCP-package (also logged with Wireshark). And my device > only sends an answer to the last ID in the package. I take it that you repeat the sendReadRequest() call above multiple times in quick succession (almost like in a loop)? Yes that's right. I send a read request immediately for about 10 different holding register addresses. Then wait between 1 and 60 seconds and repeat it again. When you talk about ID, are you talking about the server address (255 above) or are you talking about different holding register addresses (data->address() above) on the same server address? I'm talking about the different holding register addresses. > Can anyone help me so that the QModbusTcpClient packs every Modbus ID > into a seperate TCP-package instead of all in one? Once I have an answer I might be able to help. There is two more hints which I can give you which might help to debug the problem: 1.) You can enable more detailed logging output by adding QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true")); As first line to your main() function. 2.) The relevant code for your use case is in qmodbustcpclient_p.h. enqueueRequest() is the function that ultimately creates the ADU/PDU. There you can see the relevant logging output. -- Alex _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest