This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Ping and RTT

 
subham soni
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to write the TCP socket program client-server architecture for ping command and also determine the Round Trip Time of the Host connected too.. I can ping the host by isReachable() method but what to do about RTT? please help
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
subham soni wrote:I need to write the TCP socket program client-server architecture for ping command and also determine the Round Trip Time of the Host connected too.. I can ping the host by isReachable() method but what to do about RTT? please help



I don't think that there is a way to calculate RTT from one host, to any random host. Pinging another host works because there is a standard service -- and even then, it isn't guaranteed to work reliably. If you want to calculate RTT, you will need to install agents on the remote host (either something you write, or just install, if you find some sort of service).


Regardless, it isn't had to do (if you want to write it yourself). To calculate RTT, you need a pinger and ponger. The ponger is just a reflector (running on the remote host) -- that just bounces the same packet back. And as for the pinger, it just takes a time stamp, sends a packet to the ponger, gets the response, takes another time stamp; and if the returned packet is confirmed to be the same packet, the RTT is the difference between the two timestamps.


Henry
 
subham soni
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok to be frank I need to write java program(sockets) to implement the ping command
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
subham soni wrote:Ok to be frank I need to write java program(sockets) to implement the ping command


The nice thing here is that you don't need to worry about writing the ping program. Once you write the RTT program(s), ping is done. If you can get an RTT, then it is there. Of course, you have to modify the RTT program with a timeout, which you have to do for error handling anyway.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic