Assignment 6 : CHATTY - A Client / Server Chatt Room
Due Date | Tuesday, November 18, 2014 |
Collaboration Policy - Read Carefully
You must work on this project individually, but you may discuss this assignment with other students in the class and ask and provide help in useful ways, preferable over our email list so we can all benefit from your great ideas. You may consult (but not copy) any outside resources you including books, papers, web sites and people (but no penguins or sea urchins).
If you use resources other than the class materials, indicate what you used along with your answer.
Objectives:
The goal of this project is to introduce you to the concepts of remote processes and inter-process communication. The project is purposely loosely defined so there are opportunities for you to be creative and hopefully increase the fun factor (but that is of-course up to you). Please share ideas on the email list - I, and others always enjoy hearing what you are working on. The general idea is to implement a client / server chat room. The chat needs to support multiple clients - i.e., multiple chatters and one server that relay messages to the other chatter clients.
You will need to work on the nike cluster nodes for this assignments (the cf nodes).
Key Concepts:
- Deepened C Programmer knowledge
- Deepened UNIX knowledge
- Remote (and local) Process communication
- Multi-tasking
- Threads
Tutorial / References
Socket programming resources/tutorials:Jim Frost Guide to Socket Programs: Jeff Donahoo's Code/Book (covered in class, with example code): C programming/tutorials:There are several C resources on the net. Here are some that may be useful: C programming tutorial (Stephen Holmes):
C programming tutorial by Brian W. Kernighan: GDB (GNU Debugger) tutorial: C Frequently Asked Questions: |
If you find other resources please post links on the mailing list for the class. |
Design of Chat / Server and Client:
You will write two programs a server that both waits for client connection and relay messages to connected clients and a chat client that connects to the chat server at a specific port. The communication should look similar to the below schematics.
What is a Chat Rooms?
Some of you may be familiar with some forms of Chat Rooms over the Internet such as Instant messenger, Skype, and Piazza, talk and more. For this assignment assume a chat room is created by a server, the server allows the creation of different chat rooms identified by a host name and port number. People can "subscribe to" or "enter" a chat room. A client can send messages, and they instantly appear on the screens of everyone else in the room.
You have access to C-code (also discussed in class) of an echo server and a client where the server echo back strings from a client. Your project is to extend the server and client to a Chat Room application.
Sequence of Events
A sequence of events between a server and a client is listed below
- start server on server machine with specified port number
chat-server 127.0.0.1 5000
- start client on client machine
chat-client 127.0.0.1 5000
- client, Jane, connects to the server(via chat-client program).
- User Jane (client code) types a text to server
Example:
'Hello this is Jill!'
- Server echoes back the text to other connected clients preceded by the name of the original client.
Jill said> 'Hello this is Jill!'
- The client closes the connection by sending 'bye'
- The server notes other connected clients:
Jill has left the chat room>
Client Server Interaction
Your server should be able to accept multiple connections (from different hosts). It should be able to simultaneously listen for incoming connections as well as keep reading from connections that are already open.
Since many of the calls that we talked about in class are blocking calls (e.g. accept(),recv()). They may stall the program execution until data arrives. For example if your server is blocking on an accept() it cannot receive data at the same time.
There are several solutions to this problem. One solution is to use multiple processes (using fork()), another is to use threads (using pthreads)
There are two example programs of multitasking servers in the hw6 directory (see this link) - one is called TCPEchoServer-Fork.c and is listed under the subdirectories echo, the other is listed under the subdirectory pong (last semester's project).Makefiles/README.txt for the echo server.
Design Decisions
You need to design how the server knows how lines are terminated. You do need to design communication for high performance.
Other Requirements
Your server/client must compile, and run on nike. You should develop it in your environment but as a last step make sure it runs on nike.
Submission:
You must submit the following files (i.e., all the files necessary to
compile your program):
README.txt
Makefile (when typing make by itself it should generate the executable yosh
chatt-server.c
chatt-client.c
. (x-tra files if needed, must be listed in README.txt)
.
README.txt how you run/compile and compile your program
To submit the files, you will need to use the submit program. Your files
need to be under a common subdirectory called "1730_program6". If the
1730_program6 subdirectory is directly under your home directory you
execute the below command line while in your home directory:
submit 1730_program6 cs1730
Grade Criteria:
Positive Points:
server accepting at least 2 clients (dual chat >= 2) 5server accepting more than 2 clients (>2) 5server works with at least 6 clients (>=6) 10new client joins, other clients are notified 10client exits, other clients are notified 10message from one client broadcasted to all other clients 20each message has a prompt of the 'senders' name or ID. 10server continue working even if no clients are connected 10Intuitive Design (Easy and intutive Chatting, works with 2> clients) 10sending long sentences during chat (+140 characteres) 10
Negative points:
poorly program design (e.g., poorly documented, modularized, ... ) 10compilation errors (could be zero, may be able to contest to recoup points) 100compilation warnings (each) 1does not run on nike cluster nodes 5infinite loops 5fork explosions 10blocking / stuck / or unresponsive client or server 10inefficient code (up to) 10lateness see late policy (roughly 10 pts per day) 10x#Day
Possible Bonus points (up to 10 pts):
Features Beyond Grading Criteria (Suggestions?) Based on effort
Transfer Images