[ntp:questions] Question about synchronizing client and server clock
mandala at ics.uci.edu
Mon Jan 5 05:25:31 UTC 2004
I am writing a client server code using WINSOCK 2.0 in which I have to
calculate the exact time required by a piece of message to go from the
client to the server or vice versa.
i.e Suppose I have a client server model in which A is the client and B
is the server.
Let's say A has to send a message M to B by socket communication. I want
the exact time taken by M to go from A to B.
Currently I'm sending the message from A to B and then sending an
acknowledgement from B to A(ack having the same size as original
message) and then calculating the total time T taken for the round
trip(this is easy because I just need 2 timer function calls
within the client). Then I'm assuming that the time taken for A-B is
T/2. This is however not precise because it might take a longer time to
go from A-B rather than B-A.
So is there any way I can calculate the exact one way communication time
(with the precision at microsecond level or better) ?
I think the best way is to use a synchronized clock for the client and
server - Can anyone in this group please tell me how to implement this
or give me pointers to example source code. I am quite new to this
More information about the questions