[IronPython] Access System.Net.NetworkInformation.GetAllNetworkInterfaces()

Kristopher Kane kristopher.kane at gmail.com
Thu Aug 12 22:44:48 CEST 2010


Hello All,

First time crawling in .NET and was wondering how to access the list
of network interfaces.

I am following a C# example from MSDN that goes something like this:

<C#>

NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();

</C#>
Then they iterate over adapters to list the interfaces.

In IronPython, I am trying to do this:

<IronPython>
import clr
clr.AddReference('System.Net')
from System.Net import NetworkInterface

a[] = NetworkInformation.GetAllNetworkINterfaces()

</IronPython>

Then I will iterate over a to list.

It returns an Attribute error and says that GetAllNetworkInterfaces of
'NameSpace#' object is read only.

This is a strange error to me since I am trying to read from not write to.

What have I messed up here?

Thanks,

-Kris



More information about the Ironpython-users mailing list