Systems · 2026

chatd

Single-threaded poll()-based TCP chat server in C, valgrind-clean

Complete · source available

Overview

A multi-client chat server with commands /nick, /me, /who, /help and /quit. The README explains the select() and epoll() trade-offs and the “one recv is not one message” framing bug.

Highlights

  • 123 unit checks under ASan/UBSan and 54 integration checks over real sockets, including 40 simultaneous clients and a non-reading client dropped while others keep receiving.
  • valgrind full-lifecycle run: 87 allocs / 87 frees, 0 errors.
  • Per-client input and output buffers are hard-capped, so a client that never sends a newline or never reads cannot exhaust the server.