Edit

Share via


sys.dm_tcp_listener_states (Transact-SQL)

Applies to: SQL Server

Returns a row containing dynamic-state information for each TCP listener.

Note

The availability group listener could listen to the same port as the listener of the instance of SQL Server. In this case, the listeners are listed separately, the same as for a Service Broker listener.

Column name Data type Description
listener_id int Listener's internal ID. Not nullable.

Primary key.
ip_address nvarchar(48) The listener IP address that's online and currently being listening to. Can be either IPv4 or IPv6. If a listener possesses both types of addresses, they're listed separately. An IPv4 wildcard is displayed as 0.0.0.0. An IPv6 wildcard is displayed as ::.

Not nullable.
is_ipv4 bit Type of IP address. One of:

1 = IPv4
0 = IPv6
port int The port number on which the listener is listening. Not nullable.
type tinyint Listener type, one of:

0 = Transact-SQL
1 = Service Broker
2 = Database mirroring

Not nullable.
type_desc nvarchar(20) Description of the type, one of:

TSQL
SERVICE_BROKER
DATABASE_MIRRORING

Not nullable.
state tinyint State of the availability group listener, one of:

0 = Online. The listener is listening and processing requests.
1 = Pending restart. the listener is offline, pending a restart.

If the availability group listener is listening to the same port as the server instance, these two listeners always have the same state.

Not nullable.

Note: The values in this column come from the TSD_listener object. The column doesn't support an offline state because when the TDS_listener is offline, it can't be queried for state.
state_desc nvarchar(16) Description of state, one of:

ONLINE
PENDING_RESTART

Not nullable.
start_time datetime Timestamp indicating when the listener was started. Not nullable.

Permissions

SQL Server 2019 (15.x) and earlier versions require VIEW SERVER STATE permission on the server.

SQL Server 2022 (16.x) and later versions require VIEW SERVER SECURITY STATE permission on the server.