Summary |
For assignment #1, you will implement a simple UDP-based time synchronization client. You'll test your client by synchronizing against a time server that we have running on one of our lab machines. By running your synchronization client over a 12-hour-long period, you'll be able to calculate three characteristics: the average round-trip time bewteen your client and the server, the average packet loss rate between your client and the server, and the average drift rate of your client's clock relative to our server's clock.
A simple time synchronization protocol |
The basic building block you must first implement is the ability for your client software to communicate with our time synchronization server; we've designed an extremely simple protocol for this. The protocol is based on the notion of an interaction with the server. In a successful interaction, the client sends the server a synchronization request packet, and the server responds with a synchronization response packet.
Request packet
The client's synchronization request packet is a single UDP packet containing two fields, separated by a single ASCII space character:
554 1363805384.267729
Response packet
The server's synchronization response packet is a single UDP packet containing four fields, separated by a single ASCII space character:
554 1363805384.267729 1363805383.511432 1363805383.614323Client-side processing
The client should also record the time at which it receives the server's response packet. With this in hand, the client has four timestamps at the end of a successful server interaction:
RTT = (t2 - t3) + (t0 - t1)Here, Θ is the estimated offset of the server's clock from the client's clock at the midpoint of the interaction. In other words, the client should add Θ to its local clock in order to be in sync with the server's clock.Θ = ((t2 - t3) - (t0 - t1)) / 2
Your time synchronization client |
Your job is to implement a time synchronization client that can speak to our server using the protocol described above. Your client should behave as follows:
What to do |
Do the following:
What to turn in |
Use the course dropbox to turn in your source code and your writeup.