This project is to write a program for a user to concurrently chat with multiple users from different computers.
When your program runs, it listens on a port for chatting requests. Your program should also wait for user input from the standard input device. You need to design a set of commands for users to communicate through your program. For instance,if your program is running on computer "frog3" and a user on "frog3" type a command:
> i frog4.cs.clemson.edu
the program on "frog3" will send a chat request to "frog4".
If the same program is also running on "frog4", a connection is established. Once a connection is established, program on "frog4" will send a greeting message back to "frog3", and "frog3" should display the greeting message. A greeting message might be "Hello, This is frog4.cs.clemson.edu!". If the program on "frog3" fails to connect with "frog4", "frog3" should display an error message.
After a chatting connection is established, users on both ends can use "s" command to send messages to their chatting partners. For instance, a user on "frog3" can type a command:
>s frog4.cs.clemson.edu This is me!
a message "This is me! from frog3.cs.clemson.edu" will be sent to "frog4" and displayed on its screen.
The chatting connection will be terminated if a user on either end of the connection decides to stop the conversation. For instance, a user on "frog4" may type a command:
>x frog3.cs.clemson.edu
In this case, the conversation between "frog4" and "frog3" should be terminated. However, if "frog4" and "frog3" have connections with other computers, those connections should not be affected.
Terminating a chatting connection does not mean your program should quit. Even if all chatting connections on a computer are terminated, your program should still listen to the specific port for chatting requests. Your program quits only if the user type "q" when program is not in conversation mode, i.e., there is no chatting connection alive on this computer. If there is still a chatting connection alive, your program should give a warning message to let user to terminate all the chatting connections first.
You must submit all the source code necessary for us to build and test your chat program. You must also include Makefile that can be used to build your client and server on the CS Unix workstations. If you don't know how to use make or create a Makefile, refer to the concurrent echo program sample code.
You must also include in your submission a file named README
that includes your name and a brief description of your submission, including
the name of each file submitted along with a one line description of what is in
the file. If your code is not complete, tell us what works and what doesn't. If
you are submitting code that does not compile, please tell us that as well. If
any of your code was written by someone else, you are required to tell us about
it (this must also be documented in the code itself). Finally, feel free to
include a description of any problems you had or anything else you think might
be helpful to us.
Your project will be tested to make sure it works properly. Here is a rough breakdown of the grading:
| I/O multiplexing | 30% |
| Multi-thread Programming | 30% |
| Chatting Functions | 20% |
| Error handling, Style/Code structure, etc. | 20% |
NOTE: 20% of your homework grade depends on the how "well your code is written". These points include the following:
How well we can understand your code. There is no required format for your code, there is no requirement like "you must have one comment for every 5 lines of code". Feel free to provide whatever level of commenting you believe is appropriate to make sure that other competent programmers could easily understand and make changes to your code.
All project files must be submitted via handin command on any Unix machine in the department as follows:
> handin.360.2 6 file1 file2 file3 ...
Please make sure you submit all your source files not the object files. You can also zip the files using the following command first:
> tar cvzf hw6.tgz file1 file2 file3 ...
and submit the single zip file hw6.tgz. Before you submit this single file, please use the following command to check make sure you have everything in this zip file:
> tar tvzf hw6.tgz
Don't send compiled code! Please ask question if you don't understand any part of this project.