This project has been created as part of the 42 curriculum by [ababdoul], [Selboukaoui], [mhoussas].
ft_irc is a fully functional IRC (Internet Relay Chat) server implemented in C++98. The goal of the project is to build a server that handles multiple simultaneous client connections, follows the IRC protocol (RFC 1459), and supports real IRC clients such as LimeChat, irssi, or netcat.
The server supports:
- Simultaneous client connections using
poll() - User authentication via password, nickname, and username registration
- Channel management (join, leave, messaging)
- Operator commands (kick, invite, topic, mode)
- Private messaging between users
- C++ compiler supporting C++98 (
g++orclang++) - A Unix-based system (Linux or macOS)
make
make./ircserv <port> <password>Example:
./ircserv 6667 mypasswordnc localhost 6667
PASS mypassword
NICK yournick
USER yournick localhost localhost Real_Name
JOIN #general
PRIVMSG #general :Hello everyone!- Host:
localhost - Port:
6667 - Server password: the password you used to start the server
| Command | Description |
|---|---|
PASS |
Authenticate with server password |
NICK |
Set or change nickname |
USER |
Register username and real name |
JOIN |
Join one or multiple channels (JOIN #a,#b) |
PART |
Leave one or multiple channels |
PRIVMSG |
Send a message to a channel or a user |
QUIT |
Disconnect from the server |
KICK |
Remove a user from a channel (operator only) |
INVITE |
Invite a user to a channel |
TOPIC |
View or set the channel topic |
MODE |
Set channel or user modes |
| Mode | Description |
|---|---|
+i |
Invite-only channel |
+t |
Topic settable by operators only |
+k |
Channel password (key) |
+o |
Give/take operator privilege |
+l |
Set user limit |
ft_irc/
├── header.hpp — shared includes and declarations
├── main.cpp — entry point
├── Makefile
├── README.md
│
├── authentication/
│ ├── authentication.cpp — registration flow orchestration
│ ├── PASS.cpp — password authentication
│ ├── NICK.cpp — nickname registration and validation
│ └── USER.cpp — username and realname registration
│
├── client/
│ ├── client.cpp — Client class (poll list + client info)
│ └── client.hpp — t_info struct and Client class
│
├── server/
│ ├── server.cpp — main server loop
│ ├── server.hpp — Server class and declarations
│ ├── channel.hpp — Channel struct/class
│ ├── utils.cpp — socket helpers (bind, listen, poll, recv, send)
│ └── welcom.cpp — welcome replies (001 002 003 004)
│
└── cmds/
├── cmds.hpp — all command function declarations
├── parse.cpp — IRC message parser
├── JOIN.cpp — join channels
├── PART.cpp — leave channels
├── PRIVMSG.cpp — send messages to channels or users
├── QUIT.cpp — disconnect from server
├── KICK.cpp — remove a user from a channel
├── INVITE.cpp — invite a user to a channel
├── TOPIC.cpp — view or set channel topic
└── MODE.cpp — channel and user modes
- Modern IRC documentation — cleaner and more readable reference for commands and numerics
- Beej's Guide to Network Programming — the classic reference for sockets,
poll(),recv(),send() - Linux man pages — poll(2)
- Linux man pages — socket(2)
Claude (claude.ai) was used throughout this project for:
- Architecture design — understanding how to structure the server loop, Client class, and command dispatcher
- Debugging — identifying bugs in poll loop, buffer management, and command parsing
- Command implementation guidance — step-by-step explanation of what each IRC command must do, which numeric replies to send, and edge cases to handle (e.g. multi-channel JOIN, buffer splitting on
\r\n) - IRC protocol understanding — explaining numeric reply codes, the registration flow (PASS -> NICK -> USER), and message format (
:prefix COMMAND params :trailing\r\n) - Code review — reviewing JOIN, PRIVMSG, PART, and QUIT implementations for bugs before testing
AI was used as a learning and debugging tool. All code was written and understood by the team members.