SoulSpark
Software
www.skarnet.org
The tcpping program
tcpping is a basic utility that checks network connectivity by
attempting TCP connections on a list of servers until one succeeds.
Interface
tcpping [ -x | -X ] [ -T x+y ] ip:port [ ip:port ... ]
- tcpping attempts a TCP connection on every (ip,
port) couple given on the command line. It exits 0 as soon as
one succeeds.
- tcpping first tries all servers with a x-second
timeout, then, if +y is specified, it performs a second
pass with a y-second timeout. By default, x is 2 and
y is 58.
- If all servers fail or timeout, tcpping exits 1.
Options
- -x : strict mode. tcpping will report failure
for a server if a connection attempt fails with ECONNRESET. This is
the default, and also the safest mode. To check network connectivity,
first make sure that the conctacted ip/ports are open.
- -X : loose mode. tcpping will report
success if a connection attempt fails with ECONNRESET.
Rationale: ECONNRESET means good probability of tcpping
being able to reach ip, but nothing listening on port,
which means that the machine at ip is alive and reachable
anyway. But there's also a slim chance that some obnoxious filtering
router along the way is rejecting your packets with TCP RST, and you are
actually not able to reach ip.