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

QUdpSocket stop emitting ReadyRead signal in QueuedConnection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.0 RC2
    • Network: Sockets
    • None
    • Linux/X11, macOS

    Description

      hi

      I've found a bug related to readyRead signal in QUdpSocket class, I have not tested it in other subclasses of QAbstractSocket but it might occur the same thing.

      considering the attached project, if we use QueuedConnection, it will stop firing readyRead signal after a while.
      I've gone deeper and found that there might be a situation in which hasPendingDatagram() returns false at the first try in the connected slot, so the signal emission won't get enabled again(to provide more detail, Qt itself has a flag to determine if it's needed to send readyRead signal  on each new data or not, this flag is set and ReadyRead get disabled, after calling receiveDatagram(), the flag and signal emission will be enabled again, so if received a signal but don't call receiveDatagram(), emission won't be activated.)

      to overcome this problem (temporarily), you must either use a direct connection or call 

      socket->readDatagram(0,0) explicitly after getting the signal, regardless of having any pending datagram or not.

       

      I've generated the traffic using this command:

      iperf -u -p 8888 -c 192.168.1.102 -n 200000M -b 10M
      which 192.168.1.102 is my local ip address.

       

      thank you all and have a nice day

      Attachments

        Activity

          People

            manordheim Mårten Nordheim
            amir_sadough amir sadough
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: