A simple IRC implementation in C++.
The server.sh
file has the commands to compile both server and client. To start the server,
./server.sh <num_of_clients>
To launch clients,
./client.sh <name_of_client>
To compile server, run
g++ -fconcepts -pthread server.cpp -o server
To compile the client, run
g++ -fconcepts -pthread client.cpp -o client
To run the server,
./server <num_of_clients> <server_port>
To run the client,
./client <server_ip> <server_port> <username_of_client>
To connect to server using telnet,
telnet <server_ip> <server_port>
Then give the username of the client as soon as it connects. You will get prompts from there after.
On clients,
list chatrooms
-- List of available chatrooms on server.create chatroom <cr_name>
-- Create a chatroom with the namecr_name
and join it.join chatroom <cr_name>
-- Join an existing chatroom with the namecr_name
.exit
-- Close the connection with the server.
list users
-- List of users in the existing chatroom.reply <msg>
-- Broadcastmsg
to everyone in the chatroom.reply tcp <file_path>
-- Send file to everyone in the chatroom (Doesn't work on telnet).exit chatroom
-- Exits the chatroom.
- Single server, multiple clients based model.
- Broadcasts messages to all the clients in the chatroom.
- When client exits, the pointer still remains in the clients variable. Need to remove the exited client.
- In
client.cpp
, the output needs to be printed at once (it stops after a linebreak). - In
client.cpp
, handle triggeringexit
command when inside a chatroom. - Implement unique usernames.
- Chatroom chat history.
- Improve server side logging.
- Add user connected to the server to a chatroom.
- Client-Client direct messaging.