” Assignment #3 Part A
Due 5:00PM November 11 (Monday) 2019
How to turn in Assignment #3 Part A: Save the Java source code for the server in a file namedassign3Server.java .Log into Canvas. In the Canvas site for this course, clickAssignmentsand then click the linkassign3aand upload the fileassign3Server.java. The file must be submitted by uploading the file in Canvas.
Be sure to include your full name as a comment at the beginning of the source file.
This assignment is essentially an exercise on wrinting a server that guesses a number in 1..1000 that a client chooses. The server must be able to serve multiple clients simultaneously.
Overall, a client is to choose a number in the range 1..1000 without telling the server the chosen number. Then the server and the client will engage in a dialog through which the server will find the chosen number by making no more than ten educated guesses. You should write the server and thentest the server with telnet,which connects to the server running on the local machine by the commandtelnet 127.0.0.1 4192As an example of servicing a single client, clickhereto see the server window and clickhereto see the telnet window. In this example, the user chose the number 419(but the server does not know that). In the telnet window, the text in red is text entered by the user, and the text in blue is text sent by the server to telnet (the client).The server is able to detect a cheating user. For example, if the user cheats by answering L when the server guesses 419, the telnet window will bethisbut the server window will remainthis. Note that in the server window, the text***Starting a dialog with Joewas displayed only after the userenters the nameJoein the telnet window. It should be obvious thatthe algorithm thatthe server uses to guess the number is similar to binary search.If such an algorithm fails, it can be inferred that that user changes his mind at some point during the dialog (that is, the user cheats).The server also detects incorrect response (a response that is not C, not H and not L) from a client. As an example of an incorrect client response, clickhereto see the server window andhereto see the client window.
The server can handle multiple clients concurrently. As an example of the server servicing two telnet clients concurrently, clickhereto see the server window, and clickhereandhereto see the telnet client windows. In the example, Joes chosen number is 419 and Toms is 221. As shown in the server window, Toms diaglog begins after Joes and ends before Joes. This implies that the two dialogsproceeded concurrently. On the other hand, if Toms dialog ends after Joes, the then server widnow will bethis, which shows that the two dialogs only partially overlap in time.
The user interface of your server to a client must be identical to that shown in the examples.
Do not use any package statementin your Java code(i.e., your Java program will belong to the default package).Your source file must NOT depend on any IDE ( integrated development environment)to compile or to run. Your source file will be tested in the command-line environment.
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。