Sniffing broadcast udp socket on specific MAC address
-
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.
-
-
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.