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

QUdpSocket::readDatagram Compatibility Break in 4.8 on Symbian

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.0
    • Network: Sockets
    • Symbian Belle Refresh
      Symbian Belle FP1
      Symbian Belle FP2

    Description

      Use of QUdpSocket::pendingDatagramSize and readDatagram is not compatible with other platforms or previous versions of Qt on Symbian.

      The new Symbian implementation of pendingDatagramSize in 4.8's qsymbiansocketengine.cpp throws away the datagram header, thereby losing the sender address and port information. This breaks code like the sample below:

      void DuktoProtocol::newUdpData()
      {
          while (mSocket->hasPendingDatagrams()) {
              QByteArray datagram;
              datagram.resize(mSocket->pendingDatagramSize());
              QHostAddress sender;
              quint16 senderPort;
              mSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
              handleMessage(datagram, sender);
           }
      }
      

      Full source is available at:
      https://code.google.com/p/dukto/source/browse/trunk/duktoprotocol.cpp

      The expected behaviour is that pendingDatagramSize does not throw away the sender address and port information. When non-null sender and port parameters are supplied to readDatagram, this method should always provide the caller with this info from the datagram.

      http://qt-project.org/doc/qt-4.8/qudpsocket.html#readDatagram

      Attachments

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

        Activity

          People

            ppentika Pasi Pentikäinen
            bron Bron Mach
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes