-
Notifications
You must be signed in to change notification settings - Fork 2
Pong User Manual
First of all, we are not responsible for what you do with this program. Please play nice and don't break stuff unless you're supposed to.
We have run the program on both Mac and Linux operating systems (OSX Mountain Lion, Ubuntu 12.04). If you notice, our code has preprocessor for Windows but unfortunately, we haven't finished coding the Windows side as of yet.
Open your terminal and compile the code with the make file.
make
Otherwise, use the following command:
g++ -std=c++0x pong.cpp -fopenmp -o pong.out
The program needs root permission because it creates a raw socket. The easiest way to run it is with sudo. Our code drops root permissions as soon as it has created the socket.
Each option has both a short and long flag option, for your convenience (they work the same... just depends on which you prefer to use). If you don't type in any flags, you'll get some basic usage information.
sudo ./pong.out
Host to ping
To send ICMP Echo Requests to a host, type the IP address or domain name of this host after the pong call.
sudo ./pong.out 127.0.0.1
sudo ./pong.out google.com
Number of pings
By default, the application sends 5 pings. To send a different number, use the -n or --pings-to-send flag.
sudo ./pong.out google.com -n 10
sudo ./pong.out google.com --pings-to-send 10
Delay time between requests
By default, the application waits 1 second. Change the wait time (in milliseconds) between sent ICMP Echo Replies by using -q or --request-time. And remember, be nice and don't spam people.
sudo ./pong.out google.com -n 10 -q 500
sudo ./pong.out google.com -n 10 --request-time 500
If you'd like to add a bit of randomness to your ping experience, you can choose to send pings with a random delay between requests. To do this, use the -r or --random-size-avgstd flag to input a mean and standard deviation in milliseconds. This way, your values are random but based on a normal distribution so they will fall "around" your mean.
sudo ./pong.out google.com -t 100 5
sudo ./pong.out google.com --random-time-avgstd 100 5
Set packet size
Our application allows you to set either the ICMP Payload size, or the size of the whole datagram/packet. These flags are mutually exclusive because setting one determines the other. To set the ICMP Payload size, use the -p or --payload-size followed by the size in bytes. Currently, it must be 8 bytes or larger.
sudo ./pong.out google.com -p 16
sudo ./pong.out google.com --payload-size 16
To set the size of the entire packet, use the -d or --datagram-size flag followed by the number in bytes. Currently, it must be 50 bytes or larger.
sudo ./pong.out google.com -d 50
sudo ./pong.out google.com --datagram-size 50
Otherwise, you can set the size of the entire packet to be random. To do this, use the -r --random-size-avgstd followed by the average and standard deviation of bytes.
sudo ./pong.out google.com -r 150 40
sudo ./pong.out google.com --random-size-avgstd 150 40
Excluding pings
To exclude pings from the final summary, use -e or --exclude followed by the number of pings. This is useful because sometimes the first packet takes longer than the others because of route path setup. Usually you won't want to exclude more than the first 1 or 2 pings.
sudo ./pong.out google.com -n 10 -e 2
sudo ./pong.out google.com -n 10 --exclude 1
Change delay to time between receiving a reply and sending a request
Sequential mode! If you'd like to send a ping, then wait to receive a request, then delay before sending another ping, use -b/--reply-request-time followed by a number for the delay in milliseconds.
sudo ./pong.out google.com -b 1000
sudo ./pong.out google.com --reply-request-time 1000
Timeout
If you would like to manually set the timeout value for listening (via the select() function in listenICMP), use the -z or --timeout flag. The value will be interpreted in seconds.
sudo ./pong.out google.com -z 2
sudo ./pong.out google.com --timeout 2
CSV Output
If you'd rather have the output information in a CSV file than on the terminal, you can set the -c or --csv flag to have an output file created. By default, the filename is output.csv. To manually set the filename, add a name after the -c or --csv flag (spaces not allowed). To let you know the program is still running, dots will be printed out to represent ICMP Echo Replies being received.
sudo ./pong.out google.com -c
sudo ./pong.out google.com --csv