Reputation: 158
Issue: Since dataRate is the same on sending side, every time one of the stream is missed at receiving side.
It is just a sample code so please ignore typos or syntax errors. Sender Side :
timer1.setInterval(1000) with Message_Id = 1
timer2.setInterval(100) with Message_Id = 2
timer3.setInterval(100) with Message_Id = 3
//data is sent in the timer Handlder
//data is sent successfully and cross-checked
Receiver Side:
QByteArray array;
QDataStream stream(&array:QIODevice:ReadOnly)
array = tcpServerConnection->readAll()
MyMessageType message;
stream >> message;
switch(message.id){
case 1:{
MessageType1 message1;
stream >> message1;}
break;
case 2:{
MessageType2 message2;
stream >> message2;}
break;
case 3:{
MessageType3 message3;
stream >> message3;}
break;}}
So in this case, if Message2 and Message3 have the same timer intervals, only one of them is received. Individually every message is received just fine.
Also with different random intervals, each message is received just fine.
What can be the issue with the same time intervals when sending a Qdatastream?
Upvotes: 0
Views: 46