Network Program Implementation
Due: 10:00am, Thursday, December 14, 2023
Network Program Implementation – Chat Server
In this assignment you will develop a network chat application using stream sockets. The server will be a concurrent, connection-oriented multi-client chat server. The concurrent server can be implemented utilizing either processes or threads. The client will connect to the server to send chat messages to the other clients. The server will send messages received from a client to all connected clients, except for the originating client.
The client should accept the server’s hostname and the port number as command-line arguments (CLA). The server should accept a number as a command-line argument.
The server must be able to gracefully shutdown. If the server receives a CTRL-c to kill it, the server should send a message to all clients indicating it will be shutting down in x seconds, then wait x seconds and gracefully close. This should be done by using a signal handler for the SIGINT signal.
The recommended supported messages of this chat protocol are:
HELLO– sent by server upon client connectionBYE– sent by client on disconnectNICK– sent by client and contains the user’s selected nicknameREADY– sent by server after successful registration (nickname)RETRY– sent by server if nickname selected is not unique
You may add additional messages to your protocol, which will be clearly developed and defined by the team. You may also change the messages above to better fit your developed protocol, but be sure to clearly document this in your readme file.
The chat protocol specifications are:
When client connects, the server will send a “HELLO” message to the client.
When client disconnects from server, the client sends a “BYE” message to the server.
After the client connects, the user will select a nickname, which will be sent to the server using the “NICK” message.
The server must verify that the nickname selected is unique
If unique, server will send “READY” message to client. The client can now send and receive messages.
If not unique, server will send a “RETRY” message to client and the user will select a different nickname. This will continue until the user selects a unique nickname.
When the client selects a unique nickname, the server must write to the log file the timestamp the client connected, the client’s IP address, and the client’s nickname.
Send a message
User enters a message in the client, which will be sent to the server.
Server must print all chat messages received by clients to a log file. All chat messages must include the client’s nickname at the start of the message. The messages should be written to the log file should include a timestamp, nick, and message.
Receive messages
- The client should have a way to receive chat messages from the server. You have the choice to make this push-based or pull-based.
Readme File
Each team will create a readme file for their application. The readme file will include the following sections, at a minimum:
ID block
How to build and run the client and server
File/folder manifest identifying the purpose of each file/folder included in the project
Responsibility matrix – table containing a row for each team member and the aspects of the project to which they contributed
A section that corresponds to section 3 of the design document. This section must list the tasks and the actual times it took to complete them.
Protocol – the details of your developed protocol, including the initial protocol defined above, and how the protocol for socket reads/writes
Assumptions – clearly list and describe any assumptions made about running the application or how the application works
Discussion on your development process, including any decisions and/or major problems you encountered and your solution for each
Status – current status of applications in terms of specifications, and any known issues with the application
Files to Submit
To submit your assignment, create a zip file of a DIRECTORY named
final-project containing the required files. Then submit that file to the
appropriate folder on D2L.
The submission must include:
All source files
Makefile or equivalent script to compile all source files, if necessary
Readme file
Protocol Specification Document