Get Host-IPs of wireless network

南笙酒味 提交于 2019-12-10 11:13:22

问题


Possible Duplicate:
Get all IP-Hosts in Lan from mobile device

How can I get programmaticaly all the hosts in a wireless network?

I know the wlan I'm working in and I am connected to it. Now I want to show a list of the hosts (or at least their IP-Addresses).

How can I accomplish this, and are there special points if I work on windows mobile with compact framework and want to do that?


回答1:


There are lots of ways. For example:

  • ARP:

http://msdn.microsoft.com/en-us/library/aa366358%28VS.85%29.aspx

  • WMI:

http://weblogs.sqlteam.com/mladenp/archive/2010/11/04/find-only-physical-network-adapters-with-wmi-win32_networkadapter-class.aspx

  • ICMP:

http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/8a528983-915b-4d94-836e-804b03e6261f

Etc




回答2:


The only way to get all the hosts in a network is to use network scanning.

You could ping all the valid IPs of the network the device is in.

Or you could check every valid IP of the network on the local DNS service for a name and list the different names you found with corresponding IP.

An IP would be valid if the Bits corresponding to the subnet mask are the same to the IP the device has.




回答3:


The easy answer is: You can't. Going more in detail: you can't unless you have a protocol to discover your hosts, for example, NetBIOS. You can call NetBEUI (NetBios User Interface) through pInvoke. Look at this previous post:

Netbios support in .NET?

Another approach you can use is to ping all the IP addresses in your WLAN range and wait for responses. This is not a good approach as it is very resource consuming.



来源:https://stackoverflow.com/questions/13233808/get-all-ip-hosts-in-lan-from-mobile-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!