Security · Beginner
Build a Port Scanner
Build a tool that scans a host for open TCP ports concurrently with configurable ranges, timeouts, and a clean summary report.
This project is a network port scanner that, given a hostname or IP and a range of ports, attempts a TCP connection to each port and reports which ones are open. You add concurrency so hundreds of ports are probed in parallel, configurable timeouts so closed ports do not stall the scan, and a readable report of the results. It is worth building because it teaches socket programming, TCP connection semantics, and concurrency patterns that are foundational for both backend and security work. A working scanner is a tangible demonstration that you understand how network services are reached and how to do parallel I/O without blocking, which is exactly the kind of fundamentals security and infrastructure interviewers probe.
What you build
- Accepts a target host and a port or port range to scan
- Attempts a TCP connect to each port and classifies it as open or closed
- Runs scans concurrently using threads, goroutines, or async I/O
- Applies a configurable connection timeout per port
- Prints a clean report listing only the open ports and the service names
- Defaults to a sensible common-ports range when none is specified
- Handles unreachable hosts and DNS resolution failures gracefully
What it teaches
- TCP socket programming and connection semantics
- Concurrency with thread pools, goroutines, or async I/O
- Setting and reasoning about network timeouts
- Bounding parallelism to avoid exhausting resources
- Graceful handling of network and DNS errors
Sign in to open the build guide
Free account. Get the step-by-step build and every resource link.
Take it further
- Add a simple banner grab that reads the first bytes a service sends on connect.
- Scan multiple hosts or a CIDR range and aggregate the results.
- Add UDP scanning, accounting for its connectionless and less reliable nature.


