Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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.4K
Edited 19-Dec-11 22:51pm
thatraja241.6K
v3
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 at 4-Mar-14 10:22am
   
Did you see that this question is over 2 years old??
KUMAR619 at 3-Apr-14 6:02am
   
What to give for ListHostNames
in the above method
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 at 11-Nov-12 16:26pm
   
Did you notice that this question is from December 2011?

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

  Print Answers RSS
0 OriginalGriff 6,631
1 Sergey Alexandrovich Kryukov 6,345
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140921.1 | Last Updated 4 Mar 2014
Copyright © CodeProject, 1999-2014
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