SIMATIC Automation Tool API for .NET framework
6.6 The IProfinetDeviceCollection class
SIMATIC Automation Tool V2.1 user guide
80 Manual, V2.1.1 07/2016, A5E33042676-AC
Finding a specific device in the collection
6.6.3.1
You can search for a specific device in the collection. The following method support this
workflow.
Two versions of this method are provided, one allows the IP address to be represented as a
string, and the other accepts the IP address as an unsigned integer value.
The IP address to search for
The IP address to search for
The following example shows searching for a device at a specified IP address. If the device
is not found in the collection, a NULL reference is returned.
uint targetIPAddress = 0xC0A80001; // 192.168.0.1
retVal = myNetwork.ScanNetworkDevices(out scannedDevices);
if (!retVal.Succeeded)
return;
IProfinetDevice dev = scannedDevices.FindDeviceByIP(targetIPAddress);
if (dev != null)
{
// Found it!
}