Android的ARP结算时间 [英] Android ARP clearing time

查看:671
本文介绍了Android的ARP结算时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的WiFi直接的应用程序,它使用MAC地址通过我的另一种方法(即作品)转移那里的客户将使用ARP表中查找主机的IP,因为groupownerintent不工作所有Android上。不过,我不断发现我的ARP表中仅持有我的WiFi接入点(互联网接入),以及附加的P2P界面不到5分钟就会消失。

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.

什么是ARP超时Android和有没有办法把它扩大?也许在我的应用程序是不是一个问题,但调试是一个真正的痛苦时,接口down,然后未能通过WiFi直接连接(因为它似乎,如果你做到这一点通过code pretty打破)。

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).

推荐答案

Android是基于Linux内核,并使用相同类型的 ARP超时策略。参赛作品中的缓存超时某处base_reachable_time之间/ 2和3 * base_reachable_time / 2,用base_reachable_time默认为30秒左右。您可以通过在的/ proc / SYS /网/的IPv4 /嘶/ eth0的/通过 PROC 接口更改内核参数更改此设置base_reachable_time ,但手机将需要扎根。你也可以只ping通你想要的检查表,以保持在缓存更新进入前的MAC地址的IP地址。

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.

这篇关于Android的ARP结算时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