Operating System代写:CSCI6303 Client Server Model

代写网络通信的应用程序,用Java socket编写,同时需要用swing来写界面。

The program must be demonstrated in Lab on the due date. After the demo, the program must be submitted electronically through the digital dropbox on the due date. If you fail to demo your program or submit it to dropbox, your will not receive credit for the lab assignment. Put your name in the program file.

Objective

The goal of this project is to develop a client-server based chat application using sockets in Java programming language. After completing the project, you will have a basic understanding of the working of a Client/Server architecture as well as socket programming. You may work on this project with one more student. You cannot have teams with more than two students. You may work alone if you wish to. Any clarifications and revisions to the assignment will be posted on the course Web page.

Project Description

In this project, you will be writing two programs, a server and a client. The server will authenticate each client using some password file. After authentication, the client’s request will be served by the server. For this project, the client would send some string to the server and the server must forward the message to other clients known to the server.
You are required to implement the following steps using GUI. You may use java swing objects or applets to do that.

  1. When the server is started, it will open a file (passwd.txt) which will have a mapping of hostnames to passwords. The server will store this mapping in some storage object. You may use any type of structure (arrays, arraylists, vectors etc.) to store this information. Assume that maximum number of entries in the file is 100.
  2. After building the storage structure, the server would create a socket and bind it to a SERVER PORT. The server will then receive requests on this port from clients.
  3. The client also creates a socket and uses this socket to communicate with the server. CLIENT PORT, SERVER PORT, SERVER IP ADDRESS and PASSWORD are supplied to the client from the GUI.
  4. The client must first authenticate itself to the server. If the client is a first time user, the server must prompt the client to create a new password. Thereafter, the hostname and the password of the client must be stored in the passwd.txt file on the server.
  5. After the client authenticates itself, it can start sending messages to the server. When the server receives a message from a client, it must forward the message to other clients connected to the server.
  6. The client must be able to create a new group (chatroom) or join an existing group. The list of existing groups must be available to the client next to the chat window. A separate list of groups joined by the client must also be available to the client. The client must pick a group (that the client created or joined before), write a message and click send to send the message to the server.
  7. The server must forward the message to only the clients who are in the selected group (multicast). If no group is selected, the message is sent to all clients connected to the server (broadcast). Clients can pick a single client and send messages to them (unicast). Messages always go to the server first and then sent out to other clients from there. Clients must have a choice to opt out of receiving messages that were sent to everyone.
  8. Clients must also have a choice to be visible to other clients or not. However, all the clients within a group must be visible. Invisible clients will not receive broadcast or unicast messages. However, they will receive group messages.
  9. Clients must be able to leave a group at any time.

Additional Requirements

  1. Print out every request/reply sent by the client and the server.
  2. Client and server programs should be able to handle and print system errors. (Use exceptions or try/catch and print errors).
  3. Submission Instructions: This project requires the submission of a soft copy and a hard copy.