A sophisticated Internet Relay Chat (IRC) server implementation in C++98, featuring advanced network programming, comprehensive protocol compliance, and production-quality architecture.
- Non-blocking I/O with
select()multiplexing for scalable concurrent client handling - Socket programming with proper error handling and resource management
- Persistent connection management with graceful cleanup and disconnect detection
- Partial command buffering for robust network packet handling
- Multi-stage authentication (PASS β NICK β USER) with state validation
- Channel operator system with elevated privileges
- Comprehensive channel modes:
+i(invite-only),+t(topic protection),+k(key),+o(operator),+l(limit) - Invite-only channel management with sophisticated access control
- Full RFC2812 compliance with proper IRC message formatting
- Complete numeric response codes (401, 403, 431, 432, 433, 442, etc.)
- Hostmask implementation (
nick!user@host) in all messages - Multi-channel operations with comma-separated JOIN commands
| Command | Description | Advanced Features |
|---|---|---|
PASS |
Server authentication | Password validation |
NICK |
Nickname management | Conflict resolution with auto-modification |
USER |
User registration | Complete userinfo handling |
JOIN |
Channel joining | Multi-channel, key support, mode checking |
PART |
Channel leaving | Multi-channel departure |
PRIVMSG |
Messaging | Channel and private messages |
TOPIC |
Topic management | Operator restrictions, timestamps |
MODE |
Channel/user modes | All 5 IRC modes implemented |
KICK |
User removal | Operator privilege checking |
INVITE |
User invitation | Invite-only channel support |
QUIT |
Clean disconnection | Broadcast to common channels |
- ποΈ Dynamic channel creation - Channels created on first JOIN
- π Automatic operator assignment - First user becomes operator
- π§Ή Smart cleanup - Empty channels automatically removed
- π’ Efficient broadcasting - Optimized message distribution algorithms
- π Nickname propagation - Cross-channel nickname updates
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Server β β Client β β Channel β
β (Socket Mgmt) βββββΊβ (Auth State) βββββΊβ (User Mgmt) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β CommandHandler β β RFC2812Handler β β Utilities β
β (Cmd Dispatch) β β (Protocol Msgs) β β (Validation) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Command Registry Pattern - Modular command dispatch system
- State Machine - Client authentication flow management
- Observer Pattern - Channel event broadcasting
- RAII - Resource management and cleanup
- C++ compiler with C++98 support
- Make build system
- Unix-like environment (Linux/macOS)
# Clone and build
git clone https://github.com/lgeniaux/ft_irc
cd ft_irc
make
# Start the server
./ircserv <port> <password>
# Example
./ircserv 6667 mypassword# Install irssi (if needed)
sudo apt install irssi # Ubuntu/Debian
brew install irssi # macOS
# Connect to your server
irssi
/connect localhost 6667 mypassword
/join #general
/msg #general Hello from my IRC server!/join #dev,#general,#random key1,key2
/part #dev,#general
/mode #channel +itk secretkey
/invite friend #private-channel
/kick #channel troublemaker
/topic #channel New topic here
/mode #channel +o friend
- Single-threaded design using
select()for I/O multiplexing - Non-blocking sockets to prevent server blocking on client operations
- Event-driven architecture for handling multiple simultaneous connections
- Graceful error handling with proper socket cleanup
- C++98 compliant memory management without modern smart pointers
- STL containers for efficient data structure management
- RAII principles for automatic resource cleanup
- No memory leaks - comprehensive resource management
- β
Strict compilation with
-Wall -Wextra -Werror - β Modular architecture with clear separation of concerns
- β Comprehensive error handling for network and protocol errors
- β Professional build system with dependency tracking
- β Signal handling for graceful server shutdown
- Scalable: Handles multiple concurrent clients efficiently
- Low latency: Direct message routing without unnecessary delays
- Memory efficient: Optimized data structures for minimal overhead
- Robust: Comprehensive error handling and recovery
This project demonstrates mastery of:
- Systems Programming - Low-level network programming in C++
- Protocol Implementation - Standards compliance and message formatting
- Concurrent Programming - Multi-client handling without threading
- Software Architecture - Clean, modular design patterns
- Resource Management - Memory and socket lifecycle management
ft_irc/
βββ src/
β βββ Server.cpp # Core server implementation
β βββ Client.cpp # Client state management
β βββ Channel.cpp # Channel operations
β βββ RFC2812Handler.cpp # Protocol compliance
β βββ commands/ # Individual IRC commands
βββ include/ # Header files
βββ Makefile # Build configuration
- Hierarchical Makefiles for modular compilation
- Automatic dependency tracking for efficient rebuilds
- Colored output for professional development experience
Built with β€οΈ and lots of β at Γcole 42
Showcasing advanced C++ systems programming and network protocol implementation
