有没有一种方法,使Android设备答案ICMP ping消息给广播地址? [英] Is there a way to make an android device answer to icmp pings addressed to the broadcast address?

查看:137
本文介绍了有没有一种方法,使Android设备答案ICMP ping消息给广播地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式让我的设备应答广播坪(即执行ping 192.178.1.255),同时连接到WiFi网络。

有没有办法,我可以做到这一点?也许一个侦听器将平背或标志的地方设置?

感谢。


解决方案

  

有没有办法,我可以做到这一点?


在短:是的。但它会采取一些很好的努力,将必要的组件。

问题的关键是,你需要监听ICMP网络数据包。这种功能是不是从Java访问,将需要要么JNI code或外部程序。 (据我所知,这还需要一个根深蒂固的设备。)

您将需要一个库或程序,它可以处理网络流量,如 JPCAP (这可能需要一些修改上下工夫Android版)。您还可以安装和运行 的tcpdump 在后台解析它的输出。

I would like to programatically make my device answer to broadcast pings (i.e pinging 192.178.1.255) while connected to a wifi network.

Is there a way i can do that ? Maybe a listener that will ping back, or a flag to set somewhere?

Thanks.

解决方案

Is there a way i can do that ?

In short: Yes. But it will take some good effort to integrate the necessary components.

The key problem is that you need to listen for ICMP network packets. Such functionality is not accessible from Java and would require either JNI code or an external program. (To my knowledge, it also requires a rooted device.)

You will need a library or program that can process network traffic, such as Jpcap (which would require some modification to work on Android). You could also install and run an instance of tcpdump in the background and parse its output.

这篇关于有没有一种方法,使Android设备答案ICMP ping消息给广播地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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