Cross-platform active TCP and UDP socket scanner for .NET, inspecting listening ports, established connections, and binding owning process metadata across Windows and Linux.
📖 Framework Documentation: English Specification | Spécification en français
- Native Kernel Inspections:
- Windows: Uses Win32 IP Helper API (
GetExtendedTcpTable,GetExtendedUdpTable) for fast, non-blocking enumeration of IPv4 and IPv6 sockets. - Linux: Parses kernel virtual filesystem entries (
/proc/net/tcp,/proc/net/tcp6,/proc/net/udp,/proc/net/udp6).
- Windows: Uses Win32 IP Helper API (
- Process Attribution: Binds local network endpoints to the specific process ID (PID) and process metadata responsible for network communication.
- Full Socket State Coverage:
- Listening endpoints (
Listen,Bind). - Active connections (
Established,TimeWait,CloseWait,SynSent).
- Listening endpoints (
- IPv4 & IPv6 Dual-Stack Support: Transparent handling of both IPv4 and IPv6 network sockets.
Add the package via the .NET CLI:
dotnet add package SocketForge --version 2.1.1using SocketForge.Factories;
// Keep one scanner for as long as you scan: it caches the processes it has already resolved and, on Linux,
// which process holds each socket.
var scanner = SocketScannerFactory.Create();
var sockets = await scanner.ScanSocketsAsync();
foreach (var socket in sockets)
{
Console.WriteLine($"[{socket.Protocol}] {socket.LocalEndpoint} -> {socket.RemoteEndpoint} (PID: {socket.Process.ProcessId}, State: {socket.State})");
}This project is licensed under the MIT License.