Get information about the computers of a network .
-
2010年3月29日 17:28How to get computer names and IP(s) of a network (My Network) .
全部回复
-
2010年3月29日 17:40
C# - How to detect all IP addresses from a LAN ?
http://www.dreamincode.net/code/snippet1121.htm
Thanks,
A.m.a.L
Dot Net Goodies
Don't hate the hacker, hate the code - 已标记为答案 Abd EL Rahman.tech 2010年3月30日 18:32
-
2010年3月29日 18:26
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var computers = GetComputersOnNetwork();
}
static List<string> GetComputersOnNetwork()
{
List<string> list = new List<string>();
using (DirectoryEntry root = new DirectoryEntry("WinNT:"))
{
foreach (DirectoryEntry computers in root.Children)
{
foreach (DirectoryEntry computer in computers.Children)
{
if ((computer.Name != "Schema"))
{
list.Add(computer.Name);
}
}
}
}
return list;
}
}
}
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com- 已标记为答案 Abd EL Rahman.tech 2010年3月30日 18:32
-
2010年3月29日 18:31
// Get the hostname string myHost = System.Net.Dns.GetHostName(); System.Net.IPHostEntry myIPs = System.Net.Dns.GetHostByName(myHost); // Loop through all IP addresses and display each foreach(System.Net.IPAddress myIP in myIPs.AddressList) { MessageBox.Show(myIP.ToString()); }
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.com- 已标记为答案 Abd EL Rahman.tech 2010年3月30日 18:32
-
2010年3月29日 19:27
Also an implementation by Sacha Baeber at http://www.codeproject.com/KB/IP/ListNetworkComputers.aspx (Retreiving a list of network computer names using C# - CodeProject)
My Blog - MSDN Complement By Providing Visual C# Walkthroughs and Sample Codes - Founded In February 24, 2010- 已标记为答案 Abd EL Rahman.tech 2010年3月30日 18:31
-
2010年3月30日 18:36
Thanks you all ,,
-------
-
2012年8月20日 15:54Hi try this source code is also available here ....http://codingresolved.com/discussion/71/how-to-get-list-of-network-computers-in-c

