Posts Tagged ‘networkutils’

Undocumented WHS Classes: NetworkUtils

October 8, 2009

Another small class, in the series of undocumented API’s in Windows Home Server.

This new article describes the undocumented functions in the NetworkUtils class which is located in WHSCommon.dll.
This class contains 2 handy functions to get IP/Mac address of the server & the IP of the router.

void GetRouterIPAndServerMAC(out string ip, out string mac)
Get the IP address of the router and mac address of the server.

Sample code
string ip, mac;
NetworkUtils.GetRouterIPAndServerMAC(out ip, out mac);

Sample output
IP: 172.19.3.1
MAC:00-19-DB-7B-6D-35

string GetServerIP()
Get the IP address of the server.
Sample code
string serverIp = NetworkUtils.GetServerIP();

Sample output
IP: 172.19.3.10

So as you see, two very easy to use functions, that a very handy!
You can follow ASoft @Twitter: http://twitter.com/asoftware

Have fun!