So I am having issues gettign someting as simple as the Wireless adapter IP address in C#. I don't feel that it should be this difficult. The PC I am ussing is only WiFi currently so running the below code only returns localhost as an IP address. Looks Like I am only looking at the ethernet interface and not wireless.
Please help.
public static string GetIPAddress()
{
IPHostEntry host;
string localIP = "?";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
}
}
return localIP;
}