Retreive device's IP Address, Mac Address, and host name under Compact Framework 2.0
Hi Experts,
The title sais it all! I need to retreive the local device's IP Address, Mac Address, and host name under Compact Framework 2.0! Any help would be greatly appreciated!
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily.ToString() == "InterNetwork")
{
localIP = ip.ToString();
}
MessageBox.Show(localIP);
}
The solution you provided for Mac address doesn't work under the compact framework but fortunately my reqiurements have changed and I no longer need to be able to retreive it!
Thanks for your help!
.NET Programming
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
ASKER
using System.Net;
IPHostEntry host;
string localIP = "?";
host = Dns.GetHostEntry(Dns.GetHo
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily.ToString
{
localIP = ip.ToString();
}
MessageBox.Show(localIP);
}
The solution you provided for Mac address doesn't work under the compact framework but fortunately my reqiurements have changed and I no longer need to be able to retreive it!
Thanks for your help!