This project has been created as part of the 42 curriculum by isakrout, sel-abbo, sfaouzi .
This project is a lightweight IRC server written in C++98. It implements the core networking and chat logic needed to allow multiple clients to connect, authenticate, join channels, exchange messages, and use channel moderation features over a real TCP socket connection.
The server is built around the standard Unix socket API and uses poll() to manage multiple simultaneous clients efficiently. It was designed as a faithful exercise in network programming, message parsing, and event-driven server architecture.
- Client connection handling with non-blocking sockets
- Authentication flow using
PASS,NICK, andUSER - Private messaging (
PRIVMSG) between users - Channel creation and membership management (
JOIN,PART) - Channel operator features such as
INVITE,KICK,TOPIC, and basic mode handling - Bot integration (
loffi) responding to commands such as!help,!time, and!users - Graceful shutdown handling with clean socket cleanup
- A Unix-like environment (Linux is used for this project)
- A C++ compiler compatible with the C++98 standard
makeavailable in the system shell
From the project root, run:
makeThis will compile the server executable:
./ircserv <port> <password>The server is configured to listen on port 6667 and uses the default password pass as defined by the project code.
To connect, you can use any IRC client or a simple TCP client such as nc:
irssi -c <hostname> -n <nikcname> -w <password> -p <port>or
nc <hostname> <port>A typical login sequence (in case of using nc) is:
PASS pass
NICK alice
USER alice 0 * :Alice
JOIN #general
PRIVMSG #general :Hello everyone!
server.cpp/server.hpp: server lifecycle, socket management, polling, and client handlingclient.cpp/client.hpp: client state and command dispatch logicchannel.cpp/channel.hpp: channel storage, membership, and channel modescommand.cpp/command.hpp: IRC command implementationsirc_utils.cpp/irc_utils.hpp: IRC message formatting and helper functionsBot.cpp/Bot.hpp: minimal bot behavior for server-side interactionmain.cpp: startup entry point
- RFC 1459: Internet Relay Chat Protocol
- RFC 2812: Internet Relay Chat: Client Protocol
- POSIX sockets programming documentation and examples for
socket(),bind(),listen(),accept(), andrecv() - Linux
poll(2)documentation for multiplexed I/O - IRC community documentation and protocol examples for command semantics and message formatting
ip(7): The official Linux reference documentation for programming IPv4 network applications in C/C++book: TCPIP Sockets in C by Michael J. Donahoo
AI tools were used as a support layer during the development of this project for:
- clarifying IRC command behavior and server/client message flow
- reviewing command parsing and edge cases around invalid input and channel restrictions
- suggesting clean patterns for managing multiple client connections with
poll() - helping structure the code and generate documentation text, including parts of the README and implementation notes
These tools were used as an aid for reasoning, debugging, and documentation, but the protocol logic, socket design, and final integration were implemented in the project itself.
This project is a simplified IRC server and focuses on the core protocol mechanisms expected in the 42 curriculum. It is intended as a practical introduction to network programming and backend concurrency patterns in C++.