Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IP address in windows phone 8

i need to find the IP address of the phone my software is running on. I would have thought that is straight forward but having searched the forums it seems like (unbelievably enough) that there isn't a method for this in windows phone 7 - however, has this changed in windows phone 8? any help would be appreciated.

like image 408
morishuz Avatar asked Nov 22 '12 05:11

morishuz


People also ask

How do I locate my IP address?

On an Android/tabletGo to your Wifi network settings, then select the network you're connected to. You'll find your IP address along with the other network information.

How do I find IP address in Windows 8?

How to check your local IP address in Windows 8/8.1. Open the Start menu, type network, and select network connection settings. Click Network in the Connections menu. Your IP address will be shown here.

How do I fix my IP address on Windows 8?

Left-click “Internet Protocol Version (TCP/IPv4)” to select, then click Properties. Select the radio button "Use the following IP address". Enter your desired IP address and click into the Subnet Mask area, which should auto-fill appropriately. Click OK twice to apply the settings.


2 Answers

Yes this is now possible in WP8 without using the multicast solution required for WP7. Note that you will have multiple network interfaces on your phone (e.g. three on my WP8 Emulator)

public static IPAddress Find()
{
    List<string> ipAddresses = new List<string>();

    var hostnames = NetworkInformation.GetHostNames();
    foreach (var hn in hostnames)
    {
        if (hn.IPInformation != null)
        {
            string ipAddress = hn.DisplayName;
            ipAddresses.Add(ipAddress);
        }
    }

    IPAddress address = IPAddress.Parse(ipAddresses[0]);
    return address;
}

HTH

like image 73
paiden Avatar answered Oct 07 '22 18:10

paiden


Of course there is a way to find the phones IP address. Here is a MSDN blog blog article which explains how to do it: Finding Your Own IP Address On Windows Phone Mango

I've just tested it on my Nokia Lumia 920 (Windows Phone 8) and it works just fine. However, this just works on WiFi due to the used multicast IP.

like image 23
S0me0ne Avatar answered Oct 07 '22 17:10

S0me0ne