List Network Connections (QtocLstNetCnn) API

  Required Parameter Group:


  Service Program: QTOCNETSTS

  Threadsafe: Yes

The List Network Connections (QtocLstNetCnn) API returns a non-detailed list of all network connections, or a subset of all network connections for a specified network connection type. With each call to this API you can request IPv4 or IPv6 connections, but not both at the same time.

TCP/IP must be active on this system; otherwise, error message TCP84C0 will be issued.

The QSYS2.NETSTAT_INFO view can be used as an alternative to this API. See NETSTAT_INFO view for more information.


Authorities and Locks

User Space Library Authority
*EXECUTE
User Space Authority
*CHANGE
User Space Lock
*SHRNUP

Required Parameter Group

Qualified user space name
INPUT; CHAR(20)

The user space that is to receive the created list. The first 10 characters contain the user space name; the second 10 characters contain the name of the library in which the user space is located. You can use these special values for the library name:


Format name
INPUT; CHAR(8)

The format of the space information to be returned. The format name supported is:


Connection list qualifier
INPUT; CHAR(*)

A restriction on the network connections to be listed.

Connection list qualifier size
INPUT; BINARY(4)

The size in bytes of the connection list qualifier parameter.

Connection list qualifier format
INPUT; CHAR(8)

The format of the connection list qualifier parameter. The format name supported is:


Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Format of Connection Status Lists

To request a non-detailed list of local system connections, use format NCNN0100.

The connection description list consists of:

For details about the user area and generic header, see User spaces. For details about the remaining items, see the following sections.

When you retrieve list entry information from a user space, you must use the entry size returned in the generic header. The size of each entry may be padded at the end. If you do not use the entry size, the result may not be valid. For examples of how to process lists, see Examples: APIs and exit programs.


Input Parameter Section



Header Section



NCLQ0100 Format

The following table shows the format of the IPv4 connection list qualifier input parameter, named the NCLQ0100 format. For detailed descriptions of the fields in the table, see Field Descriptions.



Field Descriptions

List request type. The local internet address range, local port range, remote internet address range, and remote port range for which information is requested. Possible values are:

Local internet address lower value. The lower value of the local system internet address range, in dotted decimal format, requested for subsetting the list. The following is a special value:

Local internet address upper value. The upper value of the local system internet address range, in dotted decimal format, requested for subsetting the list. The following is a special value:

Local port lower value. The lower value of the local system port range requested for subsetting the list. Valid values range from 1 to 65535. The following is a special value:

Local port upper value. The upper value of the local system port range requested for subsetting the list. Valid values range from 1 to 65535. The following is a special value:

Net connection type. The type of connection or socket. Possible values are:

Remote internet address lower value. The lower value of the remote system internet address range, in dotted decimal format, requested for subsetting the list. The following is a special value:

Remote internet address upper value. The upper value of the remote system internet address range, in dotted decimal format, requested for subsetting the list. The following is a special value:

Remote port lower value. The lower value of the remote system port range requested for subsetting the list. Valid values range from 1 to 65535. The following is a special value:

Remote port upper value. The upper value of the remote system port range requested for subsetting the list. Valid values range from 1 to 65535. The following is a special value:

Reserved. A reserved field. It must be x'00'.


NCLQ0200 Format

The following table shows the format of the IPv6 connection list qualifier input parameter, named the NCLQ0200 format. For detailed descriptions of the fields in the table, see Field Descriptions.



Field Descriptions

List request type. The local internet address range, local port range, remote internet address range, and remote port range for which information is requested.

Possible values are:

Local internet IPv6 address lower value. The lower value of the local system internet address range, in IPv6 address format, requested for subsetting the list. Even though this field is defined as a character field, it must be stored in binary. It is recommended that you use the Sockets in6_addr structure.

The following is a special value:

Local internet IPv6 address upper value. The upper value of the local system internet address range, in IPv6 address format, requested for subsetting the list. Even though this field is defined as a character field, it must be stored in binary. It is recommended that you use the Sockets in6_addr structure.

The following is a special value:

Local port lower value. The lower value of the local system port range requested for subsetting the list. Valid values range from 1 to 65535.

The following is a special value:

Local port upper value. The upper value of the local system port range requested for subsetting the list. Valid values range from 1 to 65535.

The following is a special value:

Net connection type. The type of connection or socket.

