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

bytesAvailable() always zero on fifo file read!

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.7.0
    • Network: Sockets
    • None
    • OpenSUSE 11.3 with qt 4.7.0 + kde SC 4.5.2 Qt compiled according to the kde manual.

      I open QFile object on the fifo file. Use QSocketNotifier to understand when data arrives (connect it`c activate signal to the my slot). So In this slot QFile::bytesAvaliable always return zero!.

      some code:

      SomeClass::SomeClass()
      {
      ....
      channel = new QFile("../channel");
      notifier = new QSocketNotifier(channel->handle(), QSocketNotifier::Read, this);
      connect(notifier, SIGNAL(activated(int)), this, SLOT(read(int)));
      ....
      }
      
      SomeClass::read(int desc)
      {
      qDebug() << channel.bytesAvailable(); //This always print zero! But
      
      int canRead = 0;
      qDebug() << "ioctl result:" << ioctl(desc, FIONREAD, &canRead); // This print right value - there is non zero data!
      }
      

      Is it a bug in Qt? Or I do something wrong. I think it is a bug because it is a similar to the http://www.qtcentre.org/threads/20268-Non-blocking-stream-read and it doesn`t work for me.

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

            Unassigned Unassigned
            mskmsk_1985 Mihail
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes