int Query()
This method is used to detect all ETH32 devices on the local network segment and all of their available device information and configuration settings. Once this method returns, the configuration data for any devices that have been found will be available through the Result Property.
The number of devices that were found is returned by the method, but also remains available from the NumResults Property. When you are finished with the results, you may free the memory associated with the results using the Free Method. This is done automatically for you if the object is destroyed, or if you call the DiscoverIp Method or the Query Method again on the same object. Note that this means each Eth32Config object holds only one active set of results at one time.
As opposed to the DiscoverIp Method, which is only supported by devices with firmware 3.000 and greater, the Query Method detects all devices with all firmware versions. This method sends several queries out repeatedly in case any queries or responses are lost on the network. It also delays for a short while to listen for responses. Because of this, the DiscoverIp Method method will be faster if you are looking for a specific device, know its MAC address or serial number, and know it is running firmware v3.000 or greater.
Eth32Config devdetect = new Eth32Config(); int i; try { // Set broadcast address - this line would not // be necessary since 255.255.255.255 is the default anyway devdetect.BroadcastAddressString = "255.255.255.255"; // Find all devices devdetect.Query(); if (devdetect.NumResults == 0) MessageBox.Show("No devices were found."); else { for (i = 0; i < devdetect.NumResults; i++) { MessageBox.Show("Device found with IP address of: " + devdetect.Result[i].active_ip.ToString()); } } } catch (Eth32Exception err) { // Handle errors here }