Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-14975

waitForReadyRead used with a QTcpSocket may timeout even if data is coming

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.8.5, 5.4.2, 5.5.1
    • Network
    • Windows 7, Window 8.1 64 bit

    Description

      waitForReadyRead is used to wait more data in a thread (see below). Sometimes (approximately each 4-5 GB transmitted) it will block even data is coming.

      // [..]
      forever
      {
         bytesRead = socket->read(buffer, 512 * 1024);
      
         if (bytesRead == 0)
         {
            if (!socket->waitForReadyRead(10000))
            {
               QCoreApplication::processEvents();
               print(socket->bytesAvailable()) // Will always print "8192"!!
               break;
            }
            continue;
         }
         else if (bytesRead == -1)
         {
            break;
         }
         // Data read are used here
      }
      // [..]
      

      It will timeout but still says there is some bytes available!

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-14975
          # Subject Branch Project Status CR V

          Activity

            People

              tpochep Timur Pocheptsov
              gburri Greg Burri
              Votes:
              22 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes