This project has been created as part of the 42 curriculum by brturcio, salabbe and ntome.
- EN: A compact IRC (Internet Relay Chat) server written in C++ (42 curriculum project).
- ES: Un servidor IRC (Internet Relay Chat) compacto escrito en C++ (proyecto del currículo de 42).
A compact IRC server that accepts multiple concurrent clients, manages channels, and implements a subset of the IRC client protocol.
- TCP server with multiple clients (single-process, event-driven)
- Password-protected connections
- User registration flow (
PASS,NICK,USER) - Channel management (join/leave, invite-only, topic, operators, etc.)
- Private messaging
- IRC numeric replies (see
includes/IrcCodes.hpp) - Bonus: simple bot (see
sources/Commands/Bot_bonus.cpp)
Implemented command handlers live in sources/Commands/:
- Registration:
PASS,NICK,USER - Session:
QUIT - Messaging:
PRIVMSG - Channels:
JOIN,INVITE,KICK,TOPIC,MODE
Note: IRC clients differ in the exact command sequence they send. If you have trouble connecting, make sure you provide the server password and complete registration (PASS/NICK/USER).
From the repository root:
makeThis produces the ircserv binary.
Useful targets (if present in the Makefile):
make re
make fclean./ircserv <port> <password><port>: listening port (e.g.6667)<password>: required by clients viaPASS
Example:
./ircserv 6667 mypasswordnc 127.0.0.1 6667
PASS mypassword
NICK alice
USER alice 0 * :Alice
JOIN #42
PRIVMSG #42 :hello from nc- Server/Host:
127.0.0.1 - Port: the
<port>you chose - Server password: the
<password>you started the server with
Then join a channel, for example: /join #42.
.
├── includes/
│ ├── Server.hpp # core server class
│ ├── Client.hpp # client state
│ ├── Channel.hpp # channel state
│ ├── ChannelRules.hpp # modes / permissions
│ ├── Topic.hpp # topic handling
│ └── IrcCodes.hpp # numeric replies / codes
├── sources/
│ ├── main.cpp
│ ├── Server*.cpp # socket + main loop utilities
│ ├── Parsing.cpp # parsing helpers
│ ├── SplitString.cpp
│ └── Commands/ # command implementations
├── Makefile
└── en.subject.pdf
- This repository is meant as an educational implementation; it is not intended to be a production-grade IRCd.
- If you want to extend it, a good next step is to add more command handlers under
sources/Commands/and map them in the server’s command dispatcher.
- RFC 1459 - Internet Relay Chat Protocol
- RFC 2810 - Internet Relay Chat: Architecture
- RFC 2811 - Internet Relay Chat: Channel Management
- RFC 2812 - Internet Relay Chat: Client Protocol
- RFC 2813 - Internet Relay Chat: Server Protocol
Servidor IRC compacto que acepta múltiples clientes concurrentes, gestiona canales e implementa un subconjunto del protocolo IRC (cliente-servidor).
- Características
- Comandos soportados
- Compilación
- Ejecución
- Conectarse con un cliente IRC
- Estructura del proyecto
- Notas
- Recursos
- Servidor TCP con múltiples clientes (single-process, orientado a eventos)
- Conexiones protegidas por contraseña
- Flujo de registro de usuario (
PASS,NICK,USER) - Gestión de canales (join/leave, invite-only, topic, operadores, etc.)
- Mensajería privada
- Respuestas numéricas IRC (ver
includes/IrcCodes.hpp) - Bonus: bot simple (ver
sources/Commands/Bot_bonus.cpp)
Los handlers de comandos están en sources/Commands/:
- Registro:
PASS,NICK,USER - Sesión:
QUIT - Mensajería:
PRIVMSG - Canales:
JOIN,INVITE,KICK,TOPIC,MODE
Nota: los clientes IRC pueden enviar secuencias de comandos diferentes. Si tienes problemas para conectar, asegúrate de enviar
PASScon la contraseña correcta y completar el registro conNICKyUSER.
Desde la raíz del repositorio:
makeEsto genera el binario ircserv.
Otros targets útiles (si están definidos en el Makefile):
make re
make fclean./ircserv <puerto> <password><puerto>: puerto de escucha (por ejemplo6667)<password>: contraseña requerida por los clientes mediantePASS
Ejemplo:
./ircserv 6667 mypasswordnc 127.0.0.1 6667
PASS mypassword
NICK alice
USER alice 0 * :Alice
JOIN #42
PRIVMSG #42 :hola desde ncConfigura:
- Servidor/Host:
127.0.0.1 - Puerto: el
<puerto>elegido - Password del servidor: el
<password>con el que arrancasteircserv
Luego únete a un canal, por ejemplo: /join #42.
.
├── includes/
│ ├── Server.hpp # clase principal del servidor
│ ├── Client.hpp # estado del cliente
│ ├── Channel.hpp # estado del canal
│ ├── ChannelRules.hpp # modos / permisos del canal
│ ├── Topic.hpp # gestión del topic
│ └── IrcCodes.hpp # códigos / replies numéricos
├── sources/
│ ├── main.cpp
│ ├── Server*.cpp # socket + loop principal y utilidades
│ ├── Parsing.cpp # helpers de parseo
│ ├── SplitString.cpp
│ └── Commands/ # implementación de comandos
├── Makefile
└── en.subject.pdf
- Implementación educativa: no está pensada como un IRCd para producción.
- Para ampliarlo, un buen siguiente paso es añadir nuevos handlers en
sources/Commands/y registrarlos en el dispatcher de comandos del servidor.