In this post, I want to share a small TCP port scanner in C#. It tries many ports at once, uses a timeout for each one, and can grab banners and print JSON. The whole program is about 160 lines.
For real work, nmap does all of this better. But writing a connect scanner yourself shows how TCP behaves when a port is open, closed or filtered, and how much t…




