TO BE PROGRAMMED IN JAVA "JCREATOR" OR EQUIVILENT use sockets to write a simple client-server application to play a Lottery. to select 6 distinct numbers in the range 1-100 and you win if any one of those numbers matches the single number generated at random by the Server. The client/server action should proceed as follows: : Client c1. Connect to server via a connection-oriented socket. c2. Read (from socket) and display the prompt message sent (see step s2 in server) by the server. c3. Input your six lottery selections and send them to the server. [PREF. A SIMPLE LOOP PLS] [login to view URL] (from socket) and display the result of the game, or an error message that is returned by the server (see step s4 in server). c5. Close the connection Server s0. [Initialization] Create a socket on one of the port numbers in the range above 1024. [login to view URL] for a client connection on this socket [login to view URL] a client connection is accepted send an acknowledgement as a sting of text. s3. Receive and read the list of numbers selected by the client. Check that this list is valid (distinct numbers in the range 1-100), if not, return an error message. s4. Make the lottery draw and see if the client has any winning numbers. Return the result to the client. s5. Close the connection to the client and then loop back and wait for another connection. [PLS PROGRAM IN SIMPLE TERMS, FULLY COMMENTED. PREFERBLY NO POINTERS OR STRUCTS INVOLVED]
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. You must chose an unused server port number above 1024. For example, choose port 8888. * The Server application listens on port 8888 and handles the incoming requests. It may consist of several classes, one to listen, accept connections and revert to listening, and one to draw the lottery number and check whether any client choices have won. The Server should print diagnostic information on the terminal (no GUI is required), listing the status of the server and details of each connection. For example: Server listening on Port 8888, IP number of Client, Connection accepted. It may be helpful to test your Server using telnet before attempting to connect to the client. * In writing your code, make sure to check for an error return from your system calls or method invocations, and display an appropriate message. In Java, this means using IOException(); * i will be running both the client and server on the same machine. Start the server in one window, and then start the client in another window. In the socket, use ‘localhost’ as the name of the machine to connect to. [BASICALLY 2 TERMIANL PROMPTS, NO GUI PLEASE] * Make sure you close every socket that you use in your program. If you abort your program, the socket may still hang around and the next time you try and bind a new socket to the port you previously used (but never closed), you may get an error. Also, please be aware that port ID's, when bound to sockets, are system-wide values and in the UNIX lab other students may be using the port number you are trying to use. Submission Write a report on the design and implementation of your solution, showing code and results: (i) a class diagram outlining the class structure for your proposed solution. (ii) a set of summary tables describing the fields, constructors and methods for each class. (iii) a print out of the Java source code of your complete program.
## Platform
SUN SOLARIS UNIX AND WINDOWS (WIN98 & XP)