[Interest] Simple device discovery using UDP

coroberti . coroberti at gmail.com
Tue Oct 2 17:14:01 CEST 2018


On Tue, Oct 2, 2018 at 5:02 PM Murphy, Sean <smurphy at walbro.com> wrote:
>
> > I have an app (Desktop) that I want it to know about other running instances
> > on the local network. I figured UDP broadcast was a natural choice. I tried it,
> > but I never saw anything but my own (local) packets. There's quite a few
> > stackoverflow questions, but none used Qt. I'm wondering if it's a wifi/router
> > thing?
>
> A couple of first questions:
> - do you have any sort of firewalls running anywhere?
> - have you tried the Qt Networks examples, and do those work?
>   http://doc.qt.io/qt-5/qtexamples.html#qt-network, maybe the Broadcast
>   Sender & Receiver examples
>
> Sean
>
Hi,
1. As Sean has mentioned, firewall settings that do not allow broadcasts
could be the case.

2. Yet another case could be: QHostAddress::Broadcast.
It's so-called All-Networks-Broadcast (255.255.255.255)
and normally requires alleviated privileges to send to (UNIX root, suid)
and could be guarded.

There's another broadcast address - so-called LAN-broadcast
which is less sensitive and more appropriate for broadcasting.

For example, at network 10.31.4.0/24, it will be 10.31.4.255,
and you can find various rules to calculate it.

3. Instead of using a broadcast address, you can figure our all
addresses on this network
and send unicast requests except to the subnet broadcast address .
At most networks, it will be sending to up to 253 address, whereas
rarely it could come to higher numbers.

Take care,

Kind regards,
Robert
............................



More information about the Interest mailing list