Zachary's Blog

Sockets in C

About This Project

This project is three small servers written in C on the raw BSD sockets API. Each server adds one idea on top of the last.

The daytime server does one thing: connect to it and it sends back the current date and time, then hangs up. The chat room lets several people talk at once; one select() loop watches every connection and hands each message to everyone else. The web server serves files from its www/ folder over HTTP: it reads each request, refuses paths that try to escape the folder, and sends back the matching file or an error page.

Source: github.com/zevlo/sockets Screenshot: the web server’s self-referential index page

Technologies Used