Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 ft_irc

Minimal IRC server written in C++ — networking, sockets, and protocol parsing


About

ft_irc is a small, student-implemented IRC server that reproduces the core behavior of the Internet Relay Chat protocol (RFC 1459 and common extensions) for learning purposes. The project focuses on:

  • low-level network programming with sockets,
  • concurrent client handling with non-blocking I/O (poll/select),
  • parsing and executing IRC commands,
  • implementing channel and user state management,
  • robust error handling and graceful disconnects.

See the project subject in the repository for the full specification and mandatory behaviour.

Requirements

  • A POSIX-compatible system (Linux, macOS)
  • C compiler (gcc / clang)
  • Make (Makefile provided)
  • No external libraries required (uses standard libc and POSIX APIs)

Build

From the project root:

$ make

This will produce the server binary (e.g. ircserv). Standard Make targets are available:

  • make — build
  • make clean — remove object files
  • make fclean — remove objects and binaries
  • make re — fclean + make

Usage

Start the server:

$ ./ircserv <port> <password>

Example:

$ ./ircserv 6667 secretpass

Connecting with an IRC client:

  • Using hexchat / irssi:

    /connect -password secretpass 127.0.0.1 6667

  • Using netcat / telnet for manual tests (raw protocol):

$ nc -C 127.0.0.1 6667
NICK mynick
USER mynick 0 * :Real Name

After registering (NICK + USER), you can JOIN channels and send messages:

JOIN #channel
PRIVMSG #channel :Hello, world!
PART #channel

The server expects commands terminated by CRLF (\r\n) and follows common IRC reply conventions where applicable.

Features

Implemented behavior typically includes:

  • Accepting multiple simultaneous client connections
  • Non-blocking I/O and efficient polling loop (select/poll)
  • Parsing and handling of core IRC commands:
    • NICK, USER, JOIN, PART, PRIVMSG, NOTICE, PING/PONG, QUIT
  • Channel creation and membership management
  • Basic message routing between users and channels
  • Graceful client disconnect and resource cleanup
  • Simple validation and error replies to malformed commands

Behaviors implemented:

  • MODE (channel and user modes)
  • TOPIC
  • KICK
  • INVITE
  • TOPIC, CHANLIMITS and channel creation rules
  • Registration timeout

Testing

  • Manual tests with netcat / telnet as above
  • Connect multiple clients and verify message routing and channel state
  • Verify server handles abrupt client disconnects and malformed input
  • Optionally use an IRC client (irssi/weechat) for interactive testing

What I Learned

  • First time used Test Driven Development and I saw how it can help me focus my thought and build robust programs
  • Low-level network programming with sockets (bind, listen, accept)
  • Non-blocking I/O and multiplexing with poll/select
  • Protocol design and robust parsing of line-based protocols
  • Managing shared server state (users, channels) safely in an event loop
  • Debugging networking issues (partial reads/writes, disconnected peers)
  • Designing simple but resilient command handling and error reporting

About

Implementing servers base on Internet Relay Chat protocol

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages