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. QUdpSocket can't receive data from specific interface
Qt 6.11 is out! See what's new in the release blog

QUdpSocket can't receive data from specific interface

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 546 Views
  • 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.
  • I Offline
    I Offline
    Ivan Perynets
    wrote on last edited by
    #1

    Hi all,
    I am trying to receive data from a hardware device using a UDPSocket.
    I have successfully connected to port via UDPSocket->bind

     if( socket->bind(QHostAddress("192.168.250.151"), port )
    

    but the data not coming.

    When I opened WireShark and select the Ethernet adapter the data receive successfully.

    Another words UDP data from device receiving only when WireShark is open.

    Mayby I need to specify Ethernet adapter to the port...
    Any ideas? Thanks.

    ![alt text](wireshark.png image url)

    Christian EhrlicherC 1 Reply Last reply
    0
    • I Ivan Perynets

      Hi all,
      I am trying to receive data from a hardware device using a UDPSocket.
      I have successfully connected to port via UDPSocket->bind

       if( socket->bind(QHostAddress("192.168.250.151"), port )
      

      but the data not coming.

      When I opened WireShark and select the Ethernet adapter the data receive successfully.

      Another words UDP data from device receiving only when WireShark is open.

      Mayby I need to specify Ethernet adapter to the port...
      Any ideas? Thanks.

      ![alt text](wireshark.png image url)

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Ist the port correct, does your host really have the ip address 192.168.250.151? Do you have correctly configured the firewall (esp. on windows this is a common problem).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ivan Perynets
        wrote on last edited by
        #3

        Firewall and antivirus is turned off.
        I wrote local IP address and the port manually, but nothing changed.

        if( socket->bind(QHostAddress("192.168.250.151"), 52100 ) )    
            {
                qDebug() << "PASS, Port Num : is connected";
            }
            else
            {
                qDebug() << "FAIL connected to UDP";
        }
        

        It is really strange behavior.

        Christian EhrlicherC 1 Reply Last reply
        0
        • I Ivan Perynets

          Firewall and antivirus is turned off.
          I wrote local IP address and the port manually, but nothing changed.

          if( socket->bind(QHostAddress("192.168.250.151"), 52100 ) )    
              {
                  qDebug() << "PASS, Port Num : is connected";
              }
              else
              {
                  qDebug() << "FAIL connected to UDP";
          }
          

          It is really strange behavior.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #4

          I'm pretty sure it's the windows firewall. Try to send to a dedicated adress instead broadcast to see if it helps but QUdpSocket can handle both correctly. See also the examples and try them out: https://doc.qt.io/qt-6/qudpsocket.html#details

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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