tags:

views:

58

answers:

3

I have a simple UDP client server written in C++ on Ubuntu 9.10 where the client sends a set to the server. How can I check how much time s it taking to sent it. I need to find the time from start of transfer to end.

Supposing my server and client are on the same machine then can I somehow save the system time and find the difference or something ?

A: 

If you are asking how long it takes for the packet to arrive at the server, there is no built in way to get that information.

If the server sends a reply, you can time how long it takes between sending the request and getting the reply and divide by 2 (not accurate, but a decent estimate).

R Samuel Klatchko
+1  A: 

Setup the server to immediately send a reply to the client. At the client measure the round-trip time. The time you are looking for is half the round-trip time.

edgar.holleis
A: 

You could put the time you sent the packet at in the beginning in every packet. In other words, you could create a custom header for all of your packets that would include this information.

kitchen