Overview
A single-file exercise in raw socket programming. For each port the scanner opens a socket, sets send and receive timeouts with setsockopt, attempts connect(), reports open ports and closes the descriptor. Progress is printed every 5000 ports and a summary at the end. It is intentionally small: a study of the POSIX socket API rather than a replacement for nmap.
Highlights
- Full range scan with bounded per-port latency via SO_RCVTIMEO and SO_SNDTIMEO.
- Roughly sixty lines, no dependencies beyond the C standard library and POSIX headers.