ft_irc is a custom Internet Relay Chat (IRC) server written in C++98. The project aims to recreate a functional chat server capable of handling multiple simultaneous connections without crashing or blocking. It implements a non-blocking network architecture using I/O multiplexing with poll(), allowing it to serve multiple clients across various channels in real-time.
The server is compatible with official IRC clients (like HexChat, AdiIRC, or Irssi) and follows the communication standards defined in RFC 2812.
- Authentication: Secure connection using a server password and nickname/username registration.
- Channel Management: Create, join, and leave multiple channels simultaneously.
- Operator Privileges: KICK, INVITE, TOPIC, and MODE commands to manage users and channel settings.
- Channel Modes:
i: Invite-only channel.t: Topic restrictions for operators.k: Channel key (password).o: Give/take channel operator privilege.l: Set user limit for the channel.
- Private Messaging: Direct messages between users and notices.
- Blackjack Bot: A fully integrated game bot with IRC color formatting and score tracking.
make bot
./srcs/bot/bot 127.0.0.1 <port> <password>The project uses a Makefile and must be compiled on a Unix-based system.
makeRun the server by specifying a port (usually 6667) and a password for client connections.
./ircserv <port> <password>
- Open an IRC client (e.g., HexChat).
- Create a new network with the address
127.0.0.1and the chosen port. - Enter the password you used to launch the server.
- Join a channel using
/join #chan_name.
- Open an IRC client (e.g., HexChat).
- Create a new network with the address
127.0.0.1and the chosen port. - Enter the password you used to launch the server.
- Join a channel using
/join #bot. - !ping or !blackjack > (!hit or !stand)
- RFC 2812: The official Internet Relay Chat: Client Protocol.
- RFC 1459: Original IRC Protocol specifications.
- geeksforgeeks.org Socket Programming in C++: Essential resource for socket programming in C++.
- Protocol Debugging: Resolving issues with GUI clients (HexChat) by identifying missing mandatory numerical replies (
RPL_NAMREPLY,RPL_ENDOFNAMES).
- Multiplexing: Utilized
poll()for managing multiple file descriptors to ensure high responsiveness and efficiency. - Non-blocking Sockets: All client sockets are set to
O_NONBLOCKto prevent the server from hanging during slow read/write operations. - STL Containers: Heavy use of
std::mapandstd::vectorto efficiently manage the relationships between clients and channels.
