How to get an IP address from Mac address programmatically on Android?

时光毁灭记忆、已成空白 提交于 2019-12-21 12:23:19

问题


Programmatically, I got Mac addresses of other Wifi enabled devices from my device on the same network. Same I need to apply here. Is there any apps or any other possibilities to get an IP addresses of each wifi enabled devices on the network by using those Mac addresses on Android?


回答1:


If you're looking for an android app, you could try Network Discovery which work very well and can list all the devices on your local network with the corresponding IP and address.

If you're looking for code instead, well the application is available on github and does (amongst other things ) basically the same thing than explained by Yahel : it reads /proc/net/arp .

Note : I'm NOT the author of this application.




回答2:


This person does the exact opposite so it should work for you.

The trick is to read the ARP cache table from the device.

http://www.flattermann.net/2011/02/android-howto-find-the-hardware-mac-address-of-a-remote-host/



来源:https://stackoverflow.com/questions/12090387/how-to-get-an-ip-address-from-mac-address-programmatically-on-android

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