Files for ECEN 602
Most of the programs have simple makefiles to build, and are wrapped in nix derivations for convenience. If you don't have nix installed, you can cd to a Machine Problem directory, run make and then run the applications.
Simple TCP echo server according to RFC 862 and a basic client
Server command: nix run .#echos <port>
Client command: nix run .#echo <server> <port>
Simple Broadcast Chat Server accoring to the Design doc with all extra features implemented
Server command: nix run .#sbcp_server <ip> <port> <max_clients>
Client command: nix run .#sbcp_client <username> <server> <port>
TFTP server per RFC 1350 with netascii support
Server command: nix run .#tftp_server (serves on port 8080)
HTTP client, proxy, and server built on libhttp
Client command: nix run .#http_client <proxy> <port> <url>
Proxy command: nix run .#http_proxy <ip> <port>
Server command: nix run .#http_server <port>
Each server is packaged as a NixOS module under services.ecen602.*, available
via the flake's nixosModules output:
{
imports = [ inputs.ecen602.nixosModules.default ];
services.ecen602 = {
echos.enable = true;
sbcp.enable = true;
tftp.enable = true;
http-server.enable = true;
http-proxy.enable = true;
};
}Every module supports package, port/listen-address options, and
openFirewall. The SBCP server and HTTP proxy accept IPv4 or IPv6
listenAddress literals (IPv4 is mapped automatically).
The MPs are exercised end-to-end by NixOS integration tests running in
systemd-nspawn containers (tests/):
nix flake check # lint + all tests
nix build -L .#checks.x86_64-linux.mp2-sbcp-chat # single testContainer tests boot in ~2-3s each and need no KVM. The Nix daemon on the machine running them requires:
nix.settings = {
experimental-features = [ "auto-allocate-uids" "cgroups" ];
auto-allocate-uids = true;
extra-system-features = [ "uid-range" ];
};