c# - Get IPAddresses on a local Network using `Directory Entry` -
i have develop desktop app shall allow me file sharing on local network.for this, able listview
of devices hostname when comes know ip addresses , mac went see system.net
and several other msdn forums (where available metro apps).
how can ip addresses & mac address of devices on local network?
i using directoryentry
user names , displayed in listview
.
lstlocal.items.clear(); lstlocal.view = view.details; lstlocal.fullrowselect = true; directoryentry root = new directoryentry("winnt:"); foreach (directoryentry computers in root.children) { foreach (directoryentry computer in computers.children) { if (computer.name != "schema") { listviewitem item = new listviewitem(computer.name); // item.subitems.add(computer.name); //messagebox.show(computer.name); lstlocal.items.add(item); } } }
update: used
var hostname = dns.gethostname(); var ipadd = dns.gethostaddresses(hostname);
but address in ipv6 returned.i need in ipv4.
if have host names, done.
you can
- use dns resolve host names ip addresses and
- use arp resolve ip addresses mac addresses.
Comments
Post a Comment