Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measure message transmission speed

Tags:

java

time

I am making a network application and I would like to display the time messages take to travel from sender to receiver.

What ways you believe are fit to implement this feature ?

What I have thought is storing the current time on message and comparing with time on receiver end. Although on java doc it says the current Time given might be different depending on OS.

How should I get the current Time so that it will be same on every OS? (or just OSX and win)

p.s: The application in most cases is about just sending messages and not expecting something back.

like image 368
Giannis Avatar asked Apr 08 '12 14:04

Giannis


1 Answers

Unless both source and destination is synched to the same time-source, system time can differ by several seconds, or even several hours if source and destination is in different timezones and you use local time.

What you could do is measure the time from you send your packet until you get a reply. This is not 100% safe, as two packets can travel two different routes.

like image 70
Some programmer dude Avatar answered Sep 21 '22 02:09

Some programmer dude