Hi
I have developed a connector with Qt that send instruction to equipement on my site.
This equipement located by it IP give an answer in three times
the instruction is 2 byte 0801
the response will be
- 4 bytes 08010d01.
- 32 bytes 00000..... (just zeros).
- 237 bytes 00000..0100000000000001010101010101000000000000000 000000. ( the first byte with 01 is the 16th one and the series of next 01
bytes are in position 101th.
but data that i recieved is:
- 4 bytes 08010d01.
- 32 bytes 0e1f134ffe..
- 237 bytes 000ffffffff0001deae8546796.......... (not expected data)
this is an extract of my code:
connect(socketts,SIGNAL(readyRead()),this,SLOT(recievedata()));
void M10::recievedata()
{
taillemessage=socketts->bytesAvailable();
ui
->taillebuffer
->append
(tr
("La taille de la socket est : ")+QString::number(taillemessage
));
int row = ui->Notification->rowCount();
bab.resize(taillemessage);
buffer.resize(500);
int sizebab = in.readRawData(bab.data(),bab.size());
{
buffer=bab.data();
buffer.resize(taillemessage);
if(buffer.size()>2)
{
ui->textBrowser_2->append(buffer.toHex());
ui->Notification->setRowCount(row+1);
fields1 <<buffer.toHex()<<QString::number(buffer.size());
for(int i=0;i<fields1.count();++i)
taillemessage=0;
}
}
}
connect(socketts,SIGNAL(readyRead()),this,SLOT(recievedata()));
void M10::recievedata()
{
QDataStream in(socketts);
taillemessage=socketts->bytesAvailable();
ui->taillebuffer->append (tr("La taille de la socket est : ")+QString::number(taillemessage));
int row = ui->Notification->rowCount();
QByteArray bab,buffer;
bab.resize(taillemessage);
buffer.resize(500);
int sizebab = in.readRawData(bab.data(),bab.size());
{
buffer=bab.data();
buffer.resize(taillemessage);
if(buffer.size()>2)
{
ui->textBrowser_2->append(buffer.toHex());
QStringList fields1;
ui->Notification->setRowCount(row+1);
fields1 <<buffer.toHex()<<QString::number(buffer.size());
for(int i=0;i<fields1.count();++i)
ui->Notification->setItem(row,i,new QTableWidgetItem(fields1[i]));
taillemessage=0;
}
}
}
To copy to clipboard, switch view to plain text mode
can you explain me why the data is not serialized correctly?
Bookmarks