Programming Assignment 3
In this project, we will be providing a chat client and will host a chat server. Clients allow users to communicate with one another by connecting to the server and interacting with it in accordance to an application protocol. Through this protocol, the server allows clients to engage in group chats in chat rooms and send private messages to one another. Your task will be to reverse engineer the chat server and its protocol and use this information to write a compatible replacement. Alternatively, you may elect to take a 20 point penalty and instead implement a compatible client.
2 Client (Provided)
The client is available in the ‘materials’ repository under the ‘assignment3’ directory. The provided client takes a single optional command line argument:
1. -u = Run with limited ncurses support.
While running, the client takes commands directly from the user. All commands are preceded by a backslash. Not every command is available in every context. The client supports the following commands: 1. \connect <IP Address:<Port = Connects to a new chat server, speciﬁed by the IP address and port. 2. \disconnect = If connected to a server, disconnects from that server. 3. \join <Room<Password = Joins the speciﬁed chatroom, creating it if it does not already exist. The Password is optional, with the default being the empty string. Users may only join rooms for which they know the password. Both Room and Password must be less than 256 characters in length. 4. \leave = If the user is in a room, exits the room. Otherwise, disconnects from the server. 5. \list users = Lists all users. If the user is in a room, lists all users in that room. Otherwise, lists all users connected to the server. 6. \list rooms = Lists all rooms that currently exist on the server. 7. \msg <User<Message = Sends a private message to the speciﬁed user. User must be less than 256 characters in length, and the Message must be less than 65536 characters in length.
8. \nick <Name = Sets the user’s nickname to the speciﬁed name. Name must be less than 256 characters in length.
All other input is interpreted as a message being sent to the room the user is current in.
3 Server (Hosted)
We will be running a server at 220.127.116.11 and listening on port 58587. You can connect to it in the chat client by running the command: \connect 18.104.22.168:58587
4 Replica Implementations
Your replica client must not have any required arguments, and does not need to support the u option. The output of your replica client must exactly match that of the provided client for all sequences of commands and messages. You can test your replica client implementation by comparing the output to that of the provided client using diff.
Your replica server must support the following command line arguments:
1. -p <Number = The port that the server will listen on. Represented as a base-10 integer. Must be speciﬁed.
Your project grade will depend on how much client functionality is maintained when connecting to your server. We will test your server by running a client in standard input and output mode (i.e., without the -u option) and directly comparing the output, with identical input, of your server versus the reference implementation. Note that we may test your server’s handling of behavior that the provided client does not display. If you elect to implement the client instead of the server (and take the 20 point penalty), we will diff the output of your client when fed identical input against the reference client in standard input and output mode. We strongly encourage you to write tests against the reference implementation to compare against your own implementation.
6 Additional Requirements
1. Your code must be submitted as a series of commits that are pushed to the origin/master branch of your Git repository. We consider your latest commit prior to the due date/time to represent your submission.
2. The directory for your project must be called ‘assignment3’ and be located at the root of your Git repository.
3. You must provide a Makeﬁle that is included along with the code that you commit. We will run ‘make’ inside the ‘assignment3’ directory, which must produce either a ‘server’ or ‘client’ executable also located in the ‘assignment3’ directory.
4. You must submit code that compiles in the provided VM, otherwise your assignment will not be graded.
5. Your code must be -Wall clean on gcc/g++ in the provided VM, otherwise your assignment will not be graded. Do not ask the TA for help on (or post to the forum) code that is not -Wall clean, unless getting rid of the warning is the actual problem.
Assignment 3: Chat server
Programming Assignment 3