TCP Port Ping
Repeatedly connect to a TCP host and port and report latency.
Requires Python 3.13 or newer. The runtime is the standard library only.
Install
pip install lupaxa-tcp-port-ping
tcp-port-ping --help
CLI
tcp-port-ping --server example.com --port 80
tcp-port-ping -s example.com -p 443 -d 1
tcp-port-ping -s 192.0.2.10 -p 22 --count 5 --timeout 0.5
python -m lupaxa.tcp_port_ping --version
The tool opens a TCP connection, times the handshake, closes it, and
repeats after --delay seconds (default 1). --server and --port
are required. --timeout bounds the socket (default 1 second). Omit
--count to run until Ctrl-C. A successful probe prints
Connected to <host>[<port>]: tcp_seq=<n> time=<ms> ms. Timeouts
print Connection timed out!. A refused port prints
Port is closed!!!. The summary is
TCP Ping Results: Connections (Total/Pass/Fail): [T/P/F] (Failed: N%).
Ctrl-C prints that summary immediately and exits 0.
Flags
| Flag | Default | Description |
|---|---|---|
--server |
required | Hostname or IP address (-s) |
--port |
required | TCP port (1–65535, -p) |
--delay |
1 |
Seconds between probes (0 or more, -d) |
--count |
run until interrupted | Number of probes (-c) |
--timeout |
1 |
Socket timeout in seconds (-T) |
--version |
— | Print the package version and exit |
--timeout must be greater than 0. --count must be greater than
0 when set.
Exit Codes
| Code | When |
|---|---|
0 |
Help, version, Ctrl-C, or every --count probe succeeded |
1 |
Invalid arguments, or at least one --count probe failed |
Examples
HTTPS:
tcp-port-ping --server example.com --port 443
Five SSH probes, half-second timeout (exit 1 if any fail):
tcp-port-ping -s 192.0.2.10 -p 22 --count 5 --timeout 0.5
Back-to-back local probes (--delay 0 is valid):
tcp-port-ping -s 127.0.0.1 -p 8080 --delay 0 --count 10 --timeout 0.2
Library
from lupaxa.tcp_port_ping import probe_tcp_port, run_probes
one = probe_tcp_port("example.com", 443, timeout=1.0)
print(one.ok, one.elapsed_ms, one.detail)
summary = run_probes("example.com", 443, count=3, delay=0)
print(summary.total, summary.passed, summary.failed, summary.fail_percent)
probe_tcp_port returns a ProbeResult with ok, host, port,
sequence, elapsed_ms, and detail. Host whitespace is stripped.
detail is a short lowercase reason (connected,
connection timed out, port is closed, or OS error: …). The CLI
maps those strings to the ping-style wording above. Refused ports,
timeouts, and socket errors return ok=False instead of raising.
run_probes returns a ProbeSummary (total, passed, failed,
fail_percent, results) and defaults to one probe. Pass
count=None to run until should_stop or forever. Invalid host,
port, timeout, delay, or count raises ValueError.
Development
make init
make python-install-dev
make python-check
Metadata
Release files for lupaxa-tcp-port-ping 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lupaxa_tcp_port_ping-0.1.4.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lupaxa_tcp_port_ping-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / lupaxa_tcp_port_ping-0.1.4.tar.gz
| Download URL | lupaxa_tcp_port_ping-0.1.4.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f7b3fe478e7d6aa7aeb929f9bb638de9acd4e87cac98baf29cd698ca78884fd
|
|
BLAKE2b-256 checksum How to use checksums |
6eca14e3b41c4fb3b568a08e87ee8c9edb627771d047042d426f1710b458d349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency logRelease files / lupaxa_tcp_port_ping-0.1.4-py3-none-any.whl
| Download URL | lupaxa_tcp_port_ping-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
764f01206529c425a3a8fd41ed2221d075d2eaf1fab44c344266ca2d1d6b3be9
|
|
BLAKE2b-256 checksum How to use checksums |
c506ea3b743c3410345f6ea0c8e7b8943b42e8394efc732de936815208831149
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.
Transparency log