Using Java to Query a Server for the Time

前端 未结 3 964
长情又很酷
长情又很酷 2021-01-20 19:24

I want to ask a server, whose IP I know, to send the date and time to a client.

How can I implement this in Java?

3条回答
  •  悲哀的现实
    2021-01-20 19:50

    To start with you'll need to clarify (for yourself as much as anything):

    • What kind of server are you going to ask?
    • How are you going to ask it?
    • What kind of IP are you expecting the server to know about?
    • How would the server know about that IP?
    • What does it look like for an IP to 'respond'?
    • How would the server know that an IP 'responded'?
    • How would the server store the knowledge of the IP responding?

    Once you've answered those questions, (and more I'm sure), it'll be easier to answer how to do it in java.

    Update

    The updated question is much clearer.. nice.

提交回复
热议问题