| Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The End TCP/IP Connection (ENDTCPCNN) command is used to end a Transmission Control Protocol/Internet Protocol (TCP/IP) connection. This command ends a connection immediately and should be used only when a normal end is not possible.
Note: The ENDTCPCNN command is usually used by specifying option 4 on the Work with TCP/IP Connection Status list of the WRKTCPSTS (NETSTAT) display. The ENDTCPCNN command is provided as a separate command to give system administrators control over this function. By limiting the authority to the ENDTCPCNN command, the system administrator limits which users can end TCP/IP connections without restricting access to the NETSTAT utility.
| Top |
| Keyword | Description | Choices | Notes |
|---|---|---|---|
| PROTOCOL | Protocol | *UDP, *TCP | Required, Positional 1 |
| LCLINTNETA | Local internet address | Character value, * | Required, Positional 2 |
| LCLPORT | Local port | 1-65535 | Required, Positional 3 |
| RMTINTNETA | Remote internet address | Character value, * | Optional, Positional 4 |
| RMTPORT | Remote port | 1-65535, * | Optional, Positional 5 |
| Top |
Specifies the protocol used by the connection that is to be ended.
This is a required parameter.
| Top |
Specifies the local internet address of the connection to end.
This is a required parameter.
Note: If '*' is specified, an attempt will be made to end both IPv4 and IPv6 connections that have an unspecified local internet address. To end only an IPv4 connection that has an unspecified local internet address, specify '0.0.0.0' (the null IPv4 address) for the LCLINTNETA value. To end only an IPv6 connection that has an unspecified local internet address, specify '::' (the null IPv6 address) for the LCLINTNETA value.
An IPv4 address is specified in the form nnn.nnn.nnn.nnn, where nnn is a decimal number ranging from 0 through 255. An IPv4 address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address.
An IPv6 internet address is specified in the form x:x:x:x:x:x:x:x, where x is a hexidecimal number ranging from 0 through X'ffff'. "::" may be used once in the IPv6 address to indicate one or more groups of 16 bits of zeros. The "::" may be used to compress leading, imbedded, or trailing zeros in the address. An IPv6 internet address must be a unicast address and must not contain an imbedded IPv4 address (compatibility or mapped).
If the internet address is entered from a command line, the address must be enclosed in apostrophes.
| Top |
Specifies the local port number of the connection to end.
This is a required parameter.
Attention:
Ports 1 through 1024 are reserved for use by system-supplied TCP/IP applications. If the user specifies ports 1 through 1024, it can affect the operation of those applications.
| Top |
Specifies the remote internet address of the connection to end. This parameter is required if PROTOCOL is *TCP.
Note: If '*' is specified, an attempt will be made to end both IPv4 and IPv6 connections that have an unspecified remote internet address. To end just an IPv4 connection that has an unspecified remote internet address, specify '0.0.0.0' (the null IPv4 address) for the RMTINTNETA value. To end just an IPv6 connection that has an unspecified remote internet address, specify '::' (the null IPv6 address) for the RMTINTNETA value.
An IPv4 address is specified in the form nnn.nnn.nnn.nnn, where nnn is a decimal number ranging from 0 through 255. An IPv4 address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address.
An IPv6 internet address is specified in the form x:x:x:x:x:x:x:x, where x is a hexidecimal number ranging from 0 through X'ffff'. "::" may be used once in the IPv6 address to indicate one or more groups of 16 bits of zeros. The "::" may be used to compress leading, imbedded, or trailing zeros in the address. An IPv6 internet address must be a unicast address and must not contain an imbedded IPv4 address (compatibility or mapped).
If the internet address is entered from a command line, the address must be enclosed in apostrophes.
| Top |
Specifies the remote port number of the connection to end.
This parameter is required if PROTOCOL is *TCP.
| Top |
Example 1: Ending an IPv4 TCP Connection
ENDTCPCNN PROTOCOL(*TCP) LCLINTNETA('9.5.1.109')
LCLPORT(13054)
RMTINTNETA('9.130.28.144') RMTPORT(23)
This command ends the TCP connection between local port 13054 for local internet address 9.5.1.109 and remote port 23 for remote internet address 9.130.28.144. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.
Example 2: Closing an IPv4 UDP Socket
ENDTCPCNN PROTOCOL(*UDP) LCLINTNETA('9.130.28.144')
LCLPORT(596)
This command closes the UDP socket using local port 596 and local internet address 9.130.28.144. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.
Example 3: Ending a LISTEN State TCP Socket
ENDTCPCNN PROTOCOL(*TCP) LCLINTNETA(*) LCLPORT(5023)
RMTINTNETA(*) RMTPORT(*)
This command ends the TCP socket that is listening on local port 5023. The application that created this socket did not specify a local internet address. The socket is closed and the local port is made available for use by another application.
Example 4: Ending an IPv6 TCP Connection
ENDTCPCNN PROTOCOL(*TCP) LCLINTNETA('1234::5678')
LCLPORT(13054)
RMTINTNETA('1234::5679') RMTPORT(23)
This command ends the TCP connection between local port 13054 for local internet address 1234::5678 and remote port 23 for remote internet address 1234::5679. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.
Example 5: Closing an IPv6 UDP Socket
ENDTCPCNN PROTOCOL(*UDP) LCLINTNETA('::')
LCLPORT(596)
This command closes the UDP socket using local port 596 and an unspecified IPv6 local internet address. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.
| Top |
*ESCAPE Messages
| Top |