Results 1 to 2 of 2

Thread: Read all_ tcp socket

  1. #1
    Join Date
    Dec 2011
    Posts
    5
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Read all_ tcp socket

    Hello ,
    I am working on a TCP client which send request to a server and receive reponses. My problem is when the response is long , it will be divided in a multiple frames. Should I use "ReadAll() to garantee the reception of all data .
    Otherwise , what could I use ?

    thank you for help

    Mayssa

  2. #2
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read all_ tcp socket

    readAll() will only read everything that is available. So you need to use waitForReadyRead() in a loop to block until more data is available (good if the data won't be delayed and blocking won't harm responsiveness of your app), or connect to the readyRead() signal directly so that you don't block, but can continue to read data as it becomes available.

    I have implemented the qt TCP/IP server/client, but I'm pretty new to the whole thing so take the above in that light.
    Last edited by qtYoda; 21st February 2012 at 17:18.

Similar Threads

  1. Replies: 2
    Last Post: 22nd May 2011, 21:31
  2. QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
    By kunalnandi in forum General Programming
    Replies: 1
    Last Post: 24th September 2008, 18:09
  3. socket read/write bytes
    By nowire75 in forum Newbie
    Replies: 3
    Last Post: 4th July 2007, 23:12
  4. Replies: 2
    Last Post: 23rd June 2007, 09:13
  5. Replies: 3
    Last Post: 4th July 2006, 10:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.