A fully functional IRC server built in C++ as part of the 42 School curriculum.
ft_irc is a non-blocking, single-threaded IRC server using poll() for I/O multiplexing. It supports multiple simultaneous clients, follows the IRC protocol (RFC 1459), and is compatible with standard IRC clients like irssi, WeeChat, or HexChat.
No forking is used — all I/O operations are non-blocking and handled through a single poll() call.
- 🔌 Handle multiple clients simultaneously without blocking
- 🔐 Client authentication via connection password
- 💬 Channel creation, joining, and messaging
- 📢 Broadcast messages to all clients in a channel
- 👑 Operator and regular user roles
- 📦 Packet aggregation (handles split/partial commands correctly)
- 🖥️ TCP/IP (v4) communication
git clone https://github.com/yourusername/ft_irc.git
cd ft_irc
make./ircserv <port> <password>| Argument | Description |
|---|---|
port |
The port number the server listens on |
password |
The connection password required by IRC clients |
Example:
./ircserv 6667 mypassword# irssi
irssi -c 127.0.0.1 -p 6667 -w mypassword
# WeeChat
/server add ft_irc 127.0.0.1/6667 -password=mypassword
/connect ft_irc| Command | Description |
|---|---|
PASS |
Authenticate with the server password |
NICK |
Set or change nickname |
USER |
Set username and real name |
JOIN |
Join a channel |
PART |
Leave a channel |
PRIVMSG |
Send a message to a user or channel |
KICK |
Eject a user from a channel (operator only) |
INVITE |
Invite a user to a channel (operator only) |
TOPIC |
View or change a channel's topic |
MODE |
Set channel or user modes |
QUIT |
Disconnect from the server |
Set with the MODE command by channel operators:
| Mode | Description |
|---|---|
i |
Invite-only — only invited users can join |
t |
Restrict TOPIC changes to operators only |
k |
Set or remove a channel password (key) |
o |
Grant or revoke channel operator privileges |
l |
Set or remove a user limit for the channel |
Test partial data handling using nc:
nc -C 127.0.0.1 6667Type parts of a command and flush them separately with Ctrl+D to simulate split packets. The server correctly aggregates and processes the full command once complete.
This project is part of the 42 School curriculum. Feel free to use it as a reference.