SIMATIC Automation Tool API for .NET framework
6.5 The Network class
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC
75
SetCurrentNetworkInterface method
SetCurrentNetworkInterface
In The name of the network interface to use.
Normally this will be one of the names
returned from the
QueryNetworkInterfaceCards method.
To use one of the identified network interface cards to access the industrial network, it is
necessary to "set" this interface. The following code shows how to assign one of the
identified network interfaces for API operations. In this example, the code selects to use the
first network interface card identified in the previous example.
Result retVal = myNetwork.SetCurrentNetworkInterface(interfaces[0]);
if (retVal.Succeeded)
{
//------------------------------------------------
// The action succeeded. Continue with operations.
//------------------------------------------------
}
CurrentNetworkInterface property
This property is provided to query for the currently-selected network interface. This property
is read-only. The following example shows the usage of this property.
string currentInterface = myNetwork.CurrentNetworkInterface;
Note
This property will return an empty string if no network interface was selected by a previous
call to the SetCurrentNetworkInterface
method.