SIMATIC Automation Tool API for .NET framework
6.6 The IProfinetDeviceCollection class
6.6.3
Finding a specific device in the collection
6.6.3.1
FindDeviceByIP method
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.
Return type
Method name
IProfinetDevice
FindDeviceByIP
Name
Data type
ip
uint
string
ipString
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)
IProfinetDevice dev = scannedDevices.FindDeviceByIP(targetIPAddress);
if (dev != null)
{
// Found it!
}
80
return;
Parameters
Parameter type
In
In
Description
The IP address to search for
The IP address to search for
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC