ed1023:
Ok , my problem is I don’t know what terms to search for.
There isn't really a standard but you might look into WiFi Beacon announcements and Network Service Advertisement. The details are different but the principles are largely the same.
What I want to have happen is have a program on a server that pings (I think multicast) all devices on the network asking if the a device is one of these sensors.
Multicasting is something different and not entirely straightforward using the Arduino libraries.
If it is one of these sensors the the arduino will respond back to the program with the ip address of the sensor and maybe some other information (like mac address).
Polling an address space is extremely wasteful of network resources, can cause cascade issues and should be avoided whenever possible. HP's Jet Admin software was famous for causing network floods when used carelessly.
Another big issue with polling is you have to wait 'some time' before deciding there will be no response, before moving to the next address. The polling period becomes a function of the size of the address space, and the fewer devices there are responding, the longer the polling cycle takes
If someone out there can point me to examples or give me correct terms to search for it would be a great help. Or if any one has a better idea of how to go about this.
Typically, what you want to do would be done by reversing the question.
Rather than having the server search for devices, you have the devices periodically announce their presence on the network, to the server. The server maintains a list of IPs of the active devices and removes any which fail to contact it within some time period. You don't have to worry too much about IP address changes as the active device list on the server only contains active IP addresses. If you can use UDP, use UDP and you won't have to worry about the server being down for maintenance either. Importantly for a device with limited resources (like an MCU), the bulk of the processing is carried out on the server, which should have far more resources available to absorb it.
Things to consider.
How often do you need the devices to announce their presence?
- As more devices are added to the network, the volume of announcement traffic will grow.
- A dozen devices announcing once a second would not be a problem.
- A hundred devices announcing once every millisecond, could be a problem.
Will the server IP ever change?
- You could embed the server IP on the Arduino but you would need a method to change it.
- You could use a DNS record but you would need a DNS server to serve it.
- You could use a broad-cast packet to solicit the server IP but I don't know how easy that is with an Arduino
- You could avoid the problem completely, by using DHCP reservations for each Arduino.
A device like a network printer, will allow you to do all and any of these things, with a fall back method.