简体   繁体   English

Android 设备在一段时间后停止回复 ping

[英]Android device stops replying to ping after some time

I'm developing a kiosk mode application on Android 4.4我正在 Android 4.4 上开发自助服务终端模式应用程序

My device has a 3G SIM card with static (fixed) public IP.我的设备有一个带有静态(固定)公共 IP 的 3G SIM 卡。 Therefore I can ping my Android device from the Internet.因此,我可以从 Internet ping 我的 Android 设备。

After some days (or hours sometimes) I cannot ping the device anymore.几天(或有时几小时)后,我无法再 ping 设备了。 Why does the device stops listening on the network interface?为什么设备停止侦听网络接口? The device is still powered of course.当然,该设备仍然通电。 If I switch the device to plane mode and then disable plane mode it works back again but I don't won't to activate plane mode, I want the device to be listening 24/7.如果我将设备切换到平面模式,然后禁用平面模式,它会再次工作,但我不会激活平面模式,我希望设备全天候 24/7 收听。

I can't develop a server service because of these disconnections.由于这些断开连接,我无法开发服务器服务。 anyway I can debug?反正我可以调试?

It is indeed rare to have a static IP on a mobile wireless data network.在移动无线数据网络上拥有静态 IP 确实很少见。

Just a theory: it may be possible there is some form of optimiser system on the cell network, that does not account for static ip's, that drops connections if it has not heard from the device for X period of time.只是一个理论:蜂窝网络上可能存在某种形式的优化器系统,它不考虑静态 ip,如果 X 时间段内没有收到设备的消息,则会断开连接。

Thus, you could try adding a small piece of code that pings from your phone or performs a simple http-get every hour.因此,您可以尝试添加一小段代码,从您的手机 ping 或每小时执行一次简单的 http-get。 If that does stop the dropouts, then you could progressively widen that time window until you find the threshold.如果这确实阻止了辍学,那么您可以逐渐扩大该时间窗口,直到找到阈值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM