none
[Question] How to get all ip in LAN network ? RRS feed

  • Question

  • Hi everyone,

    I'm trying to find every computer in my LAN network.

    I've found this tutorial : 
    http://www.codeproject.com/Articles/16113/Retreiving-a-list-of-network-computer-names-using

    But this application only lists the name of computers. I want to retrieve IP Address too, 

    Can anyone help me please ? 
    Thank you,

    Sunday, November 29, 2015 5:08 PM

Answers

All replies

  • Hi Linh Nguyen Duy,

    According to this case, I write a sample about this case, maybe you can refer:

    Code below:

     private void button1_Click(object sender, EventArgs e)
            {
                Process netUtility = new Process();
                netUtility.StartInfo.FileName = "net.exe";
                netUtility.StartInfo.CreateNoWindow = true;
                netUtility.StartInfo.Arguments = "view";
                netUtility.StartInfo.RedirectStandardOutput = true;
                netUtility.StartInfo.UseShellExecute = false;
                netUtility.StartInfo.RedirectStandardError = true;
                netUtility.Start();
    
                StreamReader streamReader = new StreamReader
                (netUtility.StandardOutput.BaseStream, netUtility.StandardOutput.CurrentEncoding);
    
                string line = "";
                while ((line = streamReader.ReadLine()) != null)
                {
                    if (line.StartsWith("\\"))
                    {
                        string pcname = line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper();
                        string myIP = Convert.ToString(System.Net.Dns.GetHostEntry(line.Substring(2).Substring(0,line.Substring(2).IndexOf(" ")).ToUpper()).AddressList[0].ToString());
                        string fullname = "PC Name :" + pcname + "IP Address :" + myIP;
                        listBox1.Items.Add(fullname);
                    }
                }
                streamReader.Close();
                netUtility.WaitForExit(1000);
            }

    Best Regards,

    Grady


    Monday, November 30, 2015 2:45 AM
    Moderator
  • Hi Linh,

    For this case, you might be use third party software tool to retrieve IP address in your Local Area Network,

    Try to install this tool and scan, even you will be getting more information from this tool,

    http://www.advanced-ip-scanner.com/index1.php?utm_expid=62919999-23.0wJwYdiTSnm24mrdpU_1Fg.1

    I hope that will be helpful to you.

    Regards,

    Arun


    Monday, November 30, 2015 5:31 AM
  • http://www.codeproject.com/Tips/358946/Retrieving-IP-and-MAC-addresses-for-a-LAN

    there is a sample


    DON'T TRY SO HARD,THE BEST THINGS COME WHEN YOU LEAST EXPECT THEM TO.

    Monday, November 30, 2015 12:22 PM
  • Hi Linh,

    You could try by doing a ICMP ping within your local network in an incremental way, and collect the list of replies. Hope this helps you.

    Thanks,

    Sabah Shariq

    Monday, November 30, 2015 1:46 PM