WMich Home

 

CS Home

 

Ajay Gupta's Home

 

CS555 Home
Class Policies  & Syllabus
Topics Covered
Home Work I
Home Work II
Home Work III
Home Work IV
Home Work V
Home Work VI
 
 
 
 
 
Message  Board
Class List
Reading List

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Email webmaster

 

 

 

CS 555 - Computer Networks

HW4

Spring 2005

 

Given February 15, 2005

Due March 8, 2005 (class time)

Internet Multiperson Chat Room

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


You can use either C/C++ or Java to implement the assignment. The assignment will be tested on the Linux / Unix workstations. For easy grading, please don’t use any GUI interface.

Requirements

The following items are required for full-credit:

  • must allow at least five clients to connect to the server concurrently. 
  • Implement all six commands: login, who, send, new, logout, and quit. The users information should be maintained in a configuration file and parsed by the server.
  • The server's configuration file should also allow configuration of the port number for the server's welcoming socket, the directory for the log file(s), and the list of allowed IP addresses from where clients can connect. See a sample of the server's configuration file..
  • The client's configuration file should allow configuration of the server's port number. See a sample of the client's configuration file.
  • A user can only send the message to the server after its identity has been verified by the server.
  • A user cannot have two or more active sessions.
  • Both the server and client should be able to run on any linux / unix workstations in the cs department or CAE labs..
  • The client should be able to connect to the server running on any machine. Therefore, the server IP address should be a command line parameter.
  • The server should output all client activities on the screen and in a log file.
  • Your source codes must be well documented and commented
  • Include a README file in your submission. The following information should be included: functions that have been implemented, instructions about how to run your program, known bugs, and sample outputs.
  • Include a Makefile in your submission.

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.


(3) Email the tar file before the due date to ajay.gupta@wmich.edu

(4) Submit a hardcopy of your submission with README file on top.

 

Sample Programs and Makefile

1. talkClient.c

2. selectServer.c

3. multiThreadServer.c

4. Makefile

5. Makefile for Java

6. Multithreading in Java

7. sample multiThreadServer in Java

References

1. Beej's Guide to Network Programming: Using Internet Sockets

2. Sun Programming Interfaces Guide: Socket Interfaces

3. How to write a Makefile

4. Sockets programming in Java: A tutorial

Any student may be asked to show and discuss his implementation in class, so be ready with your presentation.

Submit a zipped file of your source codes, scripts (to run your program) and report along with a hardcopy of your source codes, scripts, a couple of sample executions of your solution and report.

Use <hw#cs555_yourlastname_mmddyy.{zip,gz,ppt}> as the naming convention for your zipped or ppt files when emailing your submission to ajay.gupta@wmich.edu. Replace '#' with the appropriate homework number.

REMINDER: You are responsible for making yourself aware of and understanding the policies and procedures in the undergraduate (pp. 268-270) [Graduate (pp. 24-26)] Catalog that pertain to Academic Integrity. Additionally, easy availability of information, material, source codes, lecture notes etc on the Internet may make it possible to find solutions to your assignments on the Internet or elsewhere. It is okay to refer to those, understand them and use them to enhance your solutions, generate your own ideas etc. However, you must give proper and full credit to original authors of the work, if you include their ideas. Failing to do so is part of academic and professional dishonesty. It will not be tolerated in this class. Do not give in to temptations...

 

 

 

 


Home