Post by 00_CumPeeWearD12According to the Java FAQ, ICMP ping is not possible.
http://www.ibiblio.org/javafaq/javafaq.html#ping
But how does this Java Applet calculate the Round Trip Time?
http://www.vonage-forum.com/voip-speed-test/
Using TCP, as far as I can see.
Post by 00_CumPeeWearD12I assume RRT = Ping.. right?
No, it's simply the round trip time. You can send data containing
timestamps back and forth over TCP and calculate it that way. Of course
the resulting value could be completely different for TCP than for UDP
or ICMP, but it's a valid ballpark estimate.
BTW, TCP has had its own internal (optional) timestamp mechanism since
1992 (RFC 1323). The meaning of the numbers in that are completely un-
defined and implementation dependent (they only need to be monotonically
increasing). However, if the original sender knows when it sent a given
segment, it knows how long it took the corresponding ACK to return to
it => RTT. I'm not aware of any way to access this low level facility
from Java though, short of using JNI to interface to pcap or such-like.
Post by 00_CumPeeWearD12If so, is there any sample Java code that
implements ICMP over TCP?
This question doesn't make any sense. ICMP and TCP are on the same
layer of the protocol stack. If anything, ICMP can be considered to
reside on a _lower_ layer. What you probably mean is how to do echo and
echo reply type communications over TCP. Simple: Just send timestamps
back and forth, and include the most recently received timestamp from
the other side in the next reply. You probably want to at least disable
the Nagle algorithm for that (TCP_NODELAY, which can be set on any
socket within Java), but the results will still be somewhat arbitrary
for various reasons.
--
Cheers, Tilman
`Boy, life takes a long time to live...' -- Steven Wright