I am trying to build a sample application which will show a proof of concept for synchronizing the time with an RFC 868 compliant time server.
So far, using the Java Socket API, I am able to connect and query the server and do get the response from the server, but it is not in human readable format.
The response I get is: �)6 I think the response is coming in binary format (not sure though). RFC 868 says that Send the time as a 32 bit binary number.
My questions are:
- How do I parse this response?
- Apart from this approach of mine, I’d like to know if there is any other recommended approach which I should take to achieve this.
Thanks in advance.
Check out the source code of TimeTCPClient from Apache Commons Net library:
Use Apache Commons Net Library, check out the API of TimeTCPClient.
Apache Commons Net home page, hope this helps.