Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't get QUdpSocket's readyRead() to fire.
Forum Updated to NodeBB v4.3 + New Features

Can't get QUdpSocket's readyRead() to fire.

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 707 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RWey52
    wrote on last edited by
    #1

    This is a very common problem and I did a lot of searching before posting this, but none of the similar problem discussions yielded any answers.

    I'm using a simple QUdpSocket, where I get it up and running as such:

    [code]
    // Initialize.
    udpSocket = new QUdpSocket( this );

        if( udpSpec->clientIpAddr != NULL )
            srcUdpAddr = new QHostAddress( udpSpec->clientIpAddr );
        srcUdpPort = udpSpec->clientPort;
        dstUdpAddr = new QHostAddress( udpSpec->fpgaIpAddr );
        dstUdpPort = udpSpec->fpgaPort;
    
        if( udpSpec->clientIpAddr != NULL )
        {
            if( udpSocket->bind( *srcUdpAddr, srcUdpPort ) == false )
               throw( EVENT_RX_UDP_ERROR );
        }
        else
        {
            if( udpSocket->bind( srcUdpPort ) == false )
                throw( EVENT_RX_UDP_ERROR );
        }
    
        connect( udpSocket, SIGNAL( readyRead() ), this, SLOT( UdpDataReady() ) );
    

    [/code]

    Everything initializes fine, and udpSocket->writeDatagram(...) sends it's datagrams, confirmed using WireShark. The destination device replies back with a UDP datagram, again confirmed with WireShark, but my UdpDataReady() slot is never called. I've tried everything I can think of, and no go.

    Not shown is a QTimer that I have in place to timeout on reply datagrams, and I put a debug message in the timer handler that inspected the udpSocket->hasPendingDatagrams(), but it returns false. The socket is properly bound, and again WireShark confirms my incoming datagrams, but no readRead() every fires. It's as the socket binding simply isn't receiving incoming datagrams.

    Thoughts? Am I missing something?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved