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

QNetworkReply canReadLine does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.2
    • Network
    • None
    • Ubuntu 9.10 x86_64 Qt 4.6.2
    • dd6c5cad88a56fb3a342fe9d4fc3b113ffe3fd53

    Description

      I am trying to read an mjpgstream with QNetworkReply.
      First the server sends a boundary string terminated with \r\n
      I have tried to parse it with a slot connected to the QNeworkReply's readyRead() signal:

      void GetImage::mjpgReadyRead()
      {
          qWarning() << mjpgReply->bytesAvailable();
          if (mjpgReply->canReadLine()) {
              qWarning() << "can";
              mjpgBoundary = mjpgReply->readLine();
              mjpgState = MjpgHeader;
              qWarning() << mjpgBoundary << mjpgBoundary.length();
          }
      

      And it never finds lines.

      I have figured out that if I call a getChar before the canReadLine it works ok.

       
      void GetImage::mjpgReadyRead()
      {
          qWarning() << mjpgReply->bytesAvailable();
          char c;
          mjpgReply->getChar(&c);
          if (mjpgReply->canReadLine()) {
              qWarning() << "can";
              mjpgBoundary = mjpgReply->readLine();
              mjpgState = MjpgHeader;
              qWarning() << mjpgBoundary << mjpgBoundary.length();
          }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mgoetz Markus Goetz (Inactive)
            martonmiklos Miklós Márton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes