CSC 102

Laboratory: Ping

 

DOS Command Window

Under Window XP, get up a (black) DOS window via Start -> All Programs -> Accessories -> Command prompt. (If for some reason you can't find it there, you can also select Start -> Run and type cmd in the box.) This is the DOS core of Windows, which was modeled on Unix, and we can run several Unix commands here, including ping.

Incidentally, on a Mac running OS X, which is based on Unix as well, one can run ping in a terminal window (except the DOS -n option becomes -c in Unix/OSX).

Ping exploration

Note: Ping is discussed in the second edition of the textbook on pp. 48-49. You do not need to read those pages before completing this lab exercise.

Issue the command

> ping -n 5 sophia.smith.edu
This will send ten tiny packets to sophia and back, recording the time in milliseconds (ms=thousandths of a second). [The "-n 5" stands for "count 5," i.e., repeat it ten times.] It should then print summary statistics: the best (min), the worst (max), and the average (avg) round-trip time in ms (milliseconds -- thousandths of a second).

Try a number of other host machines around the world (but no need to try them all!); the information in parentheses is not part of the host name. Note any "packet loss." (Warning: There is no guarantee that all of these will respond. Many host names change, and increasingly hosts are denying pings.) or any others you know about (you can guess College and University names). If you are wondering, yes, you can copy and paste from this text.

Timing Experiment

Select one responding site (preferably not too close) for a timing experiment. Ping it, record the minimum roundtrip time, and compare against how long it would take the speed of light to reach there. Estimate the distance between here and where you are pinging. (The estimate does not have to be very precise -- see below.)

Light (and all electromagnetic signals) travels at 186,000 miles per second (in a vacuum). So if you divide the round-trip distance (twice the one-way distance) by 186000, you will get the time in seconds. Multiplying by 1,000 gives the time in milliseconds. (Dividing by 186000 and then multiplying by 1000 is the same as dividing by 186, in case you are interested in a shortcut.) Compare the minimum time found by ping to the theoretical minimum time. The theoretical min should be smaller (otherwise your packets went faster than light!).

Example: You ping Berkeley, a 6,000 mile roundtrip (very roughly). The fastest it can be done in this universe is 6,000 mi / 186,000 mi/sec = 0.032 sec = 32 ms (or 6,000 mi / 186 mi/ms = 32 ms).

Tips: