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. Sniffing broadcast udp socket on specific MAC address
Servers for Qt installer are currently down

Sniffing broadcast udp socket on specific MAC address

Scheduled Pinned Locked Moved Unsolved General and Desktop
networkudp
3 Posts 3 Posters 454 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.
  • L Offline
    L Offline
    Lior
    wrote on last edited by
    #1

    Hi,
    Let say I have multiple network cards.

    How can I open broadcast udp socket for specific MAC adrress. (port X)

    A small example will be perfect.

    Using qt tools QUdp and QNetworkInterface.
    For now I know how to read all the exist interfaces but didn't understand from the documentation how to open broadcast udp socket.

    *the socket is only for sniffing.

    Tnx.

    Christian EhrlicherC 1 Reply Last reply
    0
    • L Lior

      Hi,
      Let say I have multiple network cards.

      How can I open broadcast udp socket for specific MAC adrress. (port X)

      A small example will be perfect.

      Using qt tools QUdp and QNetworkInterface.
      For now I know how to read all the exist interfaces but didn't understand from the documentation how to open broadcast udp socket.

      *the socket is only for sniffing.

      Tnx.

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

      @Lior The broadcast adress of your interface is the last adress in the possible subnet as explained e.g. in wikipedia. So find out this adress and listen to it.

      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
      1
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        If something else sends a UDP datagram to the sub-net IP broadcast address (e.g. 192.168.1.255 on IP subnet 192.168.1.0/24) then any device connected to, and configured for, that IP sub-net should receive the datagram. You need to know the port that the UDP datagram was sent to also.

        Assuming your listeneing device is connected to the relevant physical network and has suitable IP address/subnet mask, then all you should need is to QUdpSocket::bind() to your IP and port.

        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