A lightweight Internet Relay Chat (IRC) server implementation written in C++98, following the IRC protocol specifications. This project is part of the 42 school curriculum, challenging students to create a basic IRC server that implements the IRC protocol.
- Architecture Overview
- Features
- Requirements
- Building
- Usage
- Project Structure
- Testing
- Cleaning
- License
- Helpful Resources
graph TD
A[Client] -->|TCP Connection| B[Server]
B -->|Authentication| C[Client Handler]
C -->|Join/Part| D[Channel Manager]
C -->|Messages| E[Message Handler]
E -->|Private Message| F[Client-to-Client]
E -->|Channel Message| G[Channel-to-Clients]
H[Command Parser] -->|Parse| E
I[Socket Manager] -->|Accept| B
D -->|Broadcast| G
style B fill:#f9f,stroke:#333,stroke-width:4px
style D fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
- Standard IRC server functionality
- Channel management
- Client-to-client communication
- Channel operations (join, leave, messaging)
- User authentication
- Compliant with C++98 standards
- C++ compiler with C++98 support
- Make
- Linux/Unix-based system
To build the IRC server, simply run:
makeThis will create the executable ircserv in the root directory.
For development with debug symbols and sanitizers:
- Address Sanitizer
- Leak Sanitizer
- Undefined Behavior Sanitizer
are already configured in the Makefile.
To start the server:
./ircserv <port> <password>Where:
<port>: The port number on which the server will listen<password>: The connection password for the server
src/Server.cpp/hpp: Core server implementationsrc/Client.cpp/hpp: Client handling and managementsrc/Channel.cpp/hpp: Channel operations and managementsrc/server_commands.cpp: IRC command implementationssrc/main.cpp: Entry point and server initialization
You can connect to the server using any standard IRC client. Some recommended clients:
- irssi
- WeeChat
- HexChat
make clean: Remove object filesmake fclean: Remove object files and executablemake re: Rebuild the project
This project is licensed under the MIT License - see the LICENSE file for details.
- RFC 1459 - Internet Relay Chat Protocol (Original)
- 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
- Beej's Guide to Network Programming - Essential guide for socket programming
- Linux Manual: poll(2) - Documentation for poll()
- Linux Manual: socket(2) - Documentation for socket operations
- ft_irc Guide on Medium - Detailed guide for implementing ft_irc project
Common IRC commands implemented in this project:
/nick <nickname>- Set or change nickname/join #<channel>- Join a channel/privmsg <target> <message>- Send message to user or channel/part #<channel>- Leave a channel/quit [message]- Disconnect from server/kick #<channel> <nickname>- Remove user from channel/mode #<channel> <modes> [args]- Set channel modes
- Start with basic socket communication
- Implement user authentication first
- Add basic command parsing
- Implement channels one feature at a time
- Test extensively with different IRC clients
- Use poll() for handling multiple clients
- Remember to handle partial messages correctly