【问题标题】:Ping TTL exceeded output decipherPing TTL 超出输出解密
【发布时间】:2017-08-06 16:09:34
【问题描述】:

我正在为 Android 创建一个 traceroute 服务,由于 Android 没有内置的 traceroute 命令,我正在使用 adb shell ping 迭代地实现一个增加 TTL 值的服务。

这是请求/响应的示例:

    //Sample shellCommand: /system/bin/ping -c 1 -t 8
    Runtime.getRuntime().exec(shellCommand + DESTINATION_URL);

PING opf-www.google.com (xxx.xxx.xxx.xxx) 56(84) 字节数据。
--- opf-www.google.com ping 统计 ---
1个包发送,0个接收,100%丢包,时间0ms

  1. 我想知道如何破译“56(84) 字节的数据”。这里的 56 和 84 是什么?

  2. 我想分析traceroute使用的数据量,我正在使用TrafficStats类来做:

    int UID = myUid();
    long mStartRX = TrafficStats.getUidRxBytes(UID);
    long mStartTX = TrafficStats.getUidTxBytes(UID);
    new TracerouteTask().run();
    long rxBytes = TrafficStats.getUidRxBytes(UID)- mStartRX;
    long txBytes = TrafficStats.getUidTxBytes(UID)- mStartTX;
    

使用它,我总是收到 rxBytes 的 0 值,即没有。收到的字节数。为什么会这样?我们收到一个超过 ICMP TTL 的数据包。

【问题讨论】:

    标签: android networking ping traceroute


    【解决方案1】:

    我找到了答案,更新以防将来对某人有所帮助:)

    56(84)in 表示 ICMP 消息中包含的“虚拟数据”的有效载荷为 56 字节,当与告诉消息去向的 28 字节 ICMP 头数据结合时,总数据包大小为(84) 个字节。

    【讨论】:

      猜你喜欢
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多