List all network computer by thier IP addresses?

I cannot locate any code on the Internet that lists all network computer by thier IP addresses.

Help
LVL 1
kvnsdrAsked:
Who is Participating?
 
HeidarVConnect With a Mentor Commented:
hi
you can use Ping like bellow and ping all computers in the range of yours and look for replies.

System.Net.NetworkInformation.Ping ping = new Ping();
for (int i = 0; i < 255; i++)
{
      PingReply pr = ping.Send(new IPAddress(new byte[] { 192, 168, 1, i }));
      if (pr.Status == IPStatus.Success)
            list1.Add(pr.Address.ToString());
}
0
 
kvnsdrAuthor Commented:
Also, using .NET namespaces without having to import Windows dlls.
0
 
kjetilroeConnect With a Mentor Commented:
Hi,

Not all computers answers to ping. If you are sitting in a windows workgroup, or domain, you can list all computers in that nettwork using this example:

http://www.codeproject.com/cs/internet/peerlister.asp
0
 
kvnsdrAuthor Commented:
I'll wait for some other possible solutions too...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.