Results 1 to 18 of 18

Thread: Raw data I/O

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2016
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Raw data I/O

    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:
    Qt Code:
    1. connect(socketts,SIGNAL(readyRead()),this,SLOT(recievedata()));
    2. void M10::recievedata()
    3.  
    4. {
    5. QDataStream in(socketts);
    6. taillemessage=socketts->bytesAvailable();
    7. ui->taillebuffer->append (tr("La taille de la socket est : ")+QString::number(taillemessage));
    8. int row = ui->Notification->rowCount();
    9. QByteArray bab,buffer;
    10. bab.resize(taillemessage);
    11. buffer.resize(500);
    12. int sizebab = in.readRawData(bab.data(),bab.size());
    13.  
    14. {
    15. buffer=bab.data();
    16. buffer.resize(taillemessage);
    17. if(buffer.size()>2)
    18. {
    19. ui->textBrowser_2->append(buffer.toHex());
    20. QStringList fields1;
    21. ui->Notification->setRowCount(row+1);
    22. fields1 <<buffer.toHex()<<QString::number(buffer.size());
    23. for(int i=0;i<fields1.count();++i)
    24. ui->Notification->setItem(row,i,new QTableWidgetItem(fields1[i]));
    25.  
    26. taillemessage=0;
    27. }
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 
    can you explain me why the data is not serialized correctly?
    Last edited by anda_skoa; 5th March 2016 at 10:56. Reason: missing [code] tags

Similar Threads

  1. Replies: 8
    Last Post: 16th July 2015, 19:44
  2. Replies: 1
    Last Post: 27th February 2015, 06:00
  3. Replies: 0
    Last Post: 25th February 2014, 16:17
  4. Replies: 0
    Last Post: 10th September 2011, 13:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.