Click here to Skip to main content
15,029,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I actually tried with the following code, which gave me a result of the local machine Ip address, name and the server Ip address


XML
var hostNamesList = NetworkInformation.GetHostNames();
                    HostName serverHost = new HostName("cptdomain.ctl.local");
                    StreamSocket clientSocket = new Windows.Networking.Sockets.StreamSocket();

                    // Try to connect to the remote host
                    await clientSocket.ConnectAsync(serverHost, "http");


                    foreach (var entry in hostNamesList)
                    {
                        if (entry.Type == HostNameType.DomainName)
                        {
                 hostName.Text = "Machine Name : " + entry.DisplayName;
                 IPAddress.Text = "Machine IP : " + clientSocket.Information.LocalAddress.DisplayName;
                 ServerAddress.Text = "Server IP : " + clientSocket.Information.RemoteAddress.DisplayName;

                            }
                    }
                }


But actually my requirement is, how to get the list of IP addresses and name of the computers that are connected to the server in LAN for Windows Store Apps.

Please guide me in this to get the proper solution for running my store app.

Note: Here I was working with windows8 store apps with WinRT
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900