Reference no: EM131211843
Program One - Multithreaded Joke Server and Client
Overview:
In this assignment you will build a pair of multi-threaded servers that accept input from multiple clients, and return appropriate output. In addition to the basic client-server model, you will also implement a secondary administration channel to your servers, and manually maintain the state of all conversations within your distributed application.
Each aspect of the specifications requires you to solve a particular client-server problem while maintaining a conversation within a stateless protocol. The assignment is designed to give you general-purpose exposure to writing code for a client-server environment, and working with threads, neither of which is trivial.
Your finished server is just for fun, but with minor changes it can serve as the basis for a real, viable, client-server application handling thousands of client conversations simultaneously.
Note that we will not make these servers thread-safe which is beyond the scope of this assignment.
InetServer:
Install Java 1.8 if you need to. We will be running your programs under Java 1.8.
You will need several command windows (shells), each running a separate process to run your client/server programs. Command windows are available under Windows by using [Start | run | cmd]. Use [Start] within the original command shell to start other windows. Under Unix (and Apple OSX which runs on top of Unix) use command shells [Terminal Windows] of your choosing.
Refer to the InetServer PDF document, and the lecture, for large hints on how to get this program working. The expectation is that you will TYPE IN THE CODE YOURSELF, and GET IT RUNNING. In my experience, the 30-40 minutes to type in the programs yourself, fix the bugs you have introduced, and figure out how they run, will be paid back many times over.
Remove ALL of my comments from InetServer.java and InetClient.java. Add extensive comments of your own demonstrating that you know how the server works. This is a required part of this pedagogical assignment, demonstrating that you understand the code.
Some sample Java Inet .class files and source code are available to help you get started. (These work fine under Java 1.8). Run the client/server program as follows: Download ALL the .class files into a directory. Issue [> Java InetServer] in one of the windows, and [> Java InetClient] in a separate window for each client that you will be running simultaneously.
Running the InetServer: In one command window issue: [> java InetServer]. In another command window issue: [> java InetClient] Then follow the prompts on the client to look up the IP addresses of domain-named computers. Optionally, you can run the program on two different machines, exactly the same way, but by starting the client with the name or IP address of the server machine as the first argument to the InetClient program.
You may have to speak to your firewall about allowing the client/server TCP/IP connections, depending on how it is configured.
Note: The application code in the server-looking up the IP addresses corresponding to domain names-is not particularly interesting to us and was just some fun network code using existing libraries. The client and server portion of the assignment is what we care about. The assignment would be almost as interesting if we simply sent two numbers from the client to the server and had the server add them together.
Submission files for Inet:
InetServer.java
InetClient.java.
Zip these two java source files together and submit to the InetServer D2L link.
Concatenate your two Inet files together and submit your InetAll file to the InetTII link as .docx, .html, or .txt. NO ZIP FILES HERE.
Run the plagiarism checker against your InetTII link by clicking on the D2L number representing the number of InetTII submissions you have made, and following the links. In this case only, your code will likely appears as being flagged for plagiarism (because all of the code is the same as other submissions), but none of your comments should be flagged for plagiarism.
Execution:
Run your sever with multiple clients active at the same time. Interleave requests from different clients. Capture eight output responses from one client in joke mode, and eight in proverb mode, showing that the jokes and proverbs are returned randomly, but not repeated until all four in each set have been sent back. Annotate this in your output log.
Repeat the process, but this time use your adminstration client to interleave Joke Mode and Proverb Mode, showing that state is correctly maintained across changes between modes.
Put the output from your running sessions in a text log file and ANNOTATE the output-highlighting the randomness of the jokes, the interleaving of modes, etc. Do NOT change any of the output data, but you can add some white space to make it easier to read if you like.
Format the presentation and submission of your work exactly as specified.
Attachment:- java.rar