Important: Please read the Qt Code of Conduct -

QUdpSocket receiving broadcast versus direct

  • Hi,

    I've been chasing problems with readyRead() not firing and discovered the following problematic behaviour (so far on macOS) with QUdpSocket.

    • If QUdpSocket bind is set to QHostAddress::Any, readyRead() only fires when broadcast packets arrive
    • If QUdpSocket bind is set to a specific IP address, readyRead() only fires when directly addressed packets arrive

    (In both cases the port is fixed and mode is ShareAddress.)

    My expectation is that when set to QHostAddress::Any, QUdpSocket should receive BOTH broadcast and directly addressed packets, but this doesn't appear to be the case.

    Can anyone explain this? Do I need to have two QUdpScocket classes bound for the two cases? And will this work?

    Kind regards,

  • Never mind. I discovered I had 7+ processes still running from previous testing that were all interfering with receiving packets. All working as expected now.

Log in to reply