Click here to Skip to main content
12,349,363 members (28,173 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
how to get all IP addresses and computernames from Local LAN.

I am waiting for your reply

Please help me thank you

Old Question title : Balakrishnan Dhinakaran I need your help
Posted 19-Dec-11 22:45pm
devausha1.5K
Edited 19-Dec-11 22:51pm
thatraja248.1K
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

string myHost = System.Net.Dns.GetHostName();
 
                 System.Net.IPHostEntry myIPs = System.Net.Dns.GetHostEntry(myHost);
 
                 // Loop through all IP addresses and display each 
 
                 foreach (System.Net.IPAddress myIP in myIPs.AddressList)
                 {
listBox2.Items.Add (myIP.ToString());

[edit]code block added[/edit]
  Permalink  
v2
Comments
Nelek 11-Nov-12 16:26pm
   
Did you notice that this question is from December 2011?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

private List<string> GetIpAddressFromHostName(List<string> ListHostNames)
        {
            List<string> ListIpAddress = new List<string>();
 
            foreach (var a in ListHostNames)
            {
                IPAddress[] ips;
 
                try
                {
                    ips = Dns.GetHostAddresses(a);
 
                    foreach (IPAddress ip1 in ips)
                    {
                        if (ip1.ToString().StartsWith("192.168."))
                        {
                            ListIpAddress.Add(ip1.ToString());
                        }
                    }
                }
                catch
                { 
                }
            }
            return ListIpAddress;
        }
  Permalink  
v2
Comments
Dave Kreskowiak 4-Mar-14 10:22am
   
Did you see that this question is over 2 years old??
KUMAR619 3-Apr-14 6:02am
   
What to give for ListHostNames
in the above method

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 4 Mar 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100