【问题标题】:How can I ping some website with parameters on Android? Auch as specifuing the packet size and the ping times?如何在 Android 上使用参数 ping 某些网站?比如指定数据包大小和ping次数?
【发布时间】:2013-04-12 08:55:39
【问题描述】:

我发现了一些 Stack Overflow 问题,例如 Ping Application in Android。它像这样使用它:

Process process = Runtime.getRuntime().exec(
            "/system/bin/ping -c 8 " + url);

如何指定数据包大小和 ping 时间?比如我要ping 10次,指定包长度为1472字节。我怎样才能做到这一点?首选示例代码。

当我修改为

Process process = Runtime.getRuntime().exec(
            "/system/bin/ping -c 8 -s 1472" + url);

它不起作用。为什么?

【问题讨论】:

    标签: android ping


    【解决方案1】:

    ping 命令的选项有:

    shell@android:/ $ ping 
    Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
            [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
            [-M mtu discovery hint] [-S sndbuf]
            [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination
    

    【讨论】:

    • 谢谢,但你的意思是我可以在上面修改:Process process = Runtime.getRuntime().exec("/system/bin/ping -c 8 -s 1472" + url); ?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    相关资源
    最近更新 更多