Reputation: 178
I foud some Stack Overflow questions such as Ping Application in Android. It uses it like this:
Process process = Runtime.getRuntime().exec(
"/system/bin/ping -c 8 " + url);
How can I specify the packet size and the ping times? For example, I want to ping 10 times, and specify the package length is 1472 bytes. How can I do that? Sample code is preferred.
When I modify to
Process process = Runtime.getRuntime().exec(
"/system/bin/ping -c 8 -s 1472" + url);
it does not work. Why?
Upvotes: 0
Views: 3525
Reputation: 6409
The options for the ping
command are:
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
Upvotes: 2