Ismail El Abbassi
IRC server interface

Systems · C++2025

IRC server

A lightweight IRC server that real clients will connect to.

poll()

One loop, non-blocking sockets

RFC 1459

Real clients connect

C++98

Server, Client, Channel

Overview

An IRC server in C++ implementing enough of RFC 1459 that off-the-shelf clients like WeeChat connect to it and behave normally. That constraint is the whole point of the exercise: you cannot fake protocol compliance when the client on the other end was written by someone else and does not care about your excuses.

I was responsible for the networking layer and the core of the server. Everything runs single-threaded on one poll() loop over non-blocking sockets, so a slow client can never stall another — there is no thread per connection to hide behind. On top of that sit the Server, Client and Channel types, registration through PASS / NICK / USER, channel membership, and message routing. My teammate handled the channel-operator side.

What it does

  • 01A single-threaded poll() event loop over non-blocking sockets, so one slow client cannot stall the rest
  • 02Registration handshake — PASS, NICK, USER — with the numeric replies clients expect
  • 03Channels with JOIN, membership tracking, TOPIC and MODE
  • 04Private and channel messaging through PRIVMSG, routed to the right set of sockets
  • 05Operator commands: KICK and INVITE
  • 06Partial-command buffering, because TCP delivers bytes and not messages
  • 07A bot bolted onto the server as a bonus