In this assignment, you will learn how to implement a simple Knock-Knock client and a server using the so-called Knock-Knock protocol. In this scheme, a client merely tries to connect to a server and sends various queries to it. The server, on the other hand, sends back messages to the client what it considers to be quite funny. The idea ensues from the fact that a person knocks at the door of a funny, but nice, person. And the latter, instead of opening the door, replies with messages that appear either funny or annoying to the guest, depending on the state of the mind he is in. As suggested earlier, this scheme is implemented using a Knock-Knock protocol.
What is in a protocol by the way? In communication networks, a protocol is defined as a set of rules through which multiple machines communicate with each other. What could be in a Knock-Knock protocol? In the case of the KnockKnock protocol, there are no such explicit rules for communication except for the fact that the communication happens through sockets. The only rule the KnockKnock protocol follows is that it has to react with a funny response, no matter what.
A surprising fact about the knock-knock protocol is that it built upon the plain old echo server. You will be amazed to learn that how a seemingly application like an echo server can be changed into a bit more advanced application like the Knock-Knock server with a mundane sleight of your hands. But acquiring even this level of sleight of hands requires some practice. And in the programming world the mantra is that there is no shortcut for hands-on work. So please consider getting your hands dirty with some code if you really want to become good at computer programming.
The source code is written in Java. Please consider completing the following assignment. Seemingly, it may appear trivial to you to work on something apparently as bizarre as the Knock-Knock protocol. However, as you will progress through your academic years and look back at the Knock-Knock protocol in the hindsight, you will realize that it was a harbinger for many useful concepts not only in communication networks but also for ideas in various other feats. And let me tell you that it is not as bizarre a harbinger as you may think. Please take the following steps to complete this assignment.
- Fork the source code of the program for Knock-Knock Protocol from GitHub.
- Clone it now to your local machine on which you are going to work.
- Understand the code.
- Rewrite the code in your own words.
- Push the changes back to your remote repository.
- Send me a pull request too.
Contribute to adilraja/KnockKnock-Oracle development by creating an account on GitHub.
This networking Java tutorial describes networking capabilities of the Java platform, working with URLs, sockets, datagrams, and cookies
If you found an error, highlight it and press Shift + Enter or click here to inform us.