Systems software · Fall 2025
Multithreaded TCP Chat System
A client-server chat application built with a partner, with my work focused on server concurrency, message broadcasting, and conversation logging.
My role
I worked primarily on the server in a team of two. We divided the work into small tasks based on how we wanted someone to use a lightweight chat program, then tested it as we went and adjusted the behavior together.
Inside the project
Built a server with a handler thread for each connected client and slots for up to eight clients. Shared socket and username arrays track the active participants.
Used a mutex around shared client updates and the logging/broadcast path. The server formats each message and sends it to active clients other than its sender.
Added file-based conversation logs with participant names, messages, and timestamps. On the client, separate sending and receiving processes allow incoming messages to appear while the user types.
Used Valgrind to check for memory leaks and invalid memory accesses, and coordinated development with my teammate through Git.
Challenges & decisions
The hardest part for me was getting a message from one client to every other connected client without echoing it back to the sender or displaying corrupted text. I traced the corruption to how message strings were being handled.
In the submitted server, each client has a handler thread. A mutex protects the shared client information while the server formats a message, appends it to the conversation log, and sends it to the other clients. The client separately uses a forked process so receiving messages does not have to wait for keyboard input.