|
|
||
CS 555 - Computer NetworksHW4Spring 2005
This programming assignment extends the functionality of simple internet chat room service you implemented in HW3. You will use the socket interface to implement a simple, multiperson Internet chat room service. Your implementation will consist of both a client and a server application. The client can allow users to login and logout, check who is active, send messages to other active users, receive messages from other active users, and quit the chat room. The server verifies the identity of the users, forwards the message to the destination, and prints out all clients activities on the screen and to a log file. For this assignment, the server will allow multiple clients to connect to the server simultaneously. You may use a multithreadServer, a selectServer (synchronus i/o multiplexing), or a concurrentServer (concurrent processes created via fork()). You will need to implement the following commands on the client side and the corresponding functions on the server side. 1. login [UserID] [Password] Identify yourself to the remote talk server. If the UserID is not specified, the client will prompt the user for it. If the Password is not specified, the client will prompt the user for it. If the UserID and the Password match, the server will send a confirmation message to the client; otherwise, the server will prompt the user to try again. For a successful login, the server should inform all other active users that a new user has joined the chat room. send an error message to the client. 2. who List all active users, including the UserID and the users' IP addresses. 3. send UserID Send a message to an active user. If the UserID is invalid or the receiver is not active, the server replies the client with an error message. If the UserID is “all”, the server broadcasts the message to all other active users, otherwise it forwards the message to the designated user. The receiving client should process the message immediately. 4. New Create a new user account. The length of both the UserID and Password should be between 3 and 8 characters. The users’ information should be kept in a permanent media, such as a file. 5. logout Logout from the remote server. A user is not allowed to send any message after logout. The server should inform all other active users that the user has exited from the chat room. 6. quit Terminate the talk session with the remote server. The client exits when it receives the confirmation message from the server. If the user has not logout yet, it should automatically logout the user and inform all other active users. Programming Environment
Requirements The following items are required for full-credit:
Grading (150 points) Correctness and Robustness (120 points) o You will lose at least 10 points for any bugs that cause the system crash. o You will lose 5 points for any other bugs. Comments and style (10 points) README and Makefile (10 points) Design and Performance (10 points) o Limit the communication between the client and the server. If something can be done locally at the client side, you should not ask the server to do it. For example, checking the validness of a user command should be done at the client side. o Don’t make the client a dummy terminal. Sample output Sample client outputs at one user "salman", the words in bold are the user inputs. csy02:~/cs555/hw4% clientTalk 141.218.143.217 Simple Multiperson Internet Chat Room: HW4: Computer Networks Here, list commands available for the users, and instructions. Chat>send kyle Permission denied, you must login first. chat>login UserID: salman Password: anwAr SERVER# Salman joined the chat room chat>send kyle User: kyle not active .... // assume now kyle has joined in and the welcome message has been sent to all clients chat>send kyle Please input your message: Hello, Kyle SERVER#Salman: Hello, Kyle chat>send all Please input your message: Good Bye SERVER#Salman: Good Bye chat> quit SERVER#Salman has left the chat room csy02:~/cs555/hw4% Be creative in your design. Hints Start early. These programs will not be very long, but they may be difficult to write, and they will certainly be difficult to debug. Download the sample codes, compile and run them, try to understand every detail, and then make the changes. Design your own communication
protocols between the client and the server. Submission Instruction (1) Copy all your files (only source codes, data file, README, and Makefile, no object file and executable file) in a directory. The directory should be named like hw4_cs555_yourlastname/. For example, if you name is John Smith, your directory name should be hw4_cs555_smith/.. (2) Generate a tar file of the directory using the following command. Go to the parent directory of your hw4_cs555_yourlastname directory and type % tar cvf hw4_cs555_yourlastname_mmddyy.tar hw4_cs555_yourlastname %gzip hw4_cs555_yourlastname_mmddyy.tar Note, only the zipped tar file will be accepted. You are fully responsible for generating the right tar file.
(4) Submit a hardcopy of your submission with README file on top.
Sample Programs and Makefile
References 1. Beej's Guide to Network Programming: Using Internet Sockets 2. Sun Programming Interfaces Guide: Socket Interfaces 4. Sockets programming in Java: A tutorial
|
||