pyran1208
pyran1208

Reputation: 115

android tcp connection - measure delay / do benchmark

do you guys know a possibility to measure the latency of my tcp application? My app is implemented as client and sends data to a java server. I wanna know long it takes from the moment i call the write-method until it arrives at the server i.e. Im trying to send every 50msec a message but i dont know how to prove if it is working intime.

thanks in advance!

Upvotes: 0

Views: 507

Answers (1)

Gabe Sechan
Gabe Sechan

Reputation: 93728

That's actually a difficult problem due to clock synchronization. The two devices won't have the exact same time. So if you send a timestamp from your device to the server, its meaningless. If you're measuring large amounts of time it doesn't matter much, but for ms latency it would. One way around this is to measure the round trip time- to send data to the server, then have the server send a response. Measure the time it takes from when you send the request to when you receive the response, and that's the round trip time. Divide by 2 to get the one way latency.

Upvotes: 2

Related Questions