You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C++ implementation of RFC-compliant IRC server utilizing socket programming with non-blocking I/O via select(). Features client-server architecture supporting concurrent connections, channel operations, private messaging, user authentication, and operator privileges with full command parsing and execution.
IRC (Internet Relay Chat) is a networking project at 42 School that challenges students to implement a functional IRC server from scratch. This text-based communication protocol, created in 1988, remains a fundamental example of client-server architecture and real-time messaging systems.
"This project is about creating your own IRC server. You will use an actual IRC client to connect to your server and test it. Internet is ruled by solid standards protocols that allow connected computers to interact with each other."
This project explores socket programming, client-server architecture, protocol implementation, and concurrent programming concepts.
π― Project Objectives
Implement a fully functional IRC server according to RFC specifications
Handle multiple client connections simultaneously using non-blocking I/O
Process and respond to standard IRC commands
Manage channels, private messages, operators, and user privileges
Implement proper error handling and client validation
Create a robust and scalable server architecture
Gain deep understanding of network protocols and socket programming
π IRC Protocol: An Overview
IRC is a text-based communication protocol that follows a client-server model, allowing real-time messaging between users in channels or privately:
Socket programming with non-blocking I/O using select()
Client
Represents a connected user
State machine tracking authentication and activity
Channel
Manages group conversations
Collection of members with permission levels
CommandHandler
Processes IRC commands
Command pattern with function map dispatch
Message
Parses and formats IRC messages
RFC-compliant formatting and validation
Networking Model
Aspect
Implementation
Notes
Socket Type
TCP/IP
Reliable, ordered delivery
I/O Model
Non-blocking with select()
Efficient handling of multiple clients
Buffer Management
Input/output queues per client
Handles partial reads/writes
Connection State
State tracking per client
Registration, authentication, channels
π‘ Technical Approach
My implementation focuses on correctness, performance, and maintainability:
1. Architecture Design
Event-driven model for high concurrency
Non-blocking I/O for efficient resource usage
Modular class design for maintainability
Separation of concerns between components
2. Protocol Compliance
RFC 1459/2812 implementation
Proper error codes and messages
Complete command set support
Input validation and sanitization
3. Performance Considerations
Efficient data structures for user and channel lookup
Minimal memory footprint per connection
Optimized message parsing and generation
Connection timeouts and resource limits
π§ Implemented Commands
Category
Commands
Connection
NICK, USER, PASS, QUIT, PING, PONG
Channel Operations
JOIN, PART, TOPIC, NAMES, LIST
Messaging
PRIVMSG, NOTICE
Channel Control
MODE, KICK, INVITE
Server Information
MOTD, VERSION, INFO, TIME
User Information
WHO, WHOIS, WHOWAS
πΌ Skills Developed
Socket programming and network I/O
Concurrent programming with non-blocking I/O
Protocol design and implementation
C++ design patterns and object-oriented programming
Memory management and resource optimization
Error handling and robust programming
RFC specification interpretation and implementation
π Key Features
Full RFC compliance with core IRC features
Robust error handling with appropriate error codes
Channel operations including modes and privileges
User authentication and operator privileges
Private messaging between users
Efficient networking with non-blocking I/O
Clean architecture with separation of concerns
π Project Stats
Metric
Value
Final Score
100/100
Lines of Code
~3000
Classes
5 core classes
Commands Implemented
5+ IRC commands
Completion Time
4 weeks
About
C++ implementation of RFC-compliant IRC server utilizing socket programming with non-blocking I/O via select(). Features client-server architecture supporting concurrent connections, channel operations, private messaging, user authentication, and operator privileges with full command parsing and execution.