Re: Ping (ICMP) in Java over TCP?
From: Tilman Bohn (myfirstname_at_gmx.net)
Date: 02/22/05
- Next message: Tilman Bohn: "Re: Ping (ICMP) in Java over TCP?"
- Previous message: Tilman Bohn: "Re: Block in synchronized mathod"
- Maybe in reply to: Wiseguy: "Re: Ping (ICMP) in Java over TCP?"
- Next in thread: Tilman Bohn: "Re: Ping (ICMP) in Java over TCP?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 22 Feb 2005 06:24:56 GMT
In message <HaidnWfD6pqXFYffRVn-gg@rogers.com>,
00_CumPeeWearD12 wrote on Mon, 21 Feb 2005 20:16:55 -0500:
> 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.
> 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.
> 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
- Next message: Tilman Bohn: "Re: Ping (ICMP) in Java over TCP?"
- Previous message: Tilman Bohn: "Re: Block in synchronized mathod"
- Maybe in reply to: Wiseguy: "Re: Ping (ICMP) in Java over TCP?"
- Next in thread: Tilman Bohn: "Re: Ping (ICMP) in Java over TCP?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|