Wait for TCP Port icon

Wait for TCP Port

Wait until a TCP port accepts connections

Wait for TCP Port

AI-generated

Summary

Polls a TCP host and port until a connection succeeds or the timeout expires, then outputs a status object. Use it to pause a workflow until a service, such as a rebooted server or a starting container, accepts connections.

Inputs

  • host (required) — DNS name or IP address to connect to. Leading and trailing whitespace is trimmed.
  • port — TCP port to check, 1–65535 (default 22).
  • timeoutSeconds — Maximum total seconds to keep retrying, 1–86400 (default 120).
  • retryIntervalMs — Delay in milliseconds between connection attempts, 100–60000 (default 1000).
  • connectionTimeoutMs — Milliseconds before a single connection attempt counts as failed, 100–60000 (default 1000).
  • timeoutBehavior — What happens if the port is still unreachable at the deadline. 'Throw Error' (default) fails the item. 'Return Timeout Status' outputs a result with status 'timeout'.

Output shape

One output item per input item. Each has a waitForTcpPort object with host, port, status ('reachable' or 'timeout'), reachable (boolean), attempts, elapsedMs, and lastError (the last connection error message, if any).

Parameters are evaluated and the check runs separately for each input item, in sequence. With 'Throw Error' and a timeout, the node throws a NodeOperationError, unless Continue On Fail is enabled. In that case the item becomes {error: message}. The lastError field is absent when the first attempt succeeds. The final retry delay is capped to the time remaining, so total runtime stays close to the timeout. The check only opens a TCP connection and then closes it. It sends no data and does not verify that the application on the port works.

Examples

Example 1: Wait for a rebooted server's SSH port before running the next step.

Host: 192.168.1.20, Port: 22, Timeout: 300 s, Retry Interval: 2000 ms, Timeout Behavior: Throw Error.

Example 2: Check whether a database is up and branch on the result without failing the workflow.

Host: db.internal, Port: 5432, Timeout: 30 s, Timeout Behavior: Return Timeout Status; follow with an IF node on {{$json.waitForTcpPort.reachable}}.

Links

Discussion