A real-time chat application supporting multiple concurrent users through multi-threading. The application consists of a server component handling multiple client connections and a client interface for users to communicate.
Note: Both client and server are configured to work over localhost in the repo. If you wish, this can be easily changed through the macros in the implementation files.
- C Programming Language: Server and client
- Linux: Platform for development and execution. The server uses some Linux specific system calls - accept4()
- ncurses: For the client UI.
- Java JUnit Framework: For testing the server.
Note: This application requires running multiple terminal instances
Note: The server is configured to listen on localhost over port 30000
Note: When running the server, please change the linux's default file descriptor limit prior to running the server by enter the following in bash:
ulimit -n 99999- Open two terminals
- In one terminal start the server:
cd server
make clean
make LOG=1 #LOG=1 is enable log messages, it can be omitted
./server- In the second terminal, Launch the client:
cd client
make clean
make
./client localhost 30000Additional Clients would need to follow step 3 in additional terminals
- Multithreaded design:
- A main thread accepts new connections and delegates them to worker threads
- Worker threads manage clients using `epoll'
- All sockets are non blocking
- Please see Server Documentation for more info
- Server Test Documentation for server test documentation
- Implemented in Ncurses
- One thread for handling user input another for recieving server messages
- Client functionality
- Join or create chat rooms
- Communicate with others in the room
- Leave rooms to return to the lobby and join or create new rooms
- Please see Client Documentation for more info.
We conducted a test to evaluate whether the server benefits from multithreading. While this test was not exhaustive, the results showed some improvement in performance as the number of threads increased. For more details, please refer to Performance Test Results
chat-application/
├── server/ # Server-side implementation
├── test/ # Server-Side tests
├── client/ # Client-side implementation
├── protocol.md # Defines the simple protocol that the server and client uses to communicate