Possible values are:

Remote internet IPv6 address lower value. The lower value of the remote system internet IPv6 address range, in IPv6 address format, requested for subsetting the list. Even though this field is defined as a character field, it must be stored in binary. It is recommended that you use the Sockets in6_addr structure.

The following is a special value:

Remote internet IPv6 address upper value. The upper value of the remote system internet IPv6 address range, in IPv6 address format, requested for subsetting the list. Even though this field is defined as a character field, it must be stored in binary. It is recommended that you use the Sockets in6_addr structure.

The following is a special value:

Remote port lower value. The lower value of the remote system port range requested for subsetting the list. Valid values range from 1 to 65535.

The following is a special value:

Remote port upper value. The upper value of the remote system port range requested for subsetting the list. Valid values range from 1 to 65535.

The following is a special value:

Reserved. A reserved field. It must be x'00'.


Format of Returned Connection Data

To retrieve the list of TCP/IPv4 connections, request format NCNN0100, and you will get a repeating list of NCNN0100 tables, each one returning information about a single IPv4 connection. To retrieve the list of TCP/IPv6 connections, request format NCNN0200, and you will get a repeating list of NCNN0200 tables, each one returning information about a single IPv6 connection.


NCNN0100 Format

The following information about a user space is returned for the NCNN0100 format. For detailed descriptions of the fields in the table, see Field Descriptions.



Field Descriptions

Associated user profile. The user profile of the job on the local system which first performed a sockets API bind() of the socket.

Note: This field does not reliably indicate the current user of a connection or socket. To see a list of the jobs or tasks currently using a connection or socket, use the Retrieve Network Connection Data (QtocRtvNetCnnDta) API.

Bytes in. The number of bytes received from the remote host.

Bytes out. The number of bytes sent to the remote host.

Connection open type. The type of open that was done to start this connection. This field only applies to TCP connections.

Possible values are:

Idle time in milliseconds. The length of time since the last activity on this connection. The length of time is shown in milliseconds.

Local address. The local system internet address, in dotted decimal format, of the connection.

Local address binary. Binary representation of the local address.

Local port. The local system port number.

Net connection type. The type of connection or socket. Possible values are:

Remote address. The internet address, in dotted decimal format, of the remote host.

The following special value may be returned:

Remote address binary. Binary representation of the remote address.

The following special value may be returned:

Remote port. The remote host port number. Zero is shown if the list entry is for a UDP socket.

Reserved. An ignored field.

TCP state. A typical connection goes through the states:


NCNN0200 Format

The following information about a TCP/IPv6 connection is returned for the NCNN0200 format. For detailed descriptions of the fields in the table, see Field Descriptions.



Field Descriptions

Associated user profile. The user profile of the job on the local system which first performed a sockets API bind() of the socket.

Note: This field does not reliably indicate the current user of a connection or socket. To see a list of the jobs or tasks currently using a connection or socket, use the Retrieve Network Connection Data (QtocRtvNetCnnDta) API.

Bytes in. The number of bytes received from the remote host.

Bytes out. The number of bytes sent to the remote host.

Connection open type. The type of open that was done to start this connection. This field only applies to TCP connections.

Possible values are:

Idle time in milliseconds. The length of time since the last activity on this connection. The length of time is shown in milliseconds.

Line Description. The local system line description associated with this connection. This field is only set for connections bound to link local unicast interfaces.

Local IPv6 address. The local system internet address, in IPv6 address format, of the connection. This field is NULL padded.

Local IPv6 address binary. Binary representation of the local IPv6 address. Even though this field is defined as a character field, a binary IPv6 address is returned in it.

Local port. The port number of the local end of the connection.

Net connection type. The type of connection or socket.

Possible values are:

Reserved. An ignored field.

Remote IPv6 address. The internet address, in IPv6 address format, of the remote host. This field is NULL padded.

Special values are:

Remote IPv6 address binary. Binary representation of the remote address. Even though this field is defined as a character field, a binary IPv6 address is returned in it.

A special value that may be returned is:

Remote port. The port number of the remote end of the connection.

Special values are:

TCP state. A typical connection goes through the states:

Start of change Virtual LAN identifier. The virtual LAN identifier associated with this connection. This field is only set for connections bound to link local unicast interfaces.

Possible values are:



Error Messages



API introduced: V5R1