×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    1

    Question Qudpsocket readDatagram get null in QHostAddress on Belle FP1?(at least 808 pureview)

    Possible found a strange issue on readDatagram.

    The following code works fine on desktop or Nokia N8 Belle.
    But the sender QhostAddress is null on 808 pureview.

    Is there any workaround?



    mSocket = new QUdpSocket(this);
    mSocket->bind(QHostAddress::Any, mLocalUdpPort);
    connect(mSocket, SIGNAL(readyRead()), this, SLOT(newUdpData()), Qt:irectConnection);

    void newUdpData()
    {
    while (mSocket->hasPendingDatagrams()) {
    QByteArray datagram;
    datagram.resize(mSocket->pendingDatagramSize());
    QHostAddress sender;
    quint16 senderPort;
    mSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
    if(sender.isNull())
    qDebug("sender empty");
    else
    handleMessage(datagram, sender);
    }
    }

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Re: Qudpsocket readDatagram get null in QHostAddress on Belle FP1?(at least 808 purev

    This code is very similar to my Dukto code :-) that is suffering for the exactly same problem on all the Belle FP1 updated devices. I'm looking for a way to workaround it and asking Nokia for support. If anyone has any update about this problem, please let us know!

  3. #3
    Nokia Developer Expert
    Join Date
    Jun 2010
    Posts
    24

    Re: Qudpsocket readDatagram get null in QHostAddress on Belle FP1?(at least 808 purev

    Yes, it appears that QUdpSocket:endingDatagramSize has unwanted side effects on a subsequent readDatagram call in Qt 4.8 on Belle Refresh and Belle FP1.

    This is reported as a bug to Qt here:
    https://bugreports.qt-project.org/browse/QTBUG-27152

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2012
    Posts
    2

    Re: Qudpsocket readDatagram get null in QHostAddress on Belle FP1?(at least 808 purev

    The simple workaround is not to ask for size first, but instead allocate a 64k datagram buffer and resize based on what readDatagram returns (on success).

  5. #5
    Nokia Developer Expert
    Join Date
    Jun 2012
    Posts
    2

    Re: Qudpsocket readDatagram get null in QHostAddress on Belle FP1?(at least 808 purev


Similar Threads

  1. Replies: 6
    Last Post: 2012-06-26, 11:37
  2. Question for qudpsocket class ???!
    By CoaValoVa in forum [Archived] Beginning Qt
    Replies: 2
    Last Post: 2011-03-19, 01:56
  3. QUdpSocket problems on windows?
    By candinico in forum Qt
    Replies: 2
    Last Post: 2011-01-27, 10:23
  4. Replies: 1
    Last Post: 2010-08-12, 10:27
  5. VideoControl.getSnapshot(null) returns null-value
    By cipherovski in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2010-01-11, 07:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×