Skip to content
ENExplore Calculators

Socket Count Calculator

Calculate maximum concurrent socket connections supportable by system file descriptor limits.

About Socket Count Calculator

A system's total socket footprint spans several distinct kernel-tracked states and families: actively transferring TCP connections (ESTABLISHED), recently closed TCP connections still holding their port reserved (TIME_WAIT), connectionless UDP sockets, and local-only Unix domain sockets used for IPC. Summing these gives the total socket-table pressure a host is under, which matters for both file-descriptor budgeting and kernel memory (each socket carries buffer overhead) — a high TIME_WAIT share in particular often signals a high connection-churn workload that could benefit from connection reuse or tuned tcp_tw_reuse.

Formula

Total socket count

total = tcp_established + tcp_time_wait + udp + unix

C_{est}
TCP ESTABLISHED
C_{tw}
TCP TIME_WAIT
U
UDP sockets
X
Unix domain sockets

Worked example

With the default values below, Socket Count Calculator returns Total Open Sockets of 630. Change any input above and every figure here is recalculated in your browser.

Inputs used

TCP ESTABLISHED (ss -t state established | wc -l)minimum 0
320
TCP TIME_WAITminimum 0
180
UDP Socketsminimum 0
40
Unix Domain Socketsminimum 0
90

Results

Total Open Sockets
630
TCP Sockets (established + time_wait)
500
TIME_WAIT Share of Total
28.6%

Step by step

  1. 1Values used
  2. 2Total socket count
  3. 3Total Open Sockets= 630
  4. 4TCP Sockets (established + time_wait)= 500
  5. 5TIME_WAIT Share of Total= 28.6

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How do I get these counts on a live system?

`ss -tan state established | wc -l`, `ss -tan state time-wait | wc -l`, `ss -uan | wc -l`, and `ss -xan | wc -l` give established TCP, TIME_WAIT TCP, UDP, and Unix socket counts respectively (subtract 1 from each for the header line if using `ss` without `-H`).

Why does a high TIME_WAIT count matter?

Each TIME_WAIT socket holds a local port tied up for 2×MSL (commonly ~60s on Linux) after close, and under very high connection churn this can exhaust the ephemeral port range or add measurable kernel memory overhead — tunable via `net.ipv4.tcp_tw_reuse` and shortened FIN timeouts, though outright disabling TIME_WAIT is not recommended as it protects against delayed duplicate segments.

Do Unix domain sockets count against the same limits as TCP/UDP sockets?

Yes — all socket types share the same per-process file descriptor budget (ulimit -n) and contribute to overall kernel socket-buffer memory, even though Unix domain sockets never touch the network stack or consume ephemeral ports.

Socket Count Calculator – Calculate Total Open Sockets