1

Actually I tried to get the list of Ip Addresses of the LAN for Windows Store Apps using Xaml and C#. Can Any one Please tell me how to do this and referred this link How to get LocalNetwork IP Address For WindowsStore Apps but it is showing the local machine Ip address but I want the list of connected host names and Ip addresses which are connected to the local server in LAN. Here is my code:

var hostNamesList = Windows.Networking.Connectivity.NetworkInformation
        .GetHostNames();

            foreach (var entry in hostNamesList)
            {
                if (entry.Type == Windows.Networking.HostNameType.DomainName)
                {


                    var icp = NetworkInformation.GetInternetConnectionProfile();

                    if (icp != null && icp.NetworkAdapter != null)
                    {
                        var hostname =
                            NetworkInformation.GetHostNames().SingleOrDefault(
                                hn =>
                                hn.IPInformation != null &&
                                hn.IPInformation.NetworkAdapter.NetworkAdapterId ==
                                icp.NetworkAdapter.NetworkAdapterId);


                        MessageDialog msg = new MessageDialog(hostname.CanonicalName);
                        await msg.ShowAsync();
                        MessageDialog msg1 = new MessageDialog(entry.RawName);
                        await msg1.ShowAsync();

                    }
                }
            }
        }
Community
  • 1
  • 1
  • Based on the link that you have posted there ..what is your HostName that you are passing.. ? can you provide some code that you have that shows how you are actually trying to get the list of ip addresses on the lan..? – MethodMan Dec 26 '12 at 05:30
  • @DJ KRAZE - I have just added a code in my question. Please refer that and advise me – Baskar Vasu Dec 26 '12 at 05:48
  • Baskar, I have just tested this on my local laptop and I have another laptop which runs Ubuntu and I was able to return the ip address of that machine based on the passing the name of the Machine on my network at home I don't have windows 8 but I am wondering if this same thing would work for you – MethodMan Dec 26 '12 at 06:30

0 Answers0