Discussion:
Ping (ICMP) in Java over TCP?
(too old to reply)
00_CumPeeWearD12
2005-02-22 01:16:55 UTC
Permalink
According 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/

I assume RRT = Ping.. right? If so, is there any sample Java code that
implements ICMP over TCP?
Wiseguy
2005-02-22 05:23:59 UTC
Permalink
Post by 00_CumPeeWearD12
According 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/
I assume RRT = Ping.. right? If so, is there any sample Java code that
implements ICMP over TCP?
No...Unless the java API has been updated, you cannot access anything in the
stack at a lower level than UDP from within java.

Without looking at the code I believe it should be possible to use
differentials (maybe based on the NTP service) to determine RTT. NTP
accurately determines transmission times without resorting to ICMP. It runs
under UDP or TCP and would be possible to implement under Java. This
process is more math than computers skills though.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Tilman Bohn
2005-02-22 06:31:28 UTC
Permalink
In message <421ac1ef$***@127.0.0.1>,
Wiseguy wrote on 21 Feb 2005 23:23:59 -0600:

[...]
Post by Wiseguy
Without looking at the code I believe it should be possible to use
differentials (maybe based on the NTP service) to determine RTT. NTP
accurately determines transmission times without resorting to ICMP.
[...]

Actually, the problem NTP tries to solve is a much harder one: clock
synchronization. To accurately measure the complete _round trip_ time,
no synchronization is needed. All you need to do is send a timestamp and
have the other side echo it to you. When you receive it, you know how
long it took. That's all there is to it. The timestamp doesn't even have
to mean anything, as long as you remember when you sent it.
--
Cheers, Tilman

`Boy, life takes a long time to live...' -- Steven Wright
Tilman Bohn
2005-02-22 06:24:56 UTC
Permalink
Post by 00_CumPeeWearD12
According 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_CumPeeWearD12
I 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_CumPeeWearD12
If 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
Loading...