联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-10-28 10:37

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 named assign3Server.java .  Log into Canvas. In the Canvas site for this course, click Assignments and then click the link assign3a and upload the file assign3Server.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 then test the server with telnet, which connects to the server running on the local machine by the command telnet 127.0.0.1 4192  As an example of servicing a single client, click here to see the server window and click here to 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 be this but the server window will remain this. Note that in the server window, the text ***Starting a dialog with Joe was displayed only after the user  enters the name Joe in the telnet window. It should be obvious that the algorithm that the 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, click here to see the server window and here to see the client window.

The server can handle multiple clients concurrently. As an example of the server servicing two telnet clients concurrently, click here to see the server window, and click here and here to see the telnet client windows. In the example, Joe's chosen number is 419 and Tom's is 221. As shown in the server window, Tom's diaglog begins after Joe's and ends before Joe's. This implies that the two dialogs  proceeded concurrently. On the other hand, if Tom's dialog ends after Joe's, the then server widnow will be this, 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 statement in 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.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp