[Mono-dev] get mac address using system.management
yosi100 at gmail.com
Tue Apr 14 02:53:56 EDT 2009
hi mike and thanx for the answer,
as far as I could see, mono have support for system.management.dll in the
about the rest of the answer, well, it sounds like Chinese to me.
a little piece of code will do more help.
Mike Edenfield wrote:
> On 4/13/2009 1:50 PM, tooty wrote:
>> so, can anyone tell me what is the wright method of managementclass that
>> will let me get the network adapter properties?
> I don't believe any of the System.Management namespace is currently
> implemented, for exactly the reason you specified: WMI is way too
> closely tied to Windows.
>> or any other way i should use for linux system?
>> thnx in advance.
> The typical ways on a Unix system to get the hardware address:
> * Run ifconfig and parse the output (e.g. via Process())
> * On Linux, at least, you can read from sysfs (assuming a new enough
> kernel): /sys/class/net/<ifname>/address
> * Open a socket, and send it an ioctl(SIOCGIFHWADDR), passing in a
> struct ifreq with the "ifr_name" field set to the interface name. On
> return, the "ifr_hwaddr.sa_data" field contains the hardware address.
> You should be able to use the Socket::IOControl method to help here.
> * Read the kernel source for how SIOCGIFHWADDR is implemented, then do
> that :) Probably involving way more work with DllImport, Marshalling,
> and syscalls than you want to think about.
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
View this message in context: http://www.nabble.com/get-mac-address-using-system.management-tp23025958p23034119.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list