Android ARP clearing time

徘徊边缘 提交于 2019-12-08 02:23:23

问题


I am writing an app for WiFi direct and it uses the mac address I transfer via another method (that works) where the client will use the ARP table to find the IP of the host, since the groupownerintent doesn't work at all on android. However I keep finding my arp table only holds my WiFi access point (for internet access), and the additional p2p interface disappears in less than 5 minutes.

What is the ARP timeout for Android, and is there a way to extend it? Perhaps in my app it is not an issue but debugging is a real pain when the interface goes down, and then fails to connect via WiFi direct (since it seems pretty broken if you do it through code).


回答1:


Android is based on the Linux kernel and uses the same sort of ARP timeout policy. Entries in the cache timeout somewhere between base_reachable_time/2 and 3*base_reachable_time/2, with base_reachable_time defaulting to 30 seconds or so. You may be able to change this setting by changing the kernel parameters via the proc interface at /proc/sys/net/ipv4/neigh/eth0/base_reachable_time, but the phone will need to be rooted. You could also just ping the IP you want the MAC of before checking the table to keep the entry in the cache updated.



来源:https://stackoverflow.com/questions/14532654/android-arp-clearing-time

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