Still will not find systems on the network. So far the only way for this to work is to go into NI MAX and set the ip address. I tried deleting them from NI MAX and then nothing showed up. However NI MAX can find them and NI Network Browser can find them, so how are they searching and why can't we do the same?
The NI Device Discovery (e.g. pressing 'Refresh' in MAX), works using periodic UDP broadcasts and then switches over to TCP when it knows the IP address of the target. UDP broadcasts are often blocked outside of the same subnet and/or once it has to go through a router/gateway. This is why you can 'add' the device by IP address as it skips the broadcast part and connects directly by TCP which goes through subnets. If you need to 'discover' the device, you generally need to make sure that it is on the same subnet.
I don't think I've ever tried to discover all devices through the System Configuration API but a quick test with the following code returned only cRIOs that were present on the same subnet. I also tried 'Find Systems' and got the same result - it returned only the cRIOs present on the same subnet.
The lab computer has a runtime license installed so MAX is not installed on this machine.
You can install MAX without a development license.
Of course, Windows firewall blocking incoming UDP data on the port that is used by the Network Discovery would also stop it from working.
Then how does the network browser work? So far that is the only method to find the IP address. I am modifying my host system to allow an IP address to be directly entered, but will still have to use the network browser to find the ip address since it is given to the cRIO by the DHCP.
The network browser, NI MAX remote devices and the code snippet I posted above all work in the same way for me - it only shows the one cRIO which is on the same subnet as my PC. We have another 30 or so cRIOs but they are on a different subnet so the UDP packets get blocked. I can add them manually by IP address, or I need to plug my PC into the lab network and then do the search and they will show up because the RIOs and my PC will be on the same subnet.
My results show something different. First when I run your program, I only get the IP address of the the PC that it is running on. No cRIO systems show up. Second, if I go into ni-max and delete the cRIO devices then I see nothing but the NI network Browser shows 3 systems located in xx.xx.50.yy, xx.xx.80.yy, xx.xx.50.yy. I have tried all combinations of true/false and "none"/"only if online"/"all" for inputs to the find systems but only the fixed IP cRIO shows up. If I manually add them to the ni-max then they will show up. Something in the code for the NI Network Browser is different. Does anyone have access to the source code to see what they are doing that is different than what we can do?