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 23:45pm
devausha1.4K
Edited 19-Dec-11 23:51pm
thatraja242.7K
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 at 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 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

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

  Print Answers RSS
0 DamithSL 495
1 Maciej Los 258
2 OriginalGriff 229
3 BillWoodruff 170
4 Zoltán Zörgő 165
0 OriginalGriff 7,934
1 DamithSL 6,084
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,174
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.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