3

I want to check my udp server client application. One of the features that I wanted to check is the time delay between data sent by the server and received by the client and vice versa. I figured out a way of sending a message from the server to the client and note the time. The client when receives this message sends the same message back to the server. The server gets this echoed message back and again notes the time. The difference between the time at which the message was sent and at which the echoed message is received back tells me the delay between data sent by the server and received by the client.

Is this approach correct? Because I also foresee a lot of other delays involved using this approach. What could be a possible way to calculate more accurate delays?

Waiting for help.

Ayse
  • 2,676
  • 10
  • 36
  • 61
  • It's the standard way of doing this, and the way that the `ping` command works (but it uses [ICMP](http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol) instead of UDP). However, unless you're on a local network there may be unexpected delays in the route, and the route of the "ping" package may even be different than the route of the reply package. For better accuracy you may want to use several packets and use the average delay. – Some programmer dude Jul 12 '13 at 06:53

2 Answers2

3

Yes this is the most traditional way of doing ,you can do this.

pradipta
  • 1,718
  • 2
  • 13
  • 24
1

You can see on sniffer, using relative time taken between sender's udp packet and receiver's udp packet. For the need of more accurate results, you have to go deep into the window's stack where it checks for udp packet received or not. And for calculation of timer's you can use a real time clock which gives upto microsecond delay. Also you are using udp which has high priority of packet getting lost, unlike tcp which is much reliable. What stack are you using? LwIP ?

Ishmeet
  • 1,540
  • 4
  • 17
  • 34
  • +1 for your help but I'm new to this and I don't know much details like stack etc. – Ayse Jul 12 '13 at 06:45
  • 1
    If you are very new then you should go for the basics of Network TCPIP Suite, OSI layer--> https://en.wikipedia.org/wiki/Internet_protocol_suite But since you are working on sockets, then you must be having more than average knowledge of how protocols work like tcp, udp, icmp, arp, dhcp, http, ftp, telnet etc. Best way I recommend would be to read rfc's, that is the best. – Ishmeet Jul 12 '13 at 06:47
  • I'll surely have a look at it in detail. Thanks a lot :) – Ayse Jul 12 '13 at 07:03