Categories
Uncategorized

Mono/C#: Get all interface addresses

Due to some missing parts of System.Net.NetworkInformation, I’ve written a (very basic and libc-based) wrapper to collect network interface address inform­a­tion from the system. It calls getifaddrs, walks through the ifaddrs structure and creates a managed coun­ter­part.

NetworkInterfaceAddress.cs

Even though it may be imple­men­ted way too com­plic­ated or confusing, it might be useful for someone out there.

Update 2009-01-01: Well… first, the download didn’t work anymore. Second, there was a bug in the code :) Both short­com­ings are fixed now :)