1

This seems like it should be a simple solution to find, but I'm not having any luck. I want to write a simple ping/traceroute/dns troubleshooting app, but am simply not finding any documentation or examples on sending ICMP ECHO packets with set TTLs and interpreting their responses. I realize that Java likes to keep you away from "low-level" networking, but ICMP is a basic, major part of networking. Frankly, I'm shocked at the apparent difficulty. Am I making this more complicated than need be, or is there literally no good way to go about this? If the latter, in what "bad" way do you most often work around this shortcoming?

4

1 に答える 1

1

私はこれを必要以上に複雑にしていますか、それとも文字通りこれを行う良い方法はありませんか?

これを実行する純粋な Java の方法はありません。Java は、.NET での限定された使用を超えて ICMP をサポートしたisReachable()ことはありません。このような ICMP の使用が Android に存在するかどうかさえ確認できません。

ただし、NDK を使用して、ICMP を実装する C ライブラリにリンクすることもできます。

于 2010-09-26T23:37:07.003 に答える