Sunday, January 31, 2010

tcping for Linux

tcping does a TCP connect to the given ip/port combination. The user can specify a timeout in seconds. This is useful in shell scripts running in firewalled environments. Often SYNs are just being dropped by firewalls, thus connection establishment will be retried several times (for minutes) until a TCP timeout is reached. With tcping it is possible to check first if the desired port is reachable and then start connection establishment.

Exit codes:

  • -1: an error occured.
  • 0: port is open
  • 1: port is closed
  • 2: user timeout
Syntax: tcping [-q] [-t timeout_sec] [-u timeout_usec]

  • -q : quiet mode, do not output anything (except error messages)
  • -t : timeout in seconds
  • -u : timeout in microseconds
Download tcping for Linux:

tcping runs under Linux, OpenBSD, Solaris 7/8/9, Solaris 2.6, AIX, and maybe others. Just try.

See also:

1 comment: