Results 1 to 3 of 3

Thread: QUdpSocket Variable Speed Issue

  1. #1
    Join Date
    Feb 2014
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QUdpSocket Variable Speed Issue

    Hi,

    I am using QUdpSocket to stream an image locally, and I have noticed after a few hours that the write speed seems to fluctuate, as illustrated in the attached pic.

    My program is basically:

    connect sendimage() to slot_sendimage()

    in a Qthread run loop:
    @35Hz, emit sendImage();

    Slot definition
    slot_sendimage()
    {
    // say about 30 datagrams per image
    for(int a = 0; a < 30; a++)
    {
    // 4 byte packet header
    QByteArray UdpHeader(headerdata,sizeof(headerdata));

    // 8188 byte packet data
    UdpHeader,append(packetdata);

    UdpSocket->writeDatagram(UdpHeader.data(), UdpHeader.size(), QHostAddress(HOST), PORT);
    }
    // Get the rate at which slot_sendimage() is executed and plot
    }

    As I said, everything is fine for about 2 hours, then the writeDatagram rate starts to jump around. I am unsure is this a signal->slot issue, a QByteArray.append issue, a QUdpSocket issue, or some ubuntu network management issue.

    Any help or input would be much appreciated.

  2. #2
    Join Date
    Oct 2013
    Posts
    41
    Thanks
    1
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QUdpSocket Variable Speed Issue

    You could test if its the signal/slot connection (or the timer) by setting it up to not send packets, just update some log and seeing if it still happens.

    You could check if its the QByteArray.append by hard coding the packet and sending the same one over and over to see if it still happens.

    As for the QUdpSocket or network management issues, I think it would be hard to pinpoint something specific there.

    Also, there is no attached pic.

  3. #3
    Join Date
    Feb 2014
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QUdpSocket Variable Speed Issue

    Hi, thanks for the suggestions. Turns out the problem was with the signal->slot. I resolved it by using a direct connection from my signal in QThread::run() to the QUdpSocket->write slot function and ignoring the runtime warning of "QObject cannot create child process etc.etc.".

    I don't really understand why signal->slot frequency became unreliable after a few hours (queuing related I would assume), nor do I understand the significance of the QObject warning, as it seems to have no affect whatsoever on my application, and now QUdpSocket is writing smoothly at constant speed for over 26 hours.

Similar Threads

  1. How to speed up the Qt GUI apps launch speed?
    By wshn13 in forum Qt Programming
    Replies: 3
    Last Post: 14th March 2012, 08:37
  2. Replies: 15
    Last Post: 15th April 2011, 12:55
  3. QudpSocket: Speed Issue
    By jepessen in forum Qt Programming
    Replies: 4
    Last Post: 25th March 2011, 19:37
  4. connect() variable passing issue
    By hojoff79 in forum Newbie
    Replies: 6
    Last Post: 1st February 2011, 11:18
  5. Rendering rectangles speed issue
    By macbeth in forum Qt Programming
    Replies: 11
    Last Post: 15th March 2007, 01:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.