A lightweight IRC (Internet Relay Chat) server implementation written in C++98, utilizing POSIX sockets and epoll for efficient asynchronous I/O. Supports standard IRC commands for multi-user communication and channel management.
Check the small article about the multiplexing choice here
- Core IRC Commands:
CAP,PASS,NICK,USER,QUIT,JOIN,PRIVMSG,KICK,MODE,PART,TOPIC,INVITE,PING. - Channel Management:
Create/join channels, set passwords, manage topics, and moderate users. - Client Authentication:
Requires password, nickname, and username for connection. - Efficient I/O Handling:
Usesepollfor non-blocking socket operations and scalable event monitoring. - Multi-Client Support:
Handles multiple simultaneous connections with asynchronous I/O. - Resource Safety:
Proper cleanup of clients, channels, and commands on shutdown.
- Linux environment (uses
epollwhich is Linux-specific). - C++98-compatible compiler (e.g,
g++). makefor building.- IRC client (our main pick is irssi) for testing.
- Clone the repository:
git clone https://github.com/dabel-co/ft_irc cd ft_irc - Build the project:
make
- Run the server:
Example:
./ft_irc <port> <password>
./ft_irc 6667 myultrasupersecretpassword
- Connect to the Server:
Use an IRC client ortelnet:telnet localhost 6667
- Authenticate:
Send commands in order:PASS myultrasupersecretpassword NICK your_nickname USER your_username 0 * :Your Real Name - Join a Channel:
JOIN #general - Send Messages:
PRIVMSG #general :Hello, world! PRIVMSG user2 :Private message here.
| Command | Description | Example |
|---|---|---|
JOIN |
Join/create a channel | JOIN #coding |
PRIVMSG |
Send message to channel/user | PRIVMSG #coding :Hi everyone! |
KICK |
Remove a user from a channel | KICK #coding user1 :No spam |
MODE |
Set channel modes (e.g, +o for operator) | MODE #coding +o user1 |
TOPIC |
Set or view channel topic | TOPIC #coding :New topic |
INVITE |
Invite a user to a channel | INVITE user2 #coding |
PART |
Leave a channel | PART #coding |
QUIT |
Disconnect from the server | QUIT :Goodbye! |