My project has a server and several client Pis on a local network. The goal is to have the server sends commands to all active/online client Pis.

To facilitate this, my idea is that once a client has booted, it checks in to the server so the server knows it's online and where to find it. I've avoided the nmap solution in this post because I feel there's a more elegant solution since the client Pis can be running any helpful identification service to make this easier.

My current prototype has the server sending UDP broadcast messages. The client Pis run a listening script that, upon receiving the broadcast, send a message back to the ip of the broadcast (the address of the server) with the appropriate info. The server then knows where to send commands to clients once they've checked in. (Weird side note, my Pi client receives/recognizes roughly only 5% of the broadcast messages sent out).

What is the better design decision? This post suggests using UPnP / DLAN, however the only examples I've found are for media streaming devices (which seems to go far beyond the needs / complexity of my project).

The other option I've found is using Bonjour. The server would configure a host name that all clients would know and be able to send messages to (essentially saying they're alive and online). Additionally, the client Pis could setup their own hostnames.

Please let me know if one makes more sense for more application or if there is something else I should research. I appreciate any advice!

Is the server also the dhcp server? Then you got the IP addresses of connected clients anyhow. Otherwise, if clients have a simple naming scheme like -- let's say -- pi1, pi2 etc, the server could scan all pi{1..20}.local clients (simply install avahi if not yet done).
– PhilipposApr 5 '17 at 14:22

The server is not the DHCP server. Your other recommendation might be a perfect simple solution - will update once implemented.
– Grant GApr 5 '17 at 14:53

The client.php will receive the hostname on the 'host' variable and from the header, you can extract the caller IP address (and port). At the same time, client.php, can return other information to the client, saved on /tmp/reply.

I use saltstack.com to do this, which is a free server management tool written in Python. I have see this too for my home automation, and for large scale industrial iot projects. Clients (minions) connect to a server (master) and the master can list active clients, manage their configuration, and send commands to one or all.