All Products
Search
Document Center

MaxCompute:TCPING

Last Updated:Apr 01, 2026

The TCPING function checks if a specific port on a target domain name or ip address is reachable.

Usage notes

  • Ensure that the domain name or ip address is a public address.

  • Ensure that the target domain name or ip address is added to the MaxCompute External Network configuration. For instructions, see Enable network access.

  • Before using the function, run the SET odps.internet.access.list=<url:port>; command. To access multiple domain names or ports, separate them with commas.

Syntax

STRING TCPING(STRING <url>, BIGINT <port>)

Parameters

  • url: Required. The public domain name or ip address to check.

  • port: Required. The port to check on the specified host.

Return value

Returns a BOOLEAN value. The function returns NULL if any of the following conditions are met:

  • If url is NULL, the function returns NULL.

  • If port is NULL, the function returns NULL.

Examples

-- The destination is added to the MaxCompute external network configuration. Returns true.
SET odps.internet.access.list= www.aliyun.com:80;
SELECT TCPING('www.aliyun.com',80);

-- The destination is not added to the MaxCompute external network configuration. Returns false.
SET odps.internet.access.list=www.aliyun.com:80;
SELECT TCPING('www.aliyun.com',80);

-- Returns NULL.
SET odps.internet.access.list=www.aliyun.com:80;
SELECT TCPING('www.aliyun.com',NULL);

-- Returns NULL.
SET odps.internet.access.list=www.aliyun.com:80;
SELECT TCPING(NULL,80);